• 龙芯发布 .NET 6 SDK 6.0.105ea1 LoongArch64 版本


    龙芯平台.NET,是龙芯公司基于开源社区.NET独立研发适配的龙芯版本,我们会长期进行安全更新和错误修复,并持续进行性能优化。社区.NET7版本开始已经原生支持LoongArch64架构源码。具备如下特性:

    • 跟进社区最新版本,获取及时的安全更新和问题修复
    • 支持多OS:Loongnix、统信UOS、中标麒麟等64位操作系统
    • 支持LoongArch架构
    • 明确的、多版本的产品维护计划
    • 专业团队支持

    龙芯最近发布的LoongArch64架构的.NET6.0-SDK是基于上游社区.NET6.0-LTS-SDK制作的,同样是LTS版本,在生命周期维护范围内,会持续进行更新升级。龙芯同时发布了.NET 文档网站:http://docs.loongnix.cn/dotnet/

    特性预览:

    • runtime 支持默认原生分层编译及优化特性;

    • 支持 libSystem.IO.Ports.Native.so 串口库 (通过龙芯Nuget源下载);

    • 支持 libSkiaSharp.so、libHarfBuzzSharp.so 图形库 (通过龙芯Nuget源下载);

    • 支持 SQLite 本地数据库 (通过龙芯Nuget源下载);

    • 支持 dotnet-sdk 各子模块单独分包安装,安装方法请见.NET6安装说明

    龙芯Nuget源配置方法:

    龙芯Nuget源上,可以找到一些包含 LoongArch64 架构平台相关文件的 nupkg 包。 你需要修改本地 ~/.nuget/NuGet/Nuget.config 配置文件,添加龙芯 Nuget 源,以支持相关 nupkg 包的下载。或者手动在龙芯 Nuget 源下载,解压到本地 ~/.nuget/packages/ 对应目录下使用。

    $ cat ~/.nuget/NuGet/NuGet.Config
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <add key="local" value="http://nuget.loongnix.cn:5000/v3/index.json" />
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
      </packageSources>
    </configuration>

    龙芯.NET 6安装方法

    当前支持 dotnet-sdk 各子模块单独分包安装,各子模块如下:

    • aspnetcore-runtime-6.0
    • aspnetcore-targeting-pack-6.0
    • dotnet-apphost-pack-6.0
    • dotnet-host-6.0
    • dotnet-hostfxr-6.0
    • dotnet-runtime-6.0
    • dotnet-runtime-deps-6.0
    • dotnet-sdk-6.0
    • dotnet-targeting-pack-6.0
    • netstandard-targeting-pack-2.1
    使用包管理器离线安装/卸载
    • 下载页面 下载安装包,请确认所使用的版本。
    • 安装/卸载:(以 dotnet-sdk-6.0.105-ea1 loongarch64 示例)
    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
    rpm
    # 离线安装命令,需要注意安装包顺序 - 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
    rpm
    # 在线安装
    $ 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 ,分两种版本类型:

    • 试用版: 其中安装包名字中包含"ea"
      • 例如龙芯基于上游社区 SDK 6.0.105 版本发布的 LoongArch64 ea 版本 deb 安装包名为: dotnet-sdk-6.0.105-ea1-loongarch64.deb
    • 正式版: 稳定版本
      • 例如龙芯基于上游社区 SDK 6.0.105 版本发布的 LoongArch64 正式版本 deb 安装包名为: dotnet-sdk-6.0.105-1-loongarch64.deb
    如何在LoongArch平台支持SkiaSharp?

    由于SkiaSharp中包含平台相关代码,所以引用SkiaSharp的项目需要引用LoongArch版本的nupkg,同时一般还需要引用HarfBuzzSharp包。

    支持的方法有如下两种。

    配置龙芯Nuget源,添加包引用

    参考龙芯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
  • 相关阅读:
    Codeforces1420E. Battle Lemmings 题解 动态规划
    C++使用partial_sum求前缀和
    HDU6171 Admiral 题解 折半搜索
    HDU3017 Treasure Division 题解 折半搜索
    使用re.split 按标点+空格的一种分割办法
    实现CString的Format功能,支持跨平台
    转载一篇makefile,说的很详细
    Microsoft C++ 异常: std::system_error std::thread
    源码一样,运行结果不一致的解决办法
    记录一次阿里的电话面试
  • 原文地址:https://www.cnblogs.com/shanyou/p/16387000.html
Copyright © 2020-2023  润新知