Linker error on launch (c++_shared.so not found)

Hi all,

I am using the master branch (fresh checkout) to get a new Android app going, and have run into the following issue on App launch:

01-23 19:11:32.756: I/OF(5736): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
01-23 19:11:32.756: E/art(5736): dlopen("/data/app/cc.openframeworks.androidEmptyExample-1/lib/arm/libOFAndroidApp.so", RTLD_LAZY) failed: dlopen failed: could not load library “libc++_shared.so” needed by “libOFAndroidApp.so”; caused by library “libc++_shared.so” not found

Exact steps have been:

  • git clone openframework
  • run scripts/android/download_libs.sh
  • update paths.make with NDK location
  • Import openframeworks, ofxAndroid & androidEmptyProject
  • Build / run on device
  • Project compiles, links and installs without error.

Note: I checked config.android.default.mk, and the folder holding libc++_shared.so is included in LDFLAGS, i.e:

PLATFORM_LDFLAGS += --sysroot=$(SYSROOT) -L"$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(ABI_PATH)"

Additional notes:

  • running on os-x (10.12)

Any hints would be much appreciated.

Manually copying libc++_shared.so to libs/armeabi-v7a (and running the app from the IDE) seems to get around the issue.

I’ll add this copy step to config.android.default.mk for now, though I don’t see this happening in other OF Android apps from earlier releases (this is when we were using gnustl_static as opposed to c++_shared as the STL).

Edit: the exact line added in config.android.default.mk (which seems to solve my issue):

cp $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(ABI_PATH)/libc++_shared.so libs/$(ABI_PATH)/libc++_shared.so \

This line is added immediately after:

echo "LOCAL_MODULE := OFAndroidApp" >> jni/Android.mk \

Again, not sure why this is required on my end, but I am happy to blame Eclipse for continuing to hate every project I initially create :slight_smile: