龙芯平台.NET是龙芯基于开源社区.NET自主开发改编的龙芯版本。我们将长期进行安全更新和bug修复,并持续优化性能。社区 .NET7 版本已原生支持 LoongArch64 架构源码。具有以下特点:
龙芯近期发布的LoongArch64架构的.NET6.0-SDK,基于上游社区.NET6.0-LTS-SDK,也是LTS版本,在生命周期维护范围,将不断更新升级。龙芯还发布了.NET文档网站:
功能预览:
龙芯Nuget源码配置方法:
在龙芯Nuget源码中,您可以找到一些nupkg包,其中包含与LoongArch64架构平台相关的文件。需要修改本地的~/.nuget/NuGet/Nuget.config配置文件,添加龙芯Nuget源码,支持下载相关nupkg包。或者手动从龙芯Nuget源码下载,解压到~/.nuget/packages/对应目录下使用。
$ cat ~/.nuget/NuGet/NuGet.Config
龙芯.NET 6安装方法
目前支持dotnet-sdk的各个子模块单独安装。子模块如下:
使用包管理器离线安装/卸载 deb
离线安装命令,需要注意安装包顺序
$ sudo apt install ./dotnet-host-6.0.5-ea1-loongarch64.deb
./dotnet-hostfxr-6.0.5-ea1-loongarch64.deb
./dotnet-runtime-deps-6.0.5-ea1-loongarch64.deb
./dotnet-runtime-6.0.5-ea1-loongarch64.deb
./dotnet-targeting-pack-6.0.5-ea1-loongarch64.deb
./aspnetcore-targeting-pack-6.0.5-ea1-loongarch64.deb
./dotnet-apphost-pack-6.0.5-ea1-loongarch64.deb
./aspnetcore-runtime-6.0.5-ea1-loongarch64.deb
./netstandard-targeting-pack-2.1_2.1.0-1_ea1-loongarch64.deb
./dotnet-sdk-6.0.105-ea1-loongarch64.deb
# 卸载:
$ sudo apt remove dotnet-runtime-deps-6.0
dotnet-apphost-pack-6.0
dotnet-host
dotnet-hostfxr-6.0
dotnet-runtime-6.0
dotnet-sdk-6.0
dotnet-targeting-pack-6.0
aspnetcore-runtime-6.0
aspnetcore-targeting-pack-6.0
netstandard-targeting-pack-2.1
转速
# 离线安装命令,需要注意安装包顺序 - Loongnix Server RPM
$ sudo yum install dotnet-host-6.0.5-ea1.loongarch64.rpm
dotnet-hostfxr-6.0-6.0.5-ea1.loongarch64.rpm
dotnet-runtime-deps-6.0-6.0.5-ea1.loongarch64.rpm
dotnet-runtime-6.0-6.0.5-ea1.loongarch64.rpm
dotnet-targeting-pack-6.0-6.0.5-ea1.loongarch64.rpm
aspnetcore-targeting-pack-6.0-6.0.5-ea1.loongarch64.rpm
dotnet-apphost-pack-6.0-6.0.5-ea1.loongarch64.rpm
aspnetcore-runtime-6.0-6.0.5-ea1.loongarch64.rpm
netstandard-targeting-pack-2.1-2.1.0-ea1.loongarch64.rpm
dotnet-sdk-6.0-6.0.105-ea1.loongarch64.rpm
# 离线安装命令,需要注意安装包顺序 - 麒麟v10 RPM
$ sudo yum install dotnet-host-6.0.5-ea1.a.ky10.loongarch64.rpm
dotnet-hostfxr-6.0-6.0.5-ea1.a.ky10.loongarch64.rpm
dotnet-runtime-deps-6.0-6.0.5-ea1.a.ky10.loongarch64.rpm
dotnet-runtime-6.0-6.0.5-ea1.a.ky10.loongarch64.rpm
dotnet-targeting-pack-6.0-6.0.5-ea1.a.ky10.loongarch64.rpm
aspnetcore-targeting-pack-6.0-6.0.5-ea1.a.ky10.loongarch64.rpm
dotnet-apphost-pack-6.0-6.0.5-ea1.a.ky10.loongarch64.rpm
aspnetcore-runtime-6.0-6.0.5-ea1.a.ky10.loongarch64.rpm
netstandard-targeting-pack-2.1-2.1.0-ea1.a.ky10.loongarch64.rpm
dotnet-sdk-6.0-6.0.105-ea1.a.ky10.loongarch64.rpm
# 卸载:
$ sudo yum remove dotnet-runtime-deps-6.0
dotnet-apphost-pack-6.0
dotnet-host
dotnet-hostfxr-6.0
dotnet-runtime-6.0
dotnet-sdk-6.0
dotnet-targeting-pack-6.0
aspnetcore-runtime-6.0
aspnetcore-targeting-pack-6.0
netstandard-targeting-pack-2.1
使用包管理器在线安装/卸载deb
# 在线安装
$ sudo apt install dotnet-sdk-6.0
# 卸载:
$ sudo apt remove dotnet-runtime-deps-6.0
dotnet-apphost-pack-6.0
dotnet-host
dotnet-hostfxr-6.0
dotnet-runtime-6.0
dotnet-sdk-6.0
dotnet-targeting-pack-6.0
aspnetcore-runtime-6.0
aspnetcore-targeting-pack-6.0
netstandard-targeting-pack-2.1
转速
# 在线安装
$ sudo yum install dotnet-sdk-6.0
# 卸载:
$ sudo yum remove dotnet-runtime-deps-6.0
dotnet-apphost-pack-6.0
dotnet-host
dotnet-hostfxr-6.0
dotnet-runtime-6.0
dotnet-sdk-6.0
dotnet-targeting-pack-6.0
aspnetcore-runtime-6.0
aspnetcore-targeting-pack-6.0
netstandard-targeting-pack-2.1
查看安装结果
$ whereis dotnet
dotnet: /usr/bin/dotnet /usr/share/dotnet /usr/share/man/man1/dotnet.1.gz
查看 .NET 版本
有关使用 .NET 和示例的更多信息,请参阅 .NET 在线文档
### 查看SDK版本:
可使用终端查看当前安装的 .NET Core SDK 版本。 打开终端并运行以下命令。
dotnet --list-sdks
查看运行时版本:
可使用以下命令查看当前安装的 .NET Core 运行时版本。
dotnet --list-runtimes
详细信息:
可通过以下命令查看 SDK 版本和运行时版本。 你还将获得其他环境相关信息,如操作系统版本和运行时标识符 (RID)。
dotnet --info
龙芯LoongArch64版.NET版发布说明
上游社区存储库原生支持 .NET7 的 LoongArch64 架构。龙芯发布的LoongArch64架构SDK分为两个版本:
LoongArch平台如何支持SkiaSharp?
由于SkiaSharp包含平台相关代码,引用SkiaSharp的项目需要引用nupkg的LoongArch版本,一般需要引用HarfBuzzSharp包。
支持的方法如下。
配置龙芯Nuget源码,添加包引用
添加龙芯nuget源配置的参考页面。在项目配置文件中添加对SkiaSharp和HarfBuzzSharp的引用,引用命令如下:
cd project-src # 进入到项目源码目录中
dotnet add package SkiaSharp.NativeAssets.Linux --version 2.80.3
dotnet add package HarfBuzzSharp.NativeAssets.Linux --version 2.6.1
执行上述命令后,注意查看shell是否有从nuget.loongnix.cn下载nupkg包的输出,如下:
info : Adding PackageReference for package 'SkiaSharp.NativeAssets.Linux' into project '/data2/loongson/example/example.csproj'.
info : Restoring packages for /data2/loongson/example/example.csproj...
info : GET http://nuget.loongnix.cn:5000/v3/package/skiasharp.nativeassets.linux/index.json
info : OK http://nuget.loongnix.cn:5000/v3/package/skiasharp.nativeassets.linux/index.json 48ms
info : GET http://nuget.loongnix.cn:5000/v3/package/skiasharp.nativeassets.linux/2.80.3/skiasharp.nativeassets.linux.2.80.3.nupkg
info : OK http://nuget.loongnix.cn:5000/v3/package/skiasharp.nativeassets.linux/2.80.3/skiasharp.nativeassets.linux.2.80.3.nupkg 54ms
...
info : Adding PackageReference for package 'HarfBuzzSharp.NativeAssets.Linux' into project '/data2/loongson/example/example.csproj'.
info : Restoring packages for /data2/loongson/example/example.csproj...
info : GET http://nuget.loongnix.cn:5000/v3/package/harfbuzzsharp.nativeassets.linux/index.json
info : OK http://nuget.loongnix.cn:5000/v3/package/harfbuzzsharp.nativeassets.linux/index.json 405ms
info : GET https://api.nuget.org/v3-flatcontainer/harfbuzzsharp.nativeassets.linux/index.json
info : GET http://nuget.loongnix.cn:5000/v3/package/harfbuzzsharp.nativeassets.linux/2.6.1/harfbuzzsharp.nativeassets.linux.2.6.1.nupkg
info : OK http://nuget.loongnix.cn:5000/v3/package/harfbuzzsharp.nativeassets.linux/2.6.1/harfbuzzsharp.nativeassets.linux.2.6.1.nupkg 57ms
这是按照上述步骤完成的。
手动下载并复制到SDK目录
如果需要运行其他平台编译的项目(如x64),建议手动从龙芯Nuget源下载SkiaSharp和HarfBuzzSharp nupkg包,并将so文件复制到SDK解压后的目录。
# 下载nupkg包
wget http://nuget.loongnix.cn:5000/v3/package/skiasharp.nativeassets.linux/2.80.3/skiasharp.nativeassets.linux.2.80.3.nupkg
wget http://nuget.loongnix.cn:5000/v3/package/harfbuzzsharp.nativeassets.linux/2.6.1/harfbuzzsharp.nativeassets.linux.2.6.1.nupkg
# 解压
mkdir skiasharp harfbuzzsharp
unzip skiasharp.nativeassets.linux.2.80.3.nupkg -d skiasharp
unzip harfbuzzsharp.nativeassets.linux.2.6.1.nupkg -d harfbuzzsharp
# 以.NET 6.0.5默认路径为例:
# 复制libSkiaSharp.so和libHarfBuzzSharp.so到SDK目录下dotnet/shared/Microsoft.NETCore.App/6.0.5
sudo cp ./skiasharp/runtimes/linux-loongarch64/native/libSkiaSharp.so /usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.5
sudo cp ./harfbuzzsharp/runtimes/linux-loongarch64/native/libHarfBuzzSharp.so /usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.5
暂无评论内容