NDK – problems after GNUSTL has been removed from the NDK (revision r18)

As @Michael already suggested you can rebuild the OpenCV with libc++.

To do it:

cd $OPENCV_SRC
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_DIR/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_STL=c++_static  -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=android-24 ..
make install
cd install #the sdk will be here...

NOTE:
tested with “opencv-3.4.1” + ndk18


Edited by @shizhen

Verified on macOS, should add .. after cmake command to make below error disappear.

CMake Error: The source directory “/opencv-3.4.1/build”does not appear to contain CMakeLists.txt.

Updated as below:

cd $OPENCV_SRC
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$ANDROID_DIR/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_STL=c++_static  -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=android-24 
make install
cd install #the sdk will be here...

Leave a Comment