卸载opencv

由于moveit依赖opencv3.2,之前装的opencv版本为3.4,需要卸载掉3.4版本安装opencv3.2

MotionPlanning
The class required for this display, 'moveit_rviz_plugin/MotionPlanning', could not be loaded.
Error:
Failed to load library /opt/ros/melodic/lib/libmoveit_motion_planning_rviz_plugin.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = libopencv_core.so.3.2: 无法打开共享对象文件: 没有那个文件或目录)

卸载opencv3.4
1.进入本地opencv工程build文件夹中进行卸载

sudo make uninstall

2.删除usr目录下opencv相关文件

sudo rm -r /usr/local/include/opencv2 /usr/local/include/opencv /usr/include/opencv /usr/include/opencv2 /usr/local/share/opencv /usr/local/share/OpenCV /usr/share/opencv /usr/share/OpenCV /usr/local/bin/opencv* /usr/local/lib/libopencv*
cd /usr
find . -name "*opencv*" | xargs sudo rm -rf

3.检查是否卸载干净

pkg-config opencv --libs
pkg-config opencv --modversion

安装opencv-3.2

  1. 下载
git clone -b 3.2.0 https://gitee.com/mirrors/opencv.git
  1. 编译
cd opencv-3.4.13
mkdir build
cd build
sudo cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local  \
-D WITH_CUDA=OFF -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF \
-D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF  -D BUILD_TIFF=ON ..

错误:CMake Error at cmake/OpenCVCompilerOptions.cmake:21 (else):

CMake Error at cmake/OpenCVCompilerOptions.cmake:21 (else):
  A duplicate ELSE command was found inside an IF block.
Call Stack (most recent call first):
  CMakeLists.txt:495 (include)

解决方法:
直接打开cmake/OpenCVCompilerOptions.cmake:21 ,找到21行,直接删除掉就好了

错误:opencv_lapack.h缺失

In file included from /home/zhan/Lib/opencv-3.2.0/modules/core/src/hal_internal.cpp:49:0:
/home/zhan/Lib/opencv-3.2.0/build/opencv_lapack.h:2:10: fatal error: LAPACKE_H_PATH-NOTFOUND/lapacke.h: 没有那个文件或目录
 #include "LAPACKE_H_PATH-NOTFOUND/lapacke.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
modules/core/CMakeFiles/opencv_core.dir/build.make:522: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/hal_internal.cpp.o' failed
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/hal_internal.cpp.o] Error 1
make[2]: *** 正在等待未完成的任务....
CMakeFiles/Makefile2:1042: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

解决方法:

sudo apt-get install liblapacke-dev checkinstall
  • 在/build文件夹中找到opencv_lapack.h文件,把#include
    "LAPACKE_H_PATH-NOTFOUND/lapacke.h"改为#include “lapacke.h”

  • 重新编译

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值