Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native aot cross build failed in linux #46948

Open
snikeguo opened this issue Feb 19, 2025 · 0 comments
Open

native aot cross build failed in linux #46948

snikeguo opened this issue Feb 19, 2025 · 0 comments
Labels
Area-NativeAOT Native AOT compilation untriaged Request triage from a team member

Comments

@snikeguo
Copy link

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.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NativeAOT Native AOT compilation untriaged Request triage from a team member labels Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NativeAOT Native AOT compilation untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

1 participant