0

I am trying to build libzmq for Android using CMake and the toolchain embedded in the NDK.

My system is MacOS 10.14.3

I freshly downloaded the latest NDK [r20] but the problem was here already with r19c.

The CMake process fails when it tries to compile a "simple test program" and says:

ld: unknown option: --sysroot=/Users/me/android-ndk-r20/platforms/android-28/arch-arm

I tried to compile another library (custom) to confirm that its a toolchain issue and got the same error.

In the --helpoutput of the compiler (from the embedded toolchain), I found this:

-isysroot <dir>         Set the system root directory (usually /)

Could there be an issue with the NDK toolchain for MacOS that passes the --sysroot parameter instead of the -isysroot one?
Is there a workaround? (Like something to add in the CMake toolchain file maybe?)

Here is my CMake toolchain file :

set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_SYSTEM_VERSION 28) # API level
set(CMAKE_ANDROID_ARCH_ABI armeabi-v7a)
set(CMAKE_ANDROID_ARM_MODE ON)
set(CMAKE_ANDROID_NDK /Users/me/android-ndk-r20)
set(CMAKE_ANDROID_STL_TYPE c++_static)

In the meantime, I will run this through a Ubuntu docker image and see how it goes.

0

I ran into this same exact issue on OSX and ended up reverting to the NDK 18b revision and it worked for my needs.

Same problem on the NDK Rev 19c. I think there's an issue with the NDK on r19c and r20

| improve this answer | |
  • Thanks for the input. I ended up using a docker Ubuntu and cross-compiling using the CMake toolchain file from the Android NDK. This way, I still use the latest NDK. I didn't post an answer because it does not really answer the question :S – PlikPlok Jun 19 '19 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.