Ask Your Question

Opencv (3.2.0) Compile Android with NEON provide a lot of errors (3.4.4 works only for compiling)

asked 2018-11-20 07:25:39 -0500

Simontraww gravatar image

updated 2018-11-27 04:31:11 -0500

System information (version)
  • OpenCV => 3.2.0
  • Operating System / Platform => Linux Ubuntu 16.04 / Android - 7 , ARM (armeabiv7-a)
  • Compiler => Clang 5.0
  • Opti => NEON (if possible)

  • Android STL => c++_static

  • NDK VERSION => NDK 15c
  • API LEVEL => 24


Hello, recently I have compiled Opencv 3.2.0 for Android, ARM with Android StandAlone Toolchain and not the toolchain provide with Opencv source.

It works perfectly, excepted one thing, the optimization is disable and when I want to use opencv it's too slower, then I have chosen the NEON optimization with the correct Toolchain (provide from Opencv 3.2.0 source /platform/android/)

To that, I have launched cmake-GUI, and create a build with Opencv Android Toolchain, but we encountered a lot of errors, only in "configure cmakelists" for beginning, like:


And I can say that, a lot of other error like this type, that I have solved by hand added in the cmakelists or with "entry" button in cmake-GUI.

After first "make" of generating project, I have met a lot of errors which said that a file was not found like:

[  0%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_aux.c.o
In file included from opencv-3.2.0/3rdparty/libtiff/tif_aux.c:32:
/3rdparty/libtiff/tiffiop.h:56:48: error: unknown type name 'size_t'
extern void *lfind(const void *, const void *, size_t *, size_t,
opencv-3.2.0/3rdparty/libtiff/tiffiop.h:56:58: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
extern void *lfind(const void *, const void *, size_t *, size_t,
In file included from opencv-3.2.0/3rdparty/libtiff/tif_aux.c:32:
In file included from opencv-3.2.0/3rdparty/libtiff/tiffiop.h:60:
opencv-3.2.0/3rdparty/libtiff/tiffio.h:67:9: error: unknown type name 'size_t'
typedef TIFF_SSIZE_T tmsize_t;
opencv-3.2.0/build_test_16_nov/3rdparty/libtiff/tif_config.h:121:22: note: expanded from macro 'TIFF_SSIZE_T'
#define TIFF_SSIZE_T size_t
Android/Sdk/ndk-bundle/platforms/android-24/arch-arm/usr/include/sys/types.h:31:10: fatal error: 'stddef.h' file not found
#include <stddef.h>
1 warning and 3 errors generated.

My question is, We can compile opencv 3.2.0 with NEON with Opencv Android Toolchain ?

I didn't know if the toolchain provide with this opencv works well or not ? I didn't know anything like how to solve it ?

If someone has an idea? or method plan to compile that, I will be very grateful. Thanks a lot guys advance. Have a good day !

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-11-27 03:55:44 -0500

Simontraww gravatar image

updated 2018-11-27 04:32:53 -0500

This answer talks about Opencv 3.4.4

With this line :

cmake -G "Unix Makefiles" -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DWITH_NEON=ON -DWITH_EIGEN=ON -DWITH_OPENCL=ON -DBUILD_opencv_gpu=OFF -DCMAKE_TOOLCHAIN_FILE=/home/Documents/opencv-3.4.4/platforms/android/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/home//Android/Sdk/ndk-bundle/prebuilt/linux-x86_64/bin/make -DANDROID_AdBI="armeabi-v7a with NEON" -DOPENCV_EXTRA_MODULES_PATH=/home/Documents/opencv_contrib-3.4.4/modules/ -DBUILD_opencv_features2d=ON -DBUILD_opencv_ximgproc=ON -DBUILD_opencv_java=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCXXFLAGS="-Wall -fpu=neon -O3" -DBUILD_JAVA=OFF -DBUILD_ANDROID_EXAMPLES=OFF -DEIGEN_INCLUDE_PATH=/home/Android/Dependencies/Android/Eigen_3.3.4/include/eigen3/ -DANDROID_NATIVE_API_LEVEL=24 -DCMAKE_ANDROID_API_MIN=24 ..

You'll build the library successfully, but when you'll link it you'll probably meet a few undefined symbols like me.. Thanks if someones have an idea.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-11-20 07:25:39 -0500

Seen: 48 times

Last updated: Nov 27