Crosscompiling LDC's druntime for Android on Windows

Fry fry131313 at gmail.com
Mon Feb 21 00:24:54 UTC 2022


I'm trying to cross compile LDC's druntime to enable more debug 
print statements but I'm having trouble getting it built 
correctly for aarch64.

I'm following the azure pipeline's commands for how it's being 
built here:
https://github.com/ldc-developers/ldc/blob/master/.azure-pipelines/2-posix-build_cross_android.yml#L64

It includes threadasm.S that does have an aarch64 version, it 
just isn't being selected for some reason.

I get the following errors when trying to link:

```
ld: error: C:/Program Files/LDC 
1.28/bin/../lib-android_aarch64\libdruntime-ldc-debug.a(threadasm.S.o) is incompatible with aarch64linux
ld: error: C:/Program Files/LDC 
1.28/bin/../lib-android_aarch64\libphobos2-ldc-debug.a(adler32.c.o) is incompatible with aarch64linux
ld: error: C:/Program Files/LDC 
1.28/bin/../lib-android_aarch64\libphobos2-ldc-debug.a(compress.c.o) is incompatible with aarch64linux
ld: error: C:/Program Files/LDC 
1.28/bin/../lib-android_aarch64\libphobos2-ldc-debug.a(crc32.c.o) 
is incompatible with aarch64linux
ld: error: C:/Program Files/LDC 
1.28/bin/../lib-android_aarch64\libphobos2-ldc-debug.a(deflate.c.o) is incompatible with aarch64linux
ld: error: C:/Program Files/LDC 
1.28/bin/../lib-android_aarch64\libphobos2-ldc-debug.a(infback.c.o) is incompatible with aarch64linux
ld: error: C:/Program Files/LDC 
1.28/bin/../lib-android_aarch64\libphobos2-ldc-debug.a(inflate.c.o) is incompatible with aarch64linux
```

I manually set the cflags to include -march=armv8-a instead of v7 
which it was by default I guess from the android cmake toolchain 
file. I don't see what else needs to be set in order to change 
what binary is being built. For d code, I just set the mtriple 
but it is using the ndk's clang for the c files.


More information about the Digitalmars-d-learn mailing list