custom OpenCV install issues [LINUX]

938 views Asked by At

Just installed OpenCV 2.4.7 manually in a custom dir on my hosted CentOS 6.4 box. However, when I now try to "./configure" a program called OpenCV-for-PHP that depends on the OpenCV library, it doesn't recognize this new version and still automatically refers to the "old" OpenCV installation (version 2.0.0) that was installed through yum.

The question is: what do I have to set in order to make OpenCV in my custom directory the actively used OpenCV, that will be used during the ./configure stage? (instead of the one it looks up now, which was installed through yum) I've tried:

 [root@srv]# export LD_LIBRARY_PATH="/home/userhome/opencv/opencv-2.4.7/build/lib"
 [root@srv]# export PKG_CONFIG_PATH="/home/userhome/opencv/opencv-2.4.7/build/lib"
 [root@srv]# export PATH=/home/userhome/opencv/opencv-2.4.7/build/lib:$PATH

None of these seem to do the trick, however. pkg-config also still displays the old version after adding these vars.

 [root@srv]# pkg-config --modversion opencv
 2.0.0
 [root@srv]# 

Running "./configure" still displays the same dreaded message and exits prematurely:

 [root@srv1 OpenCV-for-PHP]# ./configure
 (...)
 checking for pkg-config... found
 checking for opencv... too old
 configure: error: Ooops ! You need at least opencv 2.1.0

Maybe it is possible to feed a specific parameter into the ./configure with a value set to my custom OpenCV install dir? (ie. ./configure --opencvpath=/home/usern/opencv/lib/)

All suggestions that might fix this issue are welcome!

1

There are 1 answers

0
OCVPHPDesigner On

PKG_CONFIG_PATH was pointing to the wrong directory. This var has to point to the pkg-config dir containing .pc files, ie. in our server's case "/usr/local/lib/pkgconfig".

By opening the .pc file for OpenCV residing in the aforementioned directory it showed to be still pointing to the old installation. Simply change the value here to the custom path you've installed OpenCV in.