opam-cross-android icon indicating copy to clipboard operation
opam-cross-android copied to clipboard

No ocaml-android for 64 bit? (compiling to arm64 failing)

Open jaredly opened this issue 7 years ago • 10 comments

Following the readme, I did

opam switch 4.04.0
eval `opam config env`

and then did the configure line for aarch64, but at opam install ocaml-android, I get an error indicating that ocaml-android is only compatible with a 32 bit system. (and ocaml-android is just a symlink to ocaml-android32)

Is the readme wrong?

When I try to configure for aarch64 using 4.04.0+32bit, I get a segfault when trying to run the resulting binary.

jaredly avatar Dec 06 '17 01:12 jaredly

I get an error indicating that ocaml-android is only compatible with a 32 bit system. (and ocaml-android is just a symlink to ocaml-android32)

Correct. Back when I started this project there was no ARM64 Android. So there is still no support for it.

whitequark avatar Dec 06 '17 04:12 whitequark

Ok, good to know! I was confused because it looked like @yunxing had gotten in working over in #25, and I couldn't figure out what I was doing wrong.

jaredly avatar Dec 06 '17 04:12 jaredly

Try change symlink to ocaml-android64 if there is any? In theory this project should be able to work with 64 bit system and I'm pretty sure I got it working for aarch64 at some point, although we ended up shpping the 32 version.

If that doesn't work, consider building an Android app with 32 version if performance is not a bottleneck.

yunxing avatar Dec 06 '17 05:12 yunxing

Copy the ocaml-android32 package to ocaml-android64, fix up the contents, add a dependency from ocaml-android to ocaml-android64... and please send a PR :)

whitequark avatar Dec 06 '17 05:12 whitequark

Hey Guys, Sorry to bother you...

Do we now have support for ocaml-android64 ? I need this to cross-compile facebook/flow for aarch64 on x86_64 machine.

Regards,

skynet4ps avatar Jul 29 '19 08:07 skynet4ps

I don’t believe 64-bit builds in the opam-cross-android. I added 64-bit support in this fork:

https://github.com/markghayden/opam-cross-android

—Mark

On Jul 29, 2019, at 9:13 AM, skynet [email protected] wrote:

Hey Guys, Sorry to bother you...

Do we now have support for ocaml-android64 ? I need this to cross-compile facebook/flow for aarch64 on x86_64 machine.

Regards,

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ocaml-cross/opam-cross-android/issues/38?email_source=notifications&email_token=ABCEANSIXTLNGXJMXNEOK3DQB2RBVA5CNFSM4EG47KO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD276GCI#issuecomment-515891977, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCEANXDWL7TN57UXEHT7LTQB2RBVANCNFSM4EG47KOQ.

markghayden avatar Jul 29 '19 11:07 markghayden

@markghayden Hi Mark,

Thanks for quick support 😄 Can you please help me out regarding "how to use your toolchain" to compile facebook/flow package. I am sorry, I am naive to this Ocaml world...

Regards,

skynet4ps avatar Jul 29 '19 11:07 skynet4ps

Especially how to execute that configure line.

ARCH=arm64 SUBARCH=arm64 SYSTEM=linux_eabi \
  CCARCH=arm64 TOOLCHAIN=aarch64-linux-android-4.9 \
  TRIPLE=aarch64-linux-android LEVEL=24 \
  STLVER=4.9 STLARCH=arm64-v8a \
  opam install conf-android

How and where to execute the above commands as I am unable to locate configure script in my .opam directory?

skynet4ps avatar Jul 29 '19 11:07 skynet4ps

This is what I am getting when I executed opam install ocaml-android --debug

