Closed DrewRidley closed 1 year ago
Native AOT project moved to https://github.com/dotnet/runtime. Could you please open questions like this in dotnet/runtime repo next time.
When linking the static libraries, it is important to also include additional dependencies. Some documentation about it is at https://github.com/dotnet/samples/tree/main/core/nativeaot/NativeLibrary#building-static-libraries . The most reliable way to find the complete list of additional dependencies is by publishing a shared library with detailed verbosity (/v:d
argument for dotnet publish
) and looking at the linker command line. We invoke linker via clang
, so look for a command line that looks like this: "clang" "obj/Release/net8.0/linux-x64/native/repro.o" -o "bin/Release/net8.0/linux-x64/native/repro ....
.
The GlobalizationNative_*
symbols are defined in libSystem.Globalization.Native.a
library, so make sure that you are passing that library to the linker.
https://github.com/dotnet/runtime/issues/70277 tracks improving the static linking scenario. Resolving as duplicate of https://github.com/dotnet/runtime/issues/70277 .
Thank you so much for getting back to me! I have the full logs, but I am still a bit confused as I dont seem to have any libraries in my output folder besides the one being built. Do I have to manually publish each of these dlls with NativeAOT and link accordingly?
https://gist.github.com/DrewRidley/52657436ccb3a347b94240f19eafe9e9
this output leaves no mention of any specific static libraries or symbols as far as I am aware.
These additional dependencies are not dropped into the output folder. They are in the native AOT package and need to be referenced via a full path.
Here is the relevant command link from your log:
"clang" "obj/Release/net8.0/osx.13-arm64/native/AbominationInterop.o" -o "bin/Release/net8.0/osx.13-arm64/native/AbominationInterop.dylib" -exported_symbols_list "obj/Release/net8.0/osx.13-arm64/native/AbominationInterop.exports" /Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/sdk/libbootstrapperdll.a /Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/sdk/libRuntime.WorkstationGC.a /Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/sdk/libeventpipe-disabled.a /Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/sdk/libstdc++compat.a /Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/framework/libSystem.Native.a /Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/framework/libSystem.Globalization.Native.a /Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/framework/libSystem.IO.Compression.Native.a /Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/framework/libSystem.Net.Security.Native.a /Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/framework/libSystem.Security.Cryptography.Native.Apple.a /Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/framework/libSystem.Security.Cryptography.Native.OpenSsl.a -g -Wl,-rpath,'@executable_path' -ldl -lobjc -lswiftCore -lswiftFoundation -lz -licucore -L/usr/lib/swift -lm -dynamiclib -Wl,-u,_NativeAOT_StaticInitialization -framework CoreFoundation -framework CryptoKit -framework Foundation -framework Security -framework GSS
You should include all /Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/..../*.a
libraries listed on this command line when linking your library.
/Users/drewridley/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/
I found the files, Thank you for your time.
Hey all, hope everyone is doing well. I am currently trying to compile a very popular C# physics engine, bepu, and am trying to write bindings to rust with bindgen.
Unfortunately, I managed to get as far as some linker errors, but I am unsure as how to proceed as the documentation is not clear why the CoreLibs might not be in the final binary.
Thats just a snippet of the full output, but a lot of the C# core dll references seem to be totally missing from the output. This still occurs even if I use
<SelfContained>true</SelfContained>
.I am using the .net 8 preview publicly available, and am currently on an arm based M1 mac. Please do let me know if it is a lack of complete support for my platform.
Thank you.