dotnet / dotnet/sdk

NativeAOT Arm32 cross compile fails with linker errors

Open
#50,915 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

### Describe the bug
Building hello world for arm32 from desktop linux (Ubuntu) fails with clang linker errors

### To Reproduce
1. Create a hello world dotnet console project for nativeaot `dotnet new console --aot`
2. Install cross compiler toolchain
```
apt-get update && apt-get install -y clang llvm gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
```
3. Build for arm32
```
dotnet publish -r linux-arm -c Release
```

-> fails with clang linker errors

### Exceptions (if any)
```
Restore complete (0.2s)
WearableDotnet failed with 2 error(s) (0.2s) → bin/Release/net9.0/linux-arm/WearableDotnet.dll
clang : error : linker command failed with exit code 1 (use -v to see invocation)
/tmp/DOTNET_CLI_HOME/.nuget/packages/microsoft.dotnet.ilcompiler/9.0.1/build/Microsoft.NETCore.Native.targets(376,5): error MSB3073: The command ""clang" "obj/Release/net9.0/linux-arm/native/WearableDotnet.o" -o "bin/Release/net9.0/linux-arm/native/WearableDotnet" -Wl,--version-script=obj/Release/net9.0/linux-arm/native/WearableDotnet.exports -Wl,--export-dynamic -gz=zlib -fuse-ld=bfd /tmp/DOTNET_CLI_HOME/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.1/sdk/libbootstrapper.o /tmp/DOTNET_CLI_HOME/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.1/sdk/libRuntime.WorkstationGC.a /tmp/DOTNET_CLI_HOME/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.1/sdk/libeventpipe-disabled.a /tmp/DOTNET_CLI_HOME/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.1/sdk/libstandalonegc-disabled.a /tmp/DOTNET_CLI_HOME/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.1/sdk/libstdc++compat.a /tmp/DOTNET_CLI_HOME/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.1/framework/libSystem.Native.a /tmp/DOTNET_CLI_HOME/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.1/framework/libSystem.IO.Compression.Native.a /tmp/DOTNET_CLI_HOME/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.1/framework/libSystem.Net.Security.Native.a /tmp/DOTNET_CLI_HOME/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.1/framework/libSystem.Security.Cryptography.Native.OpenSsl.a /tmp/DOTNET_CLI_HOME/.nuget/packages/runtime.linux-arm.microsoft.dotnet.ilcompiler/9.0.1/sdk/libz.a --target=armv7-linux-gnueabihf -g -Wl,-rpath,'$ORIGIN' -Wl,--build-id=sha1 -Wl,--as-needed -pthread -ldl -lrt -lm -pie -Wl,-pie -Wl,-z,relro -Wl,-z,now -Wl,--eh-frame-hdr -Wl,--discard-all -Wl,--gc-sections" exited with code 1.

Build failed with 2 error(s) in 0.6s
```

### Further technical details
.NET SDK:
Version: 9.0.102
Commit: cb83cd4923
Workload version: 9.0.100-manifests.88387b28
MSBuild version: 17.12.18+ed8c6aec5

Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: linux-x64
Base Path: /home/hughesd/.dotnet/sdk/9.0.102/

.NET workloads installed:
[maui-android]
Installation Source: SDK 9.0.100
Manifest Version: 9.0.51/9.0.100
Manifest Path: /home/hughesd/.dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.maui/9.0.51/WorkloadManifest.json
Install Type: FileBased

[maui-tizen]
Installation Source: SDK 9.0.100
Manifest Version: 9.0.51/9.0.100
Manifest Path: /home/hughesd/.dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.maui/9.0.51/WorkloadManifest.json
Install Type: FileBased

Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.1
Architecture: x64
Commit: c8acea2262

.NET SDKs installed:
8.0.406 [/home/hughesd/.dotnet/sdk]
9.0.102 [/home/hughesd/.dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.13 [/home/hughesd/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.1 [/home/hughesd/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.13 [/home/hughesd/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.1 [/home/hughesd/.dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
DOTNET_ROOT [/home/hughesd/.dotnet]

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version

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.