Linking openCv binaries in Linux Ubuntu

After installing of v0.10.1 on a fresh Ubuntu 20.04, I ran into the issue described here when trying to compile an app including ofxOpenCv. The solution was to downgrade openCv to v3. I couldn’t find it with apt-get so I installed it from source in a separate directory. After doing that, the compile error goes away and app compiles successfully. But on make RunRelease I get:

HOST_OS=Linux
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal libcurl glfw3 rtaudio libpulse-simple alsa gl glu glew gtk+-3.0 
with PKG_CONFIG_LIBDIR=
./opencvExample: error while loading shared libraries: libopencv_objdetect.so.3.4: cannot open shared object file: No such file or directory
make: *** [/home/cnk/install/of_v0.10.1_linux64gcc6_release/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:197: RunRelease] Error 127

I know where these binaries (libopencv_objdetect.so.3.4 and the others) are but I’m not positive how to link them properly. What is the way to point the app to the directory containing the fresh opencv build?

Hi @genekogan
You can do that through ofxOpenCv’s addon_config.mk file. It uses pkg-config but I guess that you can manually link to the appropriate library. I think you might also need to run update your project with Project Generator.
You could also use the project’s config.make file.
Let me know if this works.

1 Like

Thanks @roymacdonald!

I just replaced libs/opencv in ofxOpenCv’s addon_config with the location of opencv where i built it and that did the trick.

1 Like