1

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()
Community
  • 1
  • 1
ozgeneral
  • 6,079
  • 2
  • 30
  • 45
  • Could you please add your CMakeLists.txt? – s1hofmann Dec 19 '15 at 21:00
  • Just did (had to type it manually from screen since device Im working with do not have internet connection at the moment, so if there is any typo I missed, that is not the cause) – ozgeneral Dec 19 '15 at 21:12
  • [This](https://cmake.org/pipermail/cmake/2011-April/043822.html) recomends to set `CMAKE_PREFIX_PATH` to `/usr/local/lib`. `CMAKE_MODULE_PATH` affects on `find_package` behaviour only in *module* mode (`findOpenCV.cmake`), which is system wide file, but in your case it is *config* mode, which is per-installation one. – Tsyvarev Dec 19 '15 at 23:40
  • I just did cmake -D CMAKE_PREFIX_PATH=usr/local .. and its even worse now. Cmake do not work anymore. When I do cmake .. I get No current working directory, Aborted. – ozgeneral Dec 20 '15 at 07:18

1 Answers1

0

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?

s1hofmann
  • 1,491
  • 1
  • 11
  • 22
  • there is no such folder in /usr/share/opencv but there is one at /usr/local/share/opencv (3.0 is installed at local so I think there suppose to be one) – ozgeneral Dec 19 '15 at 21:43