You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+74-5Lines changed: 74 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -16,12 +16,81 @@ version of the OCaml 4.x compiler on a non-Windows machine. The central Opam
16
16
repository only introduced the DkML distribution in OCaml 5.x generally and
17
17
OCaml 4.14 for Windows specifically.
18
18
19
-
## Packages that rely on dkml-compiler
19
+
## Quick Start
20
20
21
-
* dkml-component-ocamlcompiler
22
-
* dkml-component-ocamlrun
23
-
* dkml-component-opam
24
-
* dkml-runtime-apps
21
+
### Android Cross-Compiler
22
+
23
+
NOTE 1: There are a couple major patches done by DkML to the OCaml compiler to support Android 32-bit. And the cross-compiler support is not standard (or supported) in the official OCaml compiler. Do not expect to replicate these instructions using the generic OCaml compiler.
24
+
25
+
NOTE 2: We'll use a Docker container for convenience with Windows and macOS users, and also because it is easy to get the Android NDK from CircleCI, but you can do this directly on a Linux machine.
26
+
27
+
NOTE 3: Since Apple Silicon does not support 32-bit, and since cross-compiling OCaml requires the same bitness
28
+
for the build machine and the target machine, Apple Silicon users cannot compile [Android `armeabi-v7a`](https://developer.android.com/ndk/guides/abis)
_build/default.android_arm64v8a/world.exe: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, with debug_info, not stripped
68
+
_build/default/world.exe: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=1731ad9ce0fdeff69df28af0b1217e843eabe26e, for GNU/Linux 3.2.0, with debug_info, not stripped
69
+
70
+
# You can also directly use the ocamlfind -toolchain
DkML supports three out of the four supported Android ABIs.
78
+
The three ABIs (all but `x86`) were chosen based on [statistics for a large game on Aug 29, 2023](https://github.com/android/ndk/issues/1772#issuecomment-1697831518):
79
+
80
+
| Arch | Percent |
81
+
| ----------- | ------- |
82
+
| arm64-v8a | 68.66 |
83
+
| armeabi-v7a | 30.38 |
84
+
| x86_64 | 0.71 |
85
+
| x86 | 0.26 |
86
+
87
+
and also [Google's recommendation](https://android-developers.googleblog.com/2022/10/64-bit-only-devices.html):
88
+
89
+
> **Note**: While 64-bit-only devices will grow in popularity with phones joining Android Auto in this group, 32-bit-only devices will continue to be important for Android Go, Android TV, and Android Wear. Please continue supporting 32-bit ABIs; Google Play will continue serving 32-bit apps to 32-bit-only devices.
90
+
91
+
---
92
+
93
+
Finally, a word of **CAUTION**. The Android cross-compiler **can never** use OCaml 5+ because [OCaml 5 will never bring back the 32-bit instruction set](https://discuss.ocaml.org/t/32-bit-native-code-support-for-ocaml-5/12583/13?u=jbeckford). That means if you don't want to drop a large percent of your users or drop new Android categories over the next five (?) years, you will have a critical dependency on DkML.
0 commit comments