All, I failed to build OpenCV 2.4.5 for android-x86 version on Ubuntu. The error is:
[ 10%] Building C object 3rdparty/libwebp/CMakeFiles/libwebp.dir/cpu-features/cpu-features.c.o [ 10%] [ 10%] Built target opencv_highgui_pch_dephelp Built target opencv_test_core_pch_dephelp [ 10%] Built target opencv_imgproc_pch_dephelp /home/b679/codes/opencv/3rdparty/libwebp/cpu-features/cpu-features.c:61:34: fatal error: machine/cpu-features.h: No such file or directory compilation terminated. make[2]: * [3rdparty/libwebp/CMakeFiles/libwebp.dir/cpu-features/cpu-features.c.o] Error 1 make[1]: [3rdparty/libwebp/CMakeFiles/libwebp.dir/all] Error 2 make[1]: ** Waiting for unfinished jobs....
But, I could passed the build with 2.4.5 for arm version. My android NDK version is r8d. From NDK's include, there is cpu-features.c for arm, but not for x86.
Also, I checked file "3rdparty/libwebp/cpu-features/cpu-features.c" I found:
60 #ifdef __arm__ 61 #include <machine cpu-features.h=""> 62 #endif
I don't know why the macro __arm__ take effect. Anyone who know the reason? Thanks.