00:00.001  GSTATE                 LOAD-GLOBAL-STATE @ /home/akhil/.opam
00:00.002  RSTATE                 LOAD-REPOSITORY-STATE @ /home/akhil/.opam
00:00.079  RSTATE                 Loaded /home/akhil/.opam/repo/state.cache in 0.077s
00:00.155  RSTATE                 Cache found
00:00.155  STATE                  LOAD-SWITCH-STATE @ 4.04.0
00:00.237  STATE                  Detected changed packages (marked for reinstall): {}
00:00.238  STATE                  Switch state loaded in 0.083s
00:00.238  FILE(switch-state)     Wrote /home/akhil/.opam/4.04.0/.opam-switch/backup/state-20190730040808.export in 0.000s
00:00.462  CLIENT                 INSTALL ocaml-android
00:00.790  SYSTEM                 [log-12297-4bcc67] (in 0.010s) ocamlc -vnum
00:01.363  SOLVER                 Load cudf universe (depopts:true, build:true, post:false)
00:01.367  SOLVER                 filter_dependencies result={ ocaml-android.4.01.0, ocaml-android.4.0.0.1 }
00:01.416  CLIENT                 Orphans: (changes: { ocaml-android.4.0.0.1, ocaml-android.4.01.0 }, transitive: false) -> full {}, versions {}
00:01.908  SOLVER                 resolve request=install:(ocaml-android) remove:() upgrade:()
00:03.434  SOLVER                 Load cudf universe (depopts:false, build:true, post:true)
00:03.498  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.498  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.522  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.522  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.522  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.522  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.538  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.588  CUDF                   resolve request=install:(ocaml-android) remove:() upgrade:()
00:03.588  SOLVER                 Calling solver builtin-mccs+glpk with criteria -removed,-count[version-lag,request],-count[version-lag,changed],-changed
00:03.693  CUDF                   Solver call done in 0.105
00:03.735  SOLVER                 Load cudf universe (depopts:true, build:false, post:false)
00:03.814  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.814  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.838  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.838  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.838  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.838  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.851  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.912  SOLVER                 Load cudf universe (depopts:true, build:true, post:false)
00:03.994  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:03.994  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:04.020  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:04.020  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:04.020  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:04.020  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:04.032  FILTER                 ERR: value_bool: "/home/akhil/.opam/4.04.0/doc"
00:04.080  CUDF                   graph_of_actions root_actions={  - install ocaml-android (= 3) }
00:04.093  SOLUTION               apply
The following actions will be performed:
  - install ocaml-android 4.01.0
00:04.103  SOLUTION               parallel_apply

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
00:04.103  PARALLEL               Iterate over 1 task(s) with 3 process(es)
00:04.103  PARALLEL               Starting job 0 (worker 1/3): 0
00:04.103  ACTION                 download_package: ocaml-android.4.01.0
00:04.103  SYSTEM                 rmdir /home/akhil/.opam/4.04.0/.opam-switch/sources/ocaml-android.4.01.0
[ocaml-android.4.01.0] found in cache
00:04.112  FILENAME               cleandir /home/akhil/.opam/4.04.0/.opam-switch/sources/ocaml-android.4.01.0
00:04.112  SYSTEM                 mkdir /home/akhil/.opam/4.04.0/.opam-switch/sources/ocaml-android.4.01.0
00:04.112  SYSTEM                 mkdir /tmp/opam-12297-ccabea
00:04.123  PARALLEL               Next task in job 0: /bin/tar xfz /home/akhil/.opam/download-cache/md5/a1/a1d0d538732b850f57acf182ac09a2a3 -C /tmp/opam-12297-ccabea
Processing  1/1:
00:04.136  PARALLEL               Collected task for job 0 (ret:0)
00:04.160  SYSTEM                 [log-12297-7afd23] (in 0.024s) cp -PRp /tmp/opam-12297-ccabea/ocaml-android-1.1.0/.gitignore /tmp/opam-12297-ccabea/ocaml-android-1.1.0/Makefile /tmp/opam-12297-ccabea/ocaml-android-1.1.0/Makefile.config /tmp/opam-12297-ccabea/ocaml-android-1.1.0/README.md /tmp/opam-12297-ccabea/ocaml-android-1.1.0/config /tmp/opam-12297-ccabea/ocaml-android-1.1.0/opam /tmp/opam-12297-ccabea/ocaml-android-1.1.0/patches /home/akhil/.opam/4.04.0/.opam-switch/sources/ocaml-android.4.01.0
00:04.160  SYSTEM                 rmdir /tmp/opam-12297-ccabea
00:04.171  PARALLEL               Job 0 finished

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
00:04.171  PARALLEL               Iterate over 2 task(s) with 4 process(es)
00:04.171  PARALLEL               Starting job 824080442 (worker 1/4): build ocaml-android.4.01.0
00:04.171  SYSTEM                 rmdir /home/akhil/.opam/4.04.0/.opam-switch/build/ocaml-android.4.01.0
00:04.299  SYSTEM                 [log-12297-58c514] (in 0.025s) cp -PRp /home/akhil/.opam/4.04.0/.opam-switch/sources/ocaml-android.4.01.0 /home/akhil/.opam/4.04.0/.opam-switch/build/ocaml-android.4.01.0
00:04.299  ACTION                 prepare_package_source: ocaml-android.4.01.0 at /home/akhil/.opam/4.04.0/.opam-switch/build/ocaml-android.4.01.0
00:04.327  SYSTEM                 [log-12297-05296d] (in 0.027s) cp /home/akhil/.opam/repo/android/packages/ocaml-android.4.01.0/files/remove.sh /home/akhil/.opam/4.04.0/.opam-switch/build/ocaml-android.4.01.0/remove.sh
00:04.338  PARALLEL               Next task in job 824080442: /usr/bin/make ANDROID_NDK=/home/akhil/.opam/4.04.0/lib/android-ndk OCAML_SRC=/home/akhil/.opam/4.04.0/lib/ocaml-src ANDROID_PREFIX=/home/akhil/.opam/4.04.0/arm-linux-androideabi ANDROID_BINDIR=/home/akhil/.opam/4.04.0/bin

