D-Programming-Language/phobos — pull request #2150 by joakim-noah (2014-05-08 15:25:39+00:00)
Title: First patch to compile for Android/x86

This is just the bare minimum I had to hack Phobos to get it to compile and run the unit tests, so that [37 out of 50 modules' unit tests passed on Android/x86](http://164.138.25.188/dmd/phobos_unit.txt). I'll update this pull with the real fixes over time, but I've put it up so that others can use this patch in the meantime. You'll need [the druntime and dmd patches](https://github.com/D-Programming-Language/druntime/pull/784), plus compile with the `-fPIC` flag.

The tests show that there are some issues with file- and string-handling (std.path fails because there's no /root directory in Android). Also, dmd creates 80-bit reals while [Android uses 64 bits for `long double` on ARM and x86](https://android.googlesource.com/toolchain/clang/+/df54cac9003235d020d2eb654456be2865376558%5E%21/), so that mismatch is probably causing the floating-point asserts. Consequently, I had to comment out or replace some stdc library functions that operate on `long double` input, since they don't exist in bionic. I'm not sure if dmd can be easily modified to produce 64-bit reals, but it can be done with ldc/gdc.