完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
PC系统:ubuntu14.04 LTS
交叉编译工具链:gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu step1: 在opencv源代码目录创建文件夹:build,用于存放编译中间文件。 step2: 打开命令控制台,输入cmake-gui运行 step3: 配置源文件路径和编译中间文件路径: step4: step5: C编译器:/usr/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc C++编译器:/usr/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ 头文件:/usr/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/include step6: step7: 取消选项:with-cuda,with-opencl step8 更改安装目录: step9 generate: step10 打开命令控制台进入build目录,执行make -j4进行编译,当然会产生错误,后面根据错误具体再修改。 打开命令控制台进入build目录,执行make -j4进行编译,当然会产生错误,后面根据错误具体再修改。 Linking CXX shared library ../../lib/libopencv_highgui.so /usr/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: ../../3rdparty/lib/libIlmImf.a(ImfHeader.cpp.obj): relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `_ZTVNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEE@@GLIBCXX_3.4.21' can not be used when making a shared object; recompile with -fPIC /usr/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: ../../3rdparty/lib/libIlmImf.a(ImfHeader.cpp.obj)(.text._ZNK3Imf6Header7writeToERNS_7OStreamEb+0x368): 无法解决 R_AARCH64_ADR_PREL_PG_HI21 重定向于符号 “_ZTVNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEE@@GLIBCXX_3.4.21” 有冲突 /usr/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: 最终连接失败: 错误的值 collect2: error: ld returned 1 exit status make[2]: *** [lib/libopencv_highgui.so] 错误 1 make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] 错误 2 make: *** [all] 错误 2 解决办法: 修改编译目录build下面的CMakeCache.txt文件,如下所示两个地方添加 -fPIC 选项。 CMAKE_CXX_FLAGS:STRING=-fPIC CMAKE_C_FLAGS:STRING=-fPIC step10 再次编译,继续出错。 Linking CXX executable ../../bin/opencv_test_core ../../lib/libopencv_ts.a(ts_gtest.cpp.obj):在函数‘testing::internal::UnitTestImpl::SetTestPartResultReporterForCurrentThread(testing::TestPartResultReporterInterface*)’中: ts_gtest.cpp:(.text._ZN7testing8internal12UnitTestImpl41SetTestPartResultReporterForCurrentThreadEPNS_31TestPartResultReporterInterfaceE+0x18):对‘pthread_getspecific’未定义的引用 ts_gtest.cpp:(.text._ZN7testing8internal12UnitTestImpl41SetTestPartResultReporterForCurrentThreadEPNS_31TestPartResultReporterInterfaceE+0x108):对‘pthread_setspecific’未定义的引用 ../../lib/libopencv_ts.a(ts_gtest.cpp.obj):在函数‘testing::internal::UnitTestImpl::GetTestPartResultReporterForCurrentThread()’中: ts_gtest.cpp:(.text._ZN7testing8internal12UnitTestImpl41GetTestPartResultReporterForCurrentThreadEv+0x14):对‘pthread_getspecific’未定义的引用 ts_gtest.cpp:(.text._ZN7testing8internal12UnitTestImpl41GetTestPartResultReporterForCurrentThreadEv+0x108):对‘pthread_setspecific’未定义的引用 ../../lib/libopencv_ts.a(ts_gtest.cpp.obj):在函数‘testing::internal::UnitTestImpl::~UnitTestImpl()’中: ts_gtest.cpp:(.text._ZN7testing8internal12UnitTestImplD2Ev+0xec):对‘pthread_getspecific’未定义的引用 ts_gtest.cpp:(.text._ZN7testing8internal12UnitTestImplD2Ev+0x104):对‘pthread_key_delete’未定义的引用 ts_gtest.cpp:(.text._ZN7testing8internal12UnitTestImplD2Ev+0x268):对‘pthread_getspecific’未定义的引用 ts_gtest.cpp:(.text._ZN7testing8internal12UnitTestImplD2Ev+0x280):对‘pthread_key_delete’未定义的引用 ../../lib/libopencv_ts.a(ts_gtest.cpp.obj):在函数‘testing::internal::ThreadLocal ts_gtest.cpp:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED5Ev]+0x10):对‘pthread_getspecific’未定义的引用 ts_gtest.cpp:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED5Ev]+0x28):对‘pthread_key_delete’未定义的引用 ../../lib/libopencv_ts.a(ts_gtest.cpp.obj):在函数‘testing::internal::ThreadLocal ts_gtest.cpp:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED5Ev]+0x14):对‘pthread_getspecific’未定义的引用 ts_gtest.cpp:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED5Ev]+0x2c):对‘pthread_key_delete’未定义的引用 ../../lib/libopencv_ts.a(ts_gtest.cpp.obj):在函数‘testing::internal::UnitTestImpl::UnitTestImpl(testing::UnitTest*)’中: ts_gtest.cpp:(.text._ZN7testing8internal12UnitTestImplC2EPNS_8UnitTestE+0x90):对‘pthread_key_create’未定义的引用 ts_gtest.cpp:(.text._ZN7testing8internal12UnitTestImplC2EPNS_8UnitTestE+0x138):对‘pthread_key_create’未定义的引用 ts_gtest.cpp:(.text._ZN7testing8internal12UnitTestImplC2EPNS_8UnitTestE+0x20c):对‘pthread_key_create’未定义的引用 ../../lib/libopencv_ts.a(ts_gtest.cpp.obj):在函数‘testing::internal::ThreadLocal ts_gtest.cpp:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0x1c):对‘pthread_getspecific’未定义的引用 ts_gtest.cpp:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0x114):对‘pthread_setspecific’未定义的引用 ../../lib/libopencv_core.so:对‘pthread_spin_init’未定义的引用 ../../lib/libopencv_core.so:对‘pthread_spin_unlock’未定义的引用 ../../lib/libopencv_core.so:对‘pthread_spin_lock’未定义的引用 ../../lib/libopencv_core.so:对‘pthread_spin_destroy’未定义的引用 ../../lib/libopencv_core.so:对‘pthread_once’未定义的引用 ../../lib/libopencv_core.so:对‘pthread_spin_trylock’未定义的引用 collect2: error: ld returned 1 exit status make[2]: *** [bin/opencv_test_core] 错误 1 make[1]: *** [modules/core/CMakeFiles/opencv_test_core.dir/all] 错误 2 make: *** [all] 错误 2 step11 从错误可以看出跟pthread有关, 修改build/CMakeCache.txt CMAKE_EXE_LINKER_FLAGS:STRING=-lpthread -lrt -ldl |
|
|
|
step12
继续编译出现如下错误: Linking CXX executable ../../bin/opencv_test_nonfree [ 98%] Built target opencv_test_nonfree [ 98%] Building CXX object modules/stitching/CMakeFiles/opencv_stitching.dir/src/autocalib.cpp.obj [ 98%] Building CXX object modules/gpu/CMakeFiles/opencv_perf_gpu.dir/perf/perf_imgproc.cpp.obj [ 98%] Building CXX object modules/stitching/CMakeFiles/opencv_stitching.dir/src/exposure_compensate.cpp.obj [ 98%] Building CXX object modules/stitching/CMakeFiles/opencv_stitching.dir/src/warpers.cpp.obj [ 98%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/fuzzymeanshifttracker.cpp.obj [ 98%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/selfsimilarity.cpp.obj [ 99%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/detection_based_tracker.cpp.obj [ 99%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/octree.cpp.obj [ 99%] Building CXX object modules/stitching/CMakeFiles/opencv_stitching.dir/src/stitcher.cpp.obj [ 99%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/colortracker.cpp.obj [ 99%] Building CXX object modules/stitching/CMakeFiles/opencv_stitching.dir/src/motion_estimators.cpp.obj [ 99%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/parvoretinafilter.cpp.obj [ 99%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/logpolar_bsm.cpp.obj [ 99%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/basicretinafilter.cpp.obj [ 99%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/chamfermatching.cpp.obj /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp: In member function ‘void cv::ChamferMatcher::Matching::computeDistanceTransform(cv::Mat&, cv::Mat&, cv::Mat&, float, float, float)’: /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:969:30: error: the compiler can assume that the address of ‘annotate_img’ will never be NULL [-Werror=address] if (&annotate_img!=NULL) { ^ /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:1016:34: error: the compiler can assume that the address of ‘annotate_img’ will never be NULL [-Werror=address] if (&annotate_img!=NULL) { ^ /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp: In member function ‘cv::ChamferMatcher::Match* cv::ChamferMatcher::Matching::localChamferDistance(cv::Point, cv::Mat&, cv::Mat&, cv::ChamferMatcher::Template*, float)’: /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:1111:25: error: the compiler can assume that the address of ‘orientation_img’ will never be NULL [-Werror=address] if (&orientation_img!=NULL) { ^ [ 99%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/magnoretinafilter.cpp.obj /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:1111:5: warning: nonnull argument ‘orientation_img’ compared to NULL [-Wnonnull-compare] if (&orientation_img!=NULL) { ^~ /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp: In member function ‘void cv::ChamferMatcher::Matching::computeDistanceTransform(cv::Mat&, cv::Mat&, cv::Mat&, float, float, float)’: /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:1016:17: warning: nonnull argument ‘annotate_img’ compared to NULL [-Wnonnull-compare] if (&annotate_img!=NULL) { ^~ /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:969:13: warning: nonnull argument ‘annotate_img’ compared to NULL [-Wnonnull-compare] if (&annotate_img!=NULL) { ^~ [ 99%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/retinafilter.cpp.obj [ 99%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/rgbdodometry.cpp.obj /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/contrib/src/rgbdodometry.cpp:65:47: fatal error: unsupported/Eigen/MatrixFunctions: 没有那个文件或目录 # include ^ compilation terminated. make[2]: *** [modules/contrib/CMakeFiles/opencv_contrib.dir/src/rgbdodometry.cpp.obj] 错误 1 make[2]: *** 正在等待未完成的任务.... Linking CXX shared library ../../lib/libopencv_stitching.so [ 99%] Built target opencv_stitching Scanning dependencies of target opencv_perf_stitching Scanning dependencies of target opencv_test_stitching [ 99%] [ 99%] [ 99%] Building CXX object modules/stitching/CMakeFiles/opencv_test_stitching.dir/test/test_blenders.cpp.obj Building CXX object modules/stitching/CMakeFiles/opencv_test_stitching.dir/test/test_main.cpp.obj Building CXX object modules/stitching/CMakeFiles/opencv_perf_stitching.dir/perf/perf_stich.cpp.obj In file included from /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/flann/include/opencv2/flann/params.h:33:0, from /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/flann/include/opencv2/flann/flann_base.hpp:41, from /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/flann/include/opencv2/flann/flann.hpp:50, from /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/stitching/perf/perf_stich.cpp:4: /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/flann/include/opencv2/flann/any.h: In member function ‘virtual void cvflann::anyimpl::big_any_policy /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/flann/include/opencv2/flann/any.h:83:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (* x) delete (* reinterpret_cast ^~ /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/flann/include/opencv2/flann/any.h:83:55: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ if (* x) delete (* reinterpret_cast ^ cc1plus: some warnings being treated as errors make[2]: *** [modules/contrib/CMakeFiles/opencv_contrib.dir/src/chamfermatching.cpp.obj] 错误 1 make[1]: *** [modules/contrib/CMakeFiles/opencv_contrib.dir/all] 错误 2 make[1]: *** 正在等待未完成的任务.... [ 99%] Building CXX object modules/stitching/CMakeFiles/opencv_pe 以下错误解决办法: 修改build/modules/contrib/CMakeFiles/opencv_contrib.dir/flags.make 删除 CXX_FLAGS 中的 -Werror=address 2.4.9/modules/contrib/src/chamfermatching.cpp:969:30: error: the compiler can assume that the address of ‘annotate_img’ will never be NULL [-Werror=address] if (&annotate_img!=NULL) { 以下错误解决办法: 进入Eigen3库目录发现缺少unsupported目录,下载新的Eigen库并替换,因为Eigen库全部都是头文件,所以直接替换就好,不依赖具体的平台。 /home/rootroot/workspace/BAOLE_CLEAN_ROBOT/BL505/CORE-BOARD-PRO/WITHSRC/RK3326/lib/opencv-2.4.9/modules/contrib/src/rgbdo step13 再次编译,编译成功。 step14 执行 make install 进行安装,安装完成后,可以将Install目录下的内容拷贝到RK3326板子上/usr目录下相关的目录中即可。 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1988 浏览 1 评论
synopsys 的design ware:DW_fpv_div,浮点数除法器,默认32位下,想提升覆盖率(TMAX),如果用功能case去提升覆盖率呢?
2490 浏览 1 评论
RK3588 GStreamer调试四路鱼眼摄像头四宫格显示报错
5272 浏览 1 评论
【飞凌嵌入式OK3576-C开发板体验】RKNN神经网络-YOLO图像识别
254 浏览 0 评论
【飞凌嵌入式OK3576-C开发板体验】SSH远程登录网络配置及CAN通讯
1336 浏览 0 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 14:19 , Processed in 0.602586 second(s), Total 73, Slave 56 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号