Open An0nyMooUS opened 2 years ago
I export android NDK clang.
dotnet publish -r android-arm64 -c Release -p:CppCompilerAndLinker=aarch64-linux-android31-clang /p:NativeLib=Shared /p:SelfContained=true
Returns:
clang-12 : error : no input files [/mnt/c/wtf/nativelibrary/NativeLibrary.csproj]
/root/.nuget/packages/microsoft.dotnet.ilcompiler/7.0.0-alpha.1.22074.1/build/Microsoft.NETCore.Native.targets(374,5): error MSB3073: The command "aarch64-linux-android31-clang "obj/Release/net6.0/android-arm64/native/NativeLibrary.o" -o "bin/Release/net6.0/android-arm64/native/NativeLibrary.so" -Wl,--version-script=obj/Release/net6.0/android-arm64/native/NativeLibrary.exports /root/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/7.0.0-alpha.1.22074.1/sdk/libbootstrapperdll.a /root/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/7.0.0-alpha.1.22074.1/sdk/libRuntime.WorkstationGC.a /root/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/7.0.0-alpha.1.22074.1/framework/libSystem.Native.a /root/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/7.0.0-alpha.1.22074.1/framework/libSystem.Globalization.Native.a /root/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/7.0.0-alpha.1.22074.1/framework/libSystem.IO.Compression.Native.a /root/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/7.0.0-alpha.1.22074.1/framework/libSystem.Net.Security.Native.a /root/.nuget/packages/runtime.linux-arm64.microsoft.dotnet.ilcompiler/7.0.0-alpha.1.22074.1/framework/libSystem.Security.Cryptography.Native.OpenSsl.a --target=aarch64-linux-gnu -g -Wl,-rpath,'$ORIGIN' -Wl,--as-needed -pthread -lstdc++ -ldl -lm -lz -lgssapi_krb5 -lrt -shared -Wl,-z,relro -Wl,-z,now -Wl,--require-defined,CoreRT_StaticInitialization -Wl,--discard-all -Wl,--gc-sections" exited with code 1. [/mnt/c/wtf/nativelibrary/NativeLibrary.csproj]
Only if p:NativeLib is Shared
. I successfully build Static
version. (but i need Shared
(.so))
I followyed this tutorial:
https://github.com/dotnet/runtimelab/tree/feature/NativeAOT/samples/NativeLibrary
and change
-r win-x64
to-r android-arm64
. On Windows produces:"error : Cross-OS native compilation is not supported"
that's ok..., i tryed to use WSL2 + Ubuntu to do this. and produces:
/usr/bin/ld: unrecognised emulation mode: aarch64linux
.Its possible to build for ARM/ARM64? i successfully build for
android-x86/x64
. but i can't compile for ARM/ARM 64.