How do I install different openCV versions without conflict?

asked 2015-02-11 10:27:53 -0500

Potato gravatar image

I have the 2.4.10 version running fine, but want to install the 3.0.0 beta. I am using Linux. How do I install them so they do not conflict?

edit retag flag offensive close merge delete



one way to do that would be:

  • do a static build : cmake -BUILD_SHARED_LIBS=OFF
  • install that to some non-standard folder : cmake -DCMAKE_INSTALL_PREFIX=/app/ocv3

you'll have to explicitly specify your include and libs path when building your app later, but at least you can have as many different opencv versions as you want this way, without them ever interfering.

berak gravatar imageberak ( 2015-02-11 10:46:59 -0500 )edit

What does a static build do exactly? So the include would be something like this -> #include </app> ?

Potato gravatar imagePotato ( 2015-02-11 11:10:23 -0500 )edit
  • the includes stay the same, like "opencv2/opencv.hpp". the include path would be like g++ -I/app/ocv3/include and link path like -L/app/ocv3/lib
berak gravatar imageberak ( 2015-02-11 11:18:48 -0500 )edit

So if I were to compile a basic program it would be something like this? --> g++ -I/app/ocv3/inlcude -L/app/ocv/lib pkg-config --libs --cflags opencv -o program program.cpp ?

Potato gravatar imagePotato ( 2015-02-11 13:03:34 -0500 )edit

no, not with pkg-config (that's kind of xor), more like :

g++ -I /app/ocv3/include -L /app/ocv3/lib -lopencv_imgcodecs -lopencv_imgproc -lopencv_core -ljpeg -lpng -lrt -ldl -lz -lpthread -o program program.cpp

(that's probably missing some imglibs)

berak gravatar imageberak ( 2015-02-11 13:10:47 -0500 )edit

Just a follow up. I did a static install and everything looks right. I do have a question though.

In the non standard library(/app/ocv3/lib) there is a pkg-config file that has been created. Is there anyway I can use this for a static program build instead of typing the entire library list?

Potato gravatar imagePotato ( 2015-02-13 08:19:04 -0500 )edit

sorry, idk.

berak gravatar imageberak ( 2015-02-13 08:21:28 -0500 )edit

No issues, thanks for your help again.

Potato gravatar imagePotato ( 2015-02-13 08:29:18 -0500 )edit