Two OpenCV's are installed (with different versions) and I can't delete all traces of the past one

◇◆丶佛笑我妖孽 提交于 2019-12-24 13:56:35

问题


I am new to Linux systems but I really need this for my project, so I really need your help.

Here is what happened: I have had OpenCV 2.4 on a linux system and I also installed another library called libv4l. For some reason after this install, cmake was unable to find OpenCv. So I installed OpenCV 3.0 this time, hoping that it was a compatibility problem or something.

However, OpenCV 2.4 was installed at /usr/lib by default (I used cmake, make, make install) and OpenCV 3.0 was installed at /usr/local/lib.

Now when I try to cmake, I get this warning:

Cannot generate a safe runtime search path for target <projectname>
because files in some directories may conflict with libraries in
implicit directories:
...list of files that exist both in usr/lib and usr/local/lib

and when I ignore the warning and proceed with make, I get the following error:

No rule to make target <an opencv file> 

my CMakeLists is as follows:

cmake_minimum_required (version 2.8)
project(camera_test)

find_package(OpenCV 3.0.0) #also tried without 3.0.0
set(CMAKE_MODULE_PATH "usr/local/lib/cmake/${CMAKE_MODULE_PATH}")
find_package(raspicam REQUIRED)
target_link_libraries (camera_test ${raspicam_LIBS})
target_link_libraries (camera_test ${opencv_LIBS})

I think my problem is the same with the following pages:

Removing all installed OpenCV libs

http://answers.opencv.org/question/52921/how-to-uninstall-opencv249-completely-in-ubuntu-1404/

However here is the final catch:

I did "make uninstall" for openCV 3.0, then used

sudo find / -name "*opencv*" -exec rm {} \;

and re installed openCV 3.0

but it did not fix my problem. It still thinks there are files at usr/lib although I cant find any files there anymore.

Please suggest me a solution, and I would really appreciate if you can tell briefly me the logic of this thing. I mean, How does it know there was an installed opencv at usr/lib, what trace did I leave? What are the essential files/commands I need to be looking for/executing in such cases.

Thanks a lot, I really appreciate your help.

Edit: Here is the complete CMakeLists file:

cmake_minimum_required (VERSION 2.8)
project (raspicam_test)

find_package(OpenCV 3.0.0)
set(CMAKE_MODULE_PATH “/usr/local/lib/cmake/${CMAKE_MODULE_PATH}”)
find_package(raspicam REQUIRED)

IF ( OpenCV_FOUND AND raspicam_CV_FOUND )
    MESSAGE(STATUS “COMPILING OPENCV TESTS”)
    add_executable (simpletest_raspicam_cv simpletest_raspicam_cv.cpp)
    target_link_libraries (simpletest_raspicam_cv ${raspicam_CV_LIBS} )
    target_link_libraries (simpletest_raspicam_cv ${OpenCV_LIBS})
ELSE()
    MESSAGE(FATAL_ERROR “OPENCV NOT FOUND IN YOUR SYSTEM”)
ENDIF()

回答1:


Possible cause:

sudo find / -name "*opencv*" -exec rm {} \;

won't delete directories. But there are some cmake files in

/usr/share/opencv

which would therefore not be deleted, containing deprecated infos to your previous OpenCV install.

Can you check if these files exist in your filesystem?



来源:https://stackoverflow.com/questions/34374868/two-opencvs-are-installed-with-different-versions-and-i-cant-delete-all-trac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!