Open
Description
Operating system:
Debian GNU/Linux 11 (bullseye), 64-bit
(Same outputs are generated with a freshly created project)
I wanted to try and publish my project with Native AOT for linux-arm64. I also tried with linux-x64.
My command input with linux-arm64:
$dotnet publish -c Release -r linux-arm64 "code/DLL/DLL.csproj" -p:IncludeNativeLibrariesForSelfExtract=false -f net8.0
Console output:
myUser:~/Dokumente/Projects/myProject$ dotnet publish -c Release -r linux-arm64 "code/DLL/DLL.csproj" -p:IncludeNativeLibrariesForSelfExtract=false -f net8.0
MSBuild-Version 17.9.6+a4ecab324 für .NET
Wiederherzustellende Projekte werden ermittelt...
"/home/myUser/Dokumente/Projects/myProject/code/DLL/DLL.csproj" wiederhergestellt (in "1,1 sec").
DLL -> /home/myUser/Dokumente/Projects/myProject/code/DLL/bin/Release/net8.0/linux-arm64/DLL.dll
gcc : error : unrecognized command-line option ‘--target=aarch64-linux-gnu’ [/home/myUser/Dokumente/Projects/myProject/code/DLL/DLL.csproj::TargetFramework=net8.0]
/home/myUser/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.3/build/Microsoft.NETCore.Native.targets(367,5): error MSB3073: Der Befehl ""gcc" "obj/Release/net8.0/linux-arm64/native/DLL.o" -o "bin/Release/net8.0/linux-arm64/native/DLL.so" -Wl,--version-script=obj/Release/net8.0/linux-arm64/native/DLL.exports -Wl,--export-dynamic -gz=zlib -fuse-ld=bfd /home/myUser/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/8.0.3/sdk/libbootstrapperdll.o /home/myUser/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/8.0.3/sdk/libRuntime.WorkstationGC.a /home/myUser/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/8.0.3/sdk/libeventpipe-disabled.a /home/myUser/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/8.0.3/sdk/libstdc++compat.a /home/myUser/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/8.0.3/framework/libSystem.Native.a /home/myUser/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/8.0.3/framework/libSystem.IO.Compression.Native.a /home/myUser/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/8.0.3/framework/libSystem.Net.Security.Native.a /home/myUser/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/8.0.3/framework/libSystem.Security.Cryptography.Native.OpenSsl.a --target=aarch64-linux-gnu -g -Wl,-rpath,'$ORIGIN' -Wl,--build-id=sha1 -Wl,--as-needed -Wl,-e0x0 -pthread -ldl -lz -lrt -lm -shared -Wl,-z,relro -Wl,-z,now -Wl,--eh-frame-hdr -Wl,--discard-all -Wl,--gc-sections" wurde mit dem Code 1 beendet. [/home/myUser/Dokumente/Projects/myProject/code/DLL/DLL.csproj::TargetFramework=net8.0]
My command input with linux-x64:
$ dotnet publish -c Release -r linux-x64 "code/DLL/DLL.csproj" -p:IncludeNativeLibrariesForSelfExtract=false -f net8.0
Console output:
DLL -> /home/myUser/Dokumente/Projects/myProject/code/DLL/bin/Release/net8.0/linux-x64/DLL.dll
Generating native code
/usr/bin/ld.bfd: cannot find -lz
collect2 : error : ld returned 1 exit status [/home/myUser/Dokumente/Projects/myProject/code/DLL/DLL.csproj::TargetFramework=net8.0]
/home/myUser/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.3/build/Microsoft.NETCore.Native.targets(367,5): error MSB3073: Der Befehl ""gcc" "obj/Release/net8.0/linux-x64/native/DLL.o" -o "bin/Release/net8.0/linux-x64/native/DLL.so" -Wl,--version-script=obj/Release/net8.0/linux-x64/native/DLL.exports -Wl,--export-dynamic -gz=zlib -fuse-ld=bfd /home/myUser/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.3/sdk/libbootstrapperdll.o /home/myUser/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.3/sdk/libRuntime.WorkstationGC.a /home/myUser/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.3/sdk/libeventpipe-disabled.a /home/myUser/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.3/sdk/libstdc++compat.a /home/myUser/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.3/framework/libSystem.Native.a /home/myUser/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.3/framework/libSystem.IO.Compression.Native.a /home/myUser/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.3/framework/libSystem.Net.Security.Native.a /home/myUser/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.3/framework/libSystem.Security.Cryptography.Native.OpenSsl.a -g -Wl,-rpath,'$ORIGIN' -Wl,--build-id=sha1 -Wl,--as-needed -Wl,-e0x0 -pthread -ldl -lz -lrt -lm -shared -Wl,-z,relro -Wl,-z,now -Wl,--eh-frame-hdr -Wl,--discard-all -Wl,--gc-sections" wurde mit dem Code 1 beendet. [/home/myUser/Dokumente/Projects/myProject/code/DLL/DLL.csproj::TargetFramework=net8.0]