Trying to cross compile from windows to android

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jan 20 19:31:06 UTC 2022


On Thu, Jan 20, 2022 at 07:10:40PM +0000, Jerry via Digitalmars-d-learn wrote:
> Hello, followed the guide at https://wiki.dlang.org/Build_D_for_Android
> but got stuck on figuring out what linker to use.
> 
> "../ldc_android/ldc/bin/ldc2.exe" -mtriple=armv7a--linux-andro
> ideabi main.d
> clang: error: invalid linker name in argument '-fuse-ld=bfd'
> Error: ldc_android/android_ndk/toolchains/llvm/prebuilt/windows-x86_64/bin
> /aarch64-linux-android21-clang.cmd failed with status: 1
> 
> Do I need to install a GNU linker with cross compile compatabilities or is
> my system not configured properly?

You're trying to use bfd as your linker, and I think that only exists on
the Linux version of the NDK. Maybe try looking somewhere under
ldc_android/android_ndk/toolchains/x86_64-*/prebuilt/windows-x86_64/bin
to see what linkers are shipped with your NDK, and specify that instead?

On Linux, I see a bunch of binaries named x86_64-linux-android-*,
including *-ld, *-ld.bfd, *-ld.gold, which are the 3 linkers that can be
used via -fuse-ld=bfd, -fuse-ld=gold, etc..  I'm not sure how it works
on Windows, but there should be corresponding binaries that might give a
hint as to what's the correct -fuse-ld=... option you need to use.


T

-- 
Famous last words: I *think* this will work...


More information about the Digitalmars-d-learn mailing list