Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I need to turn the BUILD_SHARED_LIBS = OFF option.

yes. then (re)run cmake && make install

some files are in the usr/local/include and usr/local/libs

check your opencv version again, the relevant include forlder for opencv4 is /usr/local/include/opencv4 (this was changed recently !)

how do I compile the static libs for my program?

above steps will build static (large) opencv libs. you probably wanted to ask:

how do i link my program against static opencv libs ?

that's the tricky part:

  • you'll have to manually link libs, that were conveniently linked against the so's before (like libjpeg -> imgcodecs)
  • the order of libs in the list matters, you have to sort them, dependancies go last, so, -lopencv_imgcodecs -llibpng -lz

I need to turn the BUILD_SHARED_LIBS = OFF option.

yes. then (re)run cmake && make install

some files are in the usr/local/include and usr/local/libs

check your opencv version again, the relevant include forlder folder for opencv4 is /usr/local/include/opencv4 (this was changed recently !)

how do I compile the static libs for my program?

above steps will build static (large) opencv libs. you probably wanted to ask:

how do i link my program against static opencv libs ?

that's the tricky part:

  • you'll have to manually link libs, that were conveniently linked against the so's before (like libjpeg -> imgcodecs)
  • the order of libs in the list matters, you have to sort them, dependancies go last, so, -lopencv_imgcodecs -llibpng -lz