OpenCV 3.0 beta was once built from source. I connected it to QtCreator 3.4.0 (Qt5.4.1) via pkg-config in Ubuntu 14.10:

unix { CONFIG += link_pkgconfig PKGCONFIG += opencv } 

Projects normally collected, started and worked.

New Ubuntu 15.04 and OpenCV 3.0 rc1 have been released. Updated the first and rebuilt the second.

Building your own projects goes off well, all external dependencies are connected, but now when you start the program from QtCreator or simply from the terminal it shows that it cannot find the OpenCV plug-in libraries. I understand that you can simply specify the environment variable LD_LIBRARY_PATH, but I would like to understand in general terms what has changed and how to make it so that it was before.

Update: The ldd command on the project issues the following:

 linux-gate.so.1 => (0xb77cc000) libopencv_core.so.3.0 => not found libopencv_features2d.so.3.0 => not found libopencv_highgui.so.3.0 => not found libopencv_imgcodecs.so.3.0 => not found libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb76ae000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7661000) libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb7644000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7488000) /lib/ld-linux.so.2 (0xb77cd000) 

OpenCV is installed in "/ usr / local / lib". One gets the feeling that "/ usr / local" has ceased to be seen as a storage location for libraries. I understand correctly?

  • And the libraries themselves (libcv.so and others) where are they after the build? Check the executable file of your project using ldd or readelf which libraries it is associated with. - velikodniy 2:49 pm
  • @velikodniy Updated the issue with the output from ldd. The necessary files are in "/ usr / local / lib". - alexis031182
  • Yes, most likely does not find the library. You can try to start a project with LD_LIBRARY_PATH="путь к библиотекам" or use the -rpath parameter in gcc during the build. If it works, then it just does not see the library and it is necessary to delve into the system settings. Other reasons I do not see. - velikodniy

1 answer 1

Most likely the system can not find the library. There are several ways to solve this problem.

The first is to add the path to the variable LD_LIBRARY_PATH (a list of the ways the system searches for libraries). To do this, before starting the program, execute the following command:

 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" 

It adds the path /usr/local/lib to the end of the variable.

The second way is to change the system settings. To do this, in the /etc/ld.so.conf.d/ directory, create a file with the name, for example, 99local.conf , containing the path to the libraries. (In your case, /usr/local/lib .)

For the changes to take effect, execute the ldconfig command as ldconfig .

The third way is to use the -rpath compiler's -rpath parameter, which allows you to explicitly specify the path to the library.

  • Thank you, exhaustively. I decided to use the second method, got into "/etc/ld.so.conf.d/" and found several different files. In one of them (libc.conf) I found an existing line with "/ usr / local / lib", so I didn’t add a new one, but simply executed ldconfig from under the root. Now everything works as before. Thank. - alexis031182