On Thursday, 24 July 2014 at 01:17:44 UTC, Joakim wrote:
On Thursday, 8 May 2014 at 16:16:22 UTC, Joakim wrote:
Well, Android/x86 for now. I've been plugging away at getting
D running on Android/x86 and got all of the druntime modules'
unit tests and 37 of 50 phobos modules' unit tests to pass. I
had to hack dmd into producing something like packed TLS for
ELF, my patch is online here:
http://164.138.25.188/dmd/packed_tls_for_elf.patch
I simply turned off all TLS flags for ELF and spliced in the
el_picvar patch from OS X to call ___tls_get_addr. Somebody
who knows dmd better than me should verify to make sure this
is right.
I've also put online preliminary pulls for druntime and phobos:
https://github.com/D-Programming-Language/druntime/pull/784
https://github.com/D-Programming-Language/phobos/pull/2150
Now that a significant chunk of D is working on Android/x86,
I'm looking for others to pitch in. We really need to get D
on mobile, and Android/x86 is an ideal place to start. Dan
Olson has done some nice work getting D on iOS using ldc, I'm
sure he could use help too:
http://forum.dlang.org/thread/m2txc2kqxv....@comcast.net
http://forum.dlang.org/thread/m2d2h15ao3....@comcast.net
Stuff remaining to be done:
1. Fix all phobos unit tests. Those who know the failing
modules better would be best equipped to get them to work.
2. I tried creating an Android app, ie an apk, which is really
just a shared library called from the Dalvik JVM, as opposed
to the standalone executables I've been running from the
Android command line so far. The apk enters the D code and
then segfaults in the new TLS support, I'll debug that next.
3. Use ldc/gdc to build for Android/ARM.
4. Start translating various headers on Android so they can be
called from D, ie EGL, OpenGL ES, sensors, etc.
5. Integrate the D compilers into the existing Makefile-based
build system of the Android NDK. Right now, I extract the
necessary compiler and linker commands and run them by hand
when necessary.
All you need to get going is to download the latest Android
NDK (http://developer.android.com/tools/sdk/ndk/index.html)
and run Android/x86 (http://www.android-x86.org/, I recommend
the 4.3 build) in a VM. I'll put up some basic setup and
build instructions if someone is interested.
An update on the porting effort: I just got most modules' unit
tests to pass as part of an Android/x86 app, a native "apk," ie
a D shared library called from a small C wrapper, no Java
required. :)
All druntime/phobos modules but one, std.datetime, passed their
tests on the Android/x86 command-line a couple months ago.
Three of those modules segfault when run as part of the tests
in an apk- core.thread, std.parallelism, and std.socket- going
to look at those next. I'm guessing the first two might be
related to the C wrapper also calling pthreads, as they passed
on the command-line.
This means most of 1. and 2. above can be crossed off the list.
I'll start cleaning up my fairly simple build process and
document it on the wiki, so that others can easily play with D
on Android/x86. Most of the patches so far have been merged
into git master, with the dmd patch above now a PR:
https://github.com/D-Programming-Language/dmd/pull/3643
Only small tweaks were needed beyond that, which I'll submit as
PRs in the coming days. Looking forward to help on 3., 4., and
5. above, and to seeing what others do with this new platform.
Congratulations! I'll definitely give it a try when Android/Arm
get ready and I think your great efforts will give D a new life
as the best programming language for mobile platform.D may be
another ObjC once it runs on Android/iOS stably.