dotnet / dotnet/sdk

native aot cross build failed in linux

Open
#46,948 2 comments 0 reactions 0 assignees View on GitHub
Area-NativeAOT untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

Steps to reproduce:

```
dotnet new classlib
```
.csproj:
```


net9.0
enable
enable
true
true
linux-arm
true

```
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.