Description
Steps to reproduce:
dotnet new classlib
.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<IsAotCompatible>true</IsAotCompatible>
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>
install tools:
apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
dotnet add package runtime.linux-arm.Microsoft.DotNet.ILCompiler --version 9.0.2
apt-get install clang zlib1g-dev
build:
dotnet publish -c Release --self-contained true
netcore_aot_test 失败,出现 2 错误 (0.4) → bin/Release/net9.0/linux-arm/netcore_aot_test.dll
clang : error : linker command failed with exit code 1 (use -v to see invocation)
/root/.nuget/packages/microsoft.dotnet.ilcompiler/9.0.2/build/Microsoft.NETCore.Native.targets(376,5): error MSB3073: 命令“"clang" "obj/Release/net9.0/linux-arm/native/netcore_aot_test.o" -o "bin/Release/net9.0/linux-arm/native/netcore_aot_test.so" -Wl,--version-script=obj/Release/net9.0/linux-arm/native/netcore_aot_test.exports -Wl,--export-dynamic -gz=zlib -fuse-ld=bfd /root/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.2/sdk/libbootstrapperdll.o /root/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.2/sdk/libRuntime.WorkstationGC.a /root/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.2/sdk/libeventpipe-disabled.a /root/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.2/sdk/libstandalonegc-disabled.a /root/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.2/sdk/libstdc++compat.a /root/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.2/framework/libSystem.Native.a /root/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.2/framework/libSystem.Globalization.Native.a /root/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.2/framework/libSystem.IO.Compression.Native.a /root/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.2/framework/libSystem.Net.Security.Native.a /root/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.2/framework/libSystem.Security.Cryptography.Native.OpenSsl.a /root/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.2/sdk/libz.a --target=armv7-linux-gnueabihf -g -Wl,-rpath,'$ORIGIN' -Wl,--build-id=sha1 -Wl,--as-needed -Wl,-e,0x0 -pthread -ldl -lrt -lm -shared -Wl,-z,relro -Wl,-z,now -Wl,--eh-frame-hdr -Wl,--discard-all -Wl,--gc-sections”已退出,代码为 1。
I think I should configure the cross - toolchain name and change it to arm-linux-gnueabihf-gcc.