Processing  1/2: [ocaml-android: make]
02:54.766  PARALLEL               Collected task for job 824080442 (ret:2)
[ERROR] The compilation of ocaml-android failed at "/usr/bin/make ANDROID_NDK=/home/akhil/.opam/4.04.0/lib/android-ndk
        OCAML_SRC=/home/akhil/.opam/4.04.0/lib/ocaml-src ANDROID_PREFIX=/home/akhil/.opam/4.04.0/arm-linux-androideabi
        ANDROID_BINDIR=/home/akhil/.opam/4.04.0/bin".
02:54.766  PARALLEL               Job 824080442 finished
02:54.766  PARALLEL               Starting job 748872459 (worker 1/4): install ocaml-android.4.01.0
02:54.766  PARALLEL               Job 748872459 finished

#=== ERROR while compiling ocaml-android.4.01.0 ===============================#
# context     2.0.4 | linux/x86_64 | base-bigarray.base base-threads.base base-unix.base ocaml-base-compiler.4.04.0 | git+https://github.com/vouillon/opam-android-repository.git
# path        ~/.opam/4.04.0/.opam-switch/build/ocaml-android.4.01.0
# command     /usr/bin/make ANDROID_NDK=/home/akhil/.opam/4.04.0/lib/android-ndk OCAML_SRC=/home/akhil/.opam/4.04.0/lib/ocaml-src ANDROID_PREFIX=/home/akhil/.opam/4.04.0/arm-linux-androideabi ANDROID_BINDIR=/home/akhil/.opam/4.04.0/bin
# exit-code   2
# env-file    ~/.opam/log/ocaml-android-12297-d2c37b.env
# output-file ~/.opam/log/ocaml-android-12297-d2c37b.out
### output ###
# [...]
# Perhaps you used the wrong -p or --strip option?
# The text leading up to this was:
# --------------------------
# |--- byterun/misc.h~
# |+++ byterun/misc.h
# --------------------------
# File to patch:
# Skip this patch? [y]
# Skipping patch.
# 1 out of 1 hunk ignored
# Makefile:50: recipe for target 'stamp-prepare' failed
# make: *** [stamp-prepare] Error 1



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build ocaml-android 4.01.0
+-
- No changes have been performed

My current opam configuration is:

# opam config report
# opam-version      2.0.4
# self-upgrade      no
# system            arch=x86_64 os=linux os-distribution=ubuntu os-version=18.04
# solver            builtin-mccs+glpk
# install-criteria  -removed,-count[version-lag,request],-count[version-lag,changed],-changed
# upgrade-criteria  -removed,-count[version-lag,solution],-new
# jobs              4
# repositories      1 (http), 2 (version-controlled) (default repo at 3389beb3)
# pinned            0
# current-switch    4.04.0

Can you please have a look and let me know what I am missing.

Regards,

skynet4ps avatar Jul 30 '19 04:07 skynet4ps

@akhilgupta74 did you execute the ARCH=amd64 .... command? That needs to be done first

jaredly avatar Aug 03 '19 06:08 jaredly