zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1
https://www.zeromq.org
Mozilla Public License 2.0
9.71k stars 2.35k forks source link

Problem: Android APP fails to load ZMQ since NDK r25.x #4437

Closed stephan57160 closed 2 years ago

stephan57160 commented 2 years ago

With the help of the dump of ./configure options (former PR):

LIBZMQ (arm) - ./configure options to build 'LIBZMQ':
  > --quiet
  > TOOLCHAIN=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64
  > CC=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang
  > CXX=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++
  > LD=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/ld
  > AS=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-as
  > AR=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
  > RANLIB=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib
  > STRIP=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
  > CFLAGS= -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE
  > CPPFLAGS= -I/home/stephan/git/zproject-android-testing/libzmq/builds/android/prefix/arm/include
  > CXXFLAGS=
  > LDFLAGS=-L/home/stephan/git/zproject-android-testing/libzmq/builds/android/prefix/arm/lib -L/tmp/android-ndk-r25/sour\
ces/cxx-stl/llvm-libc++/libs/armeabi-v7a
  > LIBS=-lc -ldl -lm -llog -lc++_shared
  > PKG_CONFIG_LIBDIR=/tmp/android-ndk-r25/prebuilt/linux-x86_64/lib/pkgconfig
  > PKG_CONFIG_PATH=/home/stephan/git/zproject-android-testing/libzmq/builds/android/prefix/arm/lib/pkgconfig
  > PKG_CONFIG_SYSROOT_DIR=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot
  > PKG_CONFIG_DIR=
  > --with-sysroot=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot
  > --host=arm-linux-androideabi
  > --prefix=/home/stephan/git/zproject-android-testing/libzmq/builds/android/prefix/arm
  > --disable-curve
  > --without-docs

We can observe that LDFLAGS has invalid -L<path_to_libc++_shared.so>:

-L/tmp/android-ndk-r25/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a

This path is no more valid, since NDK r25, where one should use LLVM path.

Ok, once this is fixed, ./configure requires also the path to libc.so. I don't understand why libc.so is now required, actually, but without this, ./configure fails to build its conftest.

Solution: Fix invalid LDFLAGS.

Notes: