树莓派编译opencv

以前编译OPENCV最简单的方式就是利用QT直接打开CMakeList文件进行编译,这次打开总是很卡,所以采用cmake+sudo make+sudo make install

结果一个劲儿的报错:先是下载一堆 i 文件报错,直接将原来的复制过去就能用了,然后提示找不到,对应报错代码,打开对应的cpp把错误的路径修改一下,最后到100%了,还报错,真是RLGL,报错内容如下:

[100%] Building CXX object apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/main.cpp.o
[100%] Building CXX object apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/parametersController.cpp.o
[100%] Building CXX object apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/rotationConverters.cpp.o
[100%] Linking CXX executable ../../bin/opencv_interactive-calibration
[100%] Built target opencv_interactive-calibration
Scanning dependencies of target opencv_version
[100%] Building CXX object apps/version/CMakeFiles/opencv_version.dir/opencv_version.cpp.o
[100%] Linking CXX executable ../../bin/opencv_version
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to `__atomic_compare_exchange_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to `__atomic_fetch_sub_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to `__atomic_load_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to `__atomic_store_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to `__atomic_fetch_add_8'
collect2: error: ld returned 1 exit status
make[2]: *** [apps/version/CMakeFiles/opencv_version.dir/build.make:85:bin/opencv_version] 错误 1
make[1]: *** [CMakeFiles/Makefile2:7260:apps/version/CMakeFiles/opencv_version.dir/all] 错误 2
make: *** [Makefile:163:all] 错误 2

参考了https://www.jianshu.com/p/41957bf197ed

增加了-DCMAKE_SHARED_LINKER_FLAGS='-latomic'参数,然后重新编译就成功了,但是在CMAKE-GUI和QT中都没有找到对应的flag,好吧,总算结束了1天2晚的数次编译,终于成功了

重要的编译配置命令如下:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D \
OPENCV_EXTRA_MODULES_PATH=/media/pi/udisk_linux/opencv411/opencv411-contrib/modules -D \
ENABLE_NEON=ON -D ENABLE_VFPV3=ON -D BUILD_TESTS=OFF -D OPENCV_ENABLE_NONFREE=ON -D \
INSTALL_PYTHON_EXAMPLES=OFF -DCMAKE_SHARED_LINKER_FLAGS='-latomic' -D BUILD_EXAMPLES=OFF ..

截图留念:

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值