Difference between revisions of "GDC/Installation/Android"
(Created page with "= GDC on Android = Note: This tutorial should give you a usable GDC for Android. GDC on Android is not supported in any way, and especially druntime and phobos may need some u...") |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{ParentArticle|[[GDC]] > [[GDC/Installation|Installation]]}} | ||
+ | |||
= GDC on Android = | = GDC on Android = | ||
− | Note: This tutorial should give you a usable GDC for Android. GDC on Android is not supported | + | Note: This tutorial should give you a usable GDC for Android. GDC on Android is not supported and especially phobos may need some updates to be usable. |
= Binaries = | = Binaries = | ||
− | + | Not yet available | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | = Building a toolchain with | + | = Building a toolchain with GDC for the Android NDK = |
== Linux host == | == Linux host == | ||
− | + | Install all packages required for building the NDK. Then: | |
− | |||
− | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | build- | + | mkdir workdir |
− | + | cd workdir | |
+ | git clone https://android.googlesource.com/platform/ndk | ||
+ | git clone https://android.googlesource.com/platform/development | ||
+ | mkdir src | ||
+ | mkdir dest | ||
+ | ./ndk/build/tools/download-toolchain-sources.sh /home/build/workdir/src | ||
+ | ./ndk/build/tools/gen-platforms.sh --minimal | ||
− | + | git clone git@github.com:D-Programming-GDC/GDC.git | |
− | + | cd GDC | |
− | + | git checkout gdc-4.9 | |
− | + | ./setup-gcc.sh /home/build/workdir/src/gcc/gcc-4.9 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
cd ../ | cd ../ | ||
− | + | ./ndk/build/tools/build-gcc.sh /home/build/workdir/src /home/build/workdir/dest arm-linux-androideabi-4.9 --verbose --try-64 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | === Building unittests === | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | cd /tmp/ndk-/build/toolchain/gcc-4.9/arm-linux-androideabi/libphobos/libdruntime | |
− | + | make unittest | |
− | + | cd /tmp/ndk-/build/toolchain/gcc-4.9/arm-linux-androideabi/libphobos/src | |
− | + | make unittest | |
− | |||
− | |||
− | |||
− | |||
− | cd | ||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | === | + | === Debugging help === |
− | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | adb push unittest /data/local/tmp | |
− | + | # gdbserver is in standard NDK builds | |
− | + | adb push prebuilt/android-arm/gdbserver/gdbserver /data/local/tmp | |
− | + | adb forward tcp:5039 tcp:5039 | |
− | + | adb shell | |
− | + | su | |
− | + | cd /data/local/tmp | |
− | + | ./unittest | |
− | + | ./gdbserver :5039 unittest | |
− | |||
− | |||
− | + | ./toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gdb unittest | |
+ | <gdb> target extended-remote :5039 | ||
+ | <gdb> continue | ||
− | + | # Usually android devices dont have hardware watchpoints, to disable: | |
− | + | <gdb> set can-use-hw-watchpoints 0 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | < | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
= TODO = | = TODO = | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
* phobos | * phobos | ||
− | ** | + | * shared libraries |
+ | * GC: We currently scan the data segment using etext and _end symbols. This doesn't work for dynamic libraries and it sometimes doesn't work for static libraries: In some cases there's a gap between etext and the start of the data section. Accessing this gap results in a segfault on some systems. Solution is to implement sections_elf for Android. | ||
+ | |||
+ | [[Category:GDC Compiler]] | ||
+ | [[Category:Android]] |
Latest revision as of 03:14, 19 March 2018
Contents
GDC on Android
Note: This tutorial should give you a usable GDC for Android. GDC on Android is not supported and especially phobos may need some updates to be usable.
Binaries
Not yet available
Building a toolchain with GDC for the Android NDK
Linux host
Install all packages required for building the NDK. Then:
mkdir workdir
cd workdir
git clone https://android.googlesource.com/platform/ndk
git clone https://android.googlesource.com/platform/development
mkdir src
mkdir dest
./ndk/build/tools/download-toolchain-sources.sh /home/build/workdir/src
./ndk/build/tools/gen-platforms.sh --minimal
git clone git@github.com:D-Programming-GDC/GDC.git
cd GDC
git checkout gdc-4.9
./setup-gcc.sh /home/build/workdir/src/gcc/gcc-4.9
cd ../
./ndk/build/tools/build-gcc.sh /home/build/workdir/src /home/build/workdir/dest arm-linux-androideabi-4.9 --verbose --try-64
Building unittests
cd /tmp/ndk-/build/toolchain/gcc-4.9/arm-linux-androideabi/libphobos/libdruntime
make unittest
cd /tmp/ndk-/build/toolchain/gcc-4.9/arm-linux-androideabi/libphobos/src
make unittest
Debugging help
adb push unittest /data/local/tmp
# gdbserver is in standard NDK builds
adb push prebuilt/android-arm/gdbserver/gdbserver /data/local/tmp
adb forward tcp:5039 tcp:5039
adb shell
su
cd /data/local/tmp
./unittest
./gdbserver :5039 unittest
./toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gdb unittest
<gdb> target extended-remote :5039
<gdb> continue
# Usually android devices dont have hardware watchpoints, to disable:
<gdb> set can-use-hw-watchpoints 0
TODO
- phobos
- shared libraries
- GC: We currently scan the data segment using etext and _end symbols. This doesn't work for dynamic libraries and it sometimes doesn't work for static libraries: In some cases there's a gap between etext and the start of the data section. Accessing this gap results in a segfault on some systems. Solution is to implement sections_elf for Android.