I encountered an error using the NDK way to compile the source code, I will opencv source code copied to the jni directory, prepared Android.mk and Application.mk as well as the source file. Mk file, compiled the following error, please also Give some advice, thanks! ! !
Operating System: Ubuntu 17210 64bit
opencv version: 3.3
android-ndk version: 14b
log:
[armeabi-v7a] Gdbserver : [arm-linux-androideabi] libs/armeabi-v7a/gdbserver
[armeabi-v7a] Gdbsetup : libs/armeabi-v7a/gdb.setup
[armeabi-v7a] Compile++ thumb: opencv <= perf_io_base64.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_addWeighted.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_convertTo.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_math.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_split.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_inRange.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_umat.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_stat.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_dft.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_abs.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_bitwise.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_cvround.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_compare.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_merge.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_mat.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_sort.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_main.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_norm.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_lut.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_reduce.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_dot.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_gpumat.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_arithm.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_minmaxloc.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_usage_flags.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_bufferpool.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_matop.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_gemm.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_arithm.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_dxt.cpp
[armeabi-v7a] Compile++ thumb: opencv <= perf_channels.cpp
[armeabi-v7a] Compile++ thumb: opencv <= cuda_host_mem.cpp
In file included from /home/jiangc/opencv3.3Ndk库/hello-jni/jni/core/src/cuda_host_mem.cpp:44:
In file included from /home/jiangc/opencv3.3Ndk库/hello-jni/jni/core/src/precomp.hpp:49:
In file included from /home/jiangc/opencv3.3Ndk库/hello-jni/jni/include/opencv2/core/utility.hpp:56:
In file included from /home/jiangc/opencv3.3Ndk库/hello-jni/jni/include/opencv2/core.hpp:52:
In file included from /home/jiangc/opencv3.3Ndk库/hello-jni/jni/include/opencv2/core/cvdef.h:189:
In file included from /home/jiangc/opencv3.3Ndk库/hello-jni/jni/include/opencv2/core/cv_cpu_dispatch.h:32:
In file included from /home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/emmintrin.h:27:
In file included from /home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/xmmintrin.h:27:
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:47:5: error:
use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:47:5: note:
'__builtin_isless' declared here
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:47:25: error:
too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:64:19: error:
use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:81:12: error:
use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:143:19: error:
use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:173:19: error:
use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:203:19: error:
use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:230:19: error:
use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:253:19: error:
use of undeclared identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:274:19: error:
use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:301:19: error:
use of undeclared identifier '__builtin_ia32_punpcklbw'
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:324:19: error:
use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:345:19: error:
use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:366:19: error:
use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_qadd'?
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:366:19: note:
'__builtin_arm_qadd' declared here
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:366:40: error:
cannot initialize a parameter of type 'int' with an rvalue of type '__v8qi'
(vector of 8 'char' values)
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:387:19: error:
use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_qadd'?
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:366:19: note:
'__builtin_arm_qadd' declared here
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:387:40: error:
cannot initialize a parameter of type 'int' with an rvalue of type '__v4hi'
(vector of 4 'short' values)
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:408:19: error:
use of undeclared identifier '__builtin_ia32_paddd'; did you mean '__builtin_arm_qadd'?
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:366:19: note:
'__builtin_arm_qadd' declared here
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/home/jiangc/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib64/clang/3.8.275480/include/mmintrin.h:408:40: error:
cannot initialize a parameter of type 'int' with an rvalue of type '__v2si'
(vector of 2 'int' values)
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [/home/jiangc/opencv3.3Ndk库/hello-jni/obj/local/armeabi-v7a/objs/opencv/core/src/cuda_host_mem.o] Error 1
Android.mk file
--------------------------------------------------------------------------------
LOCAL_PATH :=$(call my-dir)
ZLIB_PATH:=/home/jiangc/android-ndk-r14b/platforms/android-19/arch-arm/usr
include $(CLEAR_VARS)
LOCAL_MODULE := opencv
#源文件 mk 文件
include $(LOCAL_PATH)/core_source.mk
include $(LOCAL_PATH)/dnn_source.mk
include $(LOCAL_PATH)/features2d_source.mk
include $(LOCAL_PATH)/highgui_source.mk
include $(LOCAL_PATH)/imgcodecs_source.mk
include $(LOCAL_PATH)/imgproc_source.mk
include $(LOCAL_PATH)/ml_source.mk
include $(LOCAL_PATH)/objdetect_source.mk
include $(LOCAL_PATH)/photo_source.mk
include $(LOCAL_PATH)/stitching_source.mk
include $(LOCAL_PATH)/videoio_source.mk
include $(LOCAL_PATH)/video_source.mk
include $(LOCAL_PATH)/viz_source.mk
include $(LOCAL_PATH)/calib3d_source.mk
include $(LOCAL_PATH)/ts_source.mk
#include $(LOCAL_PATH)/cuda_source.mk
#包含源文件变量
LOCAL_SRC_FILES := $(CORE_SOURCE)
$(DNN_SOURCE)
$(FEATURES2D_SOURCE)
$(HIGHGUI_SOURCE)
$(IMGCODECS_SOURCE)
$(IMAGEPROC_SOURCE)
$(ML_SOURCE)
$(OBJDETECT_SOURCE)
$(PHOTO_SOURCE)
$(STITCHING_SOURCE)
$(VIDEOIO_SOURCE)
$(VIDEO_SOURCE)
$(VIZ_SOURCE)
$(TS_SOURCE)
$(CALIB3D_SOURCE)
#$(CUDAWARPING_SOURCE)
#$(CUDASTEREO_SOURCE)
#$(CUDAIMGPROC_SOURCE)
#$(CUDAOBJDETECT_SOURCE)
#$(CUDAFEATURES2D_SOURCE)
#$(C
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…