[Tutorial][Binaries] gdc for android

Johannes Pfau nospam at example.com
Sat Feb 4 11:31:09 PST 2012


Hi,
I tried to rebuild the android ndk with gdc and documented the build
process at https://bitbucket.org/goshawk/gdc/wiki/GDC%20on%20Android

The tutorial explains how to build a gdc cross compiler for android. It
uses GCC 4.6.2, a recent binutils snapshot and additionally provides a
recent gdb 7.4.

32bit linux binaries are also available here:
http://www.mediafire.com/?2cex2faqx327l
Download the android ndk r7 and extract the gdc 7z file in
android-ndk-r7/toolchains/

What's working:
I couldn't test the compiler yet and I hope someone else will provide
feedback, but the basic gdc compiler should work. druntime may or may
not work, but it's distributed so that can be tested.
Phobos is not being built yet.

Known bugs/TODO:

You need to build all D code with -fno-section-anchors, see
https://bitbucket.org/goshawk/gdc/issue/120/fsection-anchors-broken-on-arm

build-druntime.patch needs to be integrated with gdc. See
https://gist.github.com/1739039
There are basically 3 things this patch does:
* Currently gdc checks for __libc_stack_end as that's used by
  druntime. This function is only available in glibc, but bionic
  provides a similar function: __get_stack_base. The patch currently
  simply replaces __libc_stack_end. We need some way to detect if we
  build for bionic, so we can properly version this code. It should
  also be tested to verify it is working correctly
* Building gcc/config/unix.d fails, so the patch simply skips that
  file. This should be investigated further and fixed correctly.
* Disables phobos for now, although I think I just disabled building the
  final library and the object files are still being built.

gdbserver is not being built for some reason. Had no time to
investigate that yet.


More information about the D.gnu mailing list