0

I am using OpenCV in one of my projects. Until now, I was using version 3 under Ubuntu 18.04, so in my meson.build I had:

... dependencies: [dependency('opencv')])

Now, I've compiled OpenCV 4 from source and installed to the default dir, /usr/local/, and changed my meson.build to:

... dependencies: [dependency('opencv4')])

Resulting in a not found error (despite this works with Ubuntu 20.04 and the package from the official repos, which is version 4.2). How should I specify the library's location so Meson can find it?

I've seen find_library, but that's deprecated according the docs.

dvilela
  • 1,200
  • 12
  • 29

1 Answers1

4

The dependency function is using pkg-config or cmake if pkg-config fails, to find external dependency (installed library).

When you install OpenCV4, please check if there is pkg-config for opencv4. Here is my command:

pkg-config --list-all | grep "opencv4"

and output:

opencv4 OpenCV - Open Source Computer Vision Library

Also, check PKG_CONFIG_PATH environment variable. pkg-config will use that path to search for .pc files.

Edit: be sure to use -D OPENCV_GENERATE_PKGCONFIG=YES when building opencv with cmake.

Elvis Oric
  • 1,289
  • 8
  • 22