ocaml-android icon indicating copy to clipboard operation
ocaml-android copied to clipboard

Build fails on Fedora 21 x64 with NDK r10d

Open psteckler opened this issue 10 years ago • 3 comments

I cloned this repo, downloaded OCaml 4.01 sources. I edited Makefile.config so that ANDROID_NDK points to the r10d NDK, OCAML_SRC points to the 4.01 source directory, and ANDROID_PLATFORM set to android-21.

Running "make", everything chugs along nicely for awhile, then I get:

signals_osdep.h:71:20: error: redefinition of 'struct ucontext' typedef struct ucontext { ^ In file included from /home/steck/android-ndk-r10d/platforms/android-21/arch-arm/usr/include /signal.h:51:0, from signals_asm.c:19: /home/steck/android-ndk-r10d/platforms/android-21/arch-arm/usr/include/sys/ucontext.h:66:16: note: originally defined here typedef struct ucontext { ^ In file included from signals_asm.c:27:0: signals_osdep.h:77:7: error: conflicting types for 'ucontext_t' } ucontext_t; ^ In file included from /home/steck/android-ndk-r10d/platforms/android-21/arch-arm/usr/include /signal.h:51:0, from signals_asm.c:19: /home/steck/android-ndk-r10d/platforms/android-21/arch-arm/usr/include/sys/ucontext.h:77:3: note: previous declaration of 'ucontext_t' was here } ucontext_t;

I also tried the 4.02.1 sources, same result. Also tried setting ANDROID_PLATFORM to android-14.

psteckler avatar Apr 03 '15 21:04 psteckler

In asmrun/signals_osdep.h, there's a line:

// The Android NDK does not have sys/ucontext.h yet

Apparently, the NDK does have that file now. Removing that conditional block for Android allows the compilation to succeed (for 4.02.1, presumably it's OK for 4.01, too).

I will file a change request with OCaml.

psteckler avatar Apr 03 '15 21:04 psteckler

One other small change I made to get things to compile. In the Makefile in the repo, there a line:

ANDROID_PATH = $(ANDROID_NDK)/toolchains/$(TOOLCHAIN)/prebuilt/$(ARCH)-x86/bin

Because I'm compiling on x64 hardware, I changed this to:

ANDROID_PATH = $(ANDROID_NDK)/toolchains/$(TOOLCHAIN)/prebuilt/$(ARCH)-x86_64/bin

That's not mentioned in the README.md file.

psteckler avatar Apr 03 '15 22:04 psteckler

Apparently, the issue with ucontext has been fixed in the current OCaml sources, which I learned after filing a bug report.

psteckler avatar Apr 04 '15 19:04 psteckler