pkg_config ??
-
I like to live dangerously so I'll risk forum or administration wrath with this one. Found this Linux application which supposedly helps with file linking. I have created using pkg_config - "opencv.pc" file and added it in -L - add library path. It does contain OpenCV libraries , I verified that, but linker complain of "incorrect extension ". However, I cannot find in any pkg_config related sites HOW to actually tell GCC linker to use this "opencv.pc". Also this pkg_config info is not that new. There is no open access user forum which makes me suspicious if this "packaging libraries " is a good and useful tool. Please, if this post is not in line with CodeProject policies just ignore it or let me know and I'll delete it. Cheers Vaclav
-
I like to live dangerously so I'll risk forum or administration wrath with this one. Found this Linux application which supposedly helps with file linking. I have created using pkg_config - "opencv.pc" file and added it in -L - add library path. It does contain OpenCV libraries , I verified that, but linker complain of "incorrect extension ". However, I cannot find in any pkg_config related sites HOW to actually tell GCC linker to use this "opencv.pc". Also this pkg_config info is not that new. There is no open access user forum which makes me suspicious if this "packaging libraries " is a good and useful tool. Please, if this post is not in line with CodeProject policies just ignore it or let me know and I'll delete it. Cheers Vaclav
-
I think you are making life more complicated than it needs to be. This is just another utility that you will need to learn ... see pkg-config(1) - Linux man page[^].
... or enter "man pkg-config" at a shell prompt.
-
... or enter "man pkg-config" at a shell prompt.
-
Thanks for lectures. I 'll let you know HOW to actually tell GCC linker to use this "opencv.pc". when I answer my own question. Cheers Vaclav
-
I like to live dangerously so I'll risk forum or administration wrath with this one. Found this Linux application which supposedly helps with file linking. I have created using pkg_config - "opencv.pc" file and added it in -L - add library path. It does contain OpenCV libraries , I verified that, but linker complain of "incorrect extension ". However, I cannot find in any pkg_config related sites HOW to actually tell GCC linker to use this "opencv.pc". Also this pkg_config info is not that new. There is no open access user forum which makes me suspicious if this "packaging libraries " is a good and useful tool. Please, if this post is not in line with CodeProject policies just ignore it or let me know and I'll delete it. Cheers Vaclav
Vaclav_Sal wrote:
However, I cannot find in any pkg_config related sites HOW to actually tell GCC linker to use this "opencv.pc".
The linker doesn't use .pc files. You must use the
pkg-config
command to generate the options for the compiler or linker. Use command substitution[^] to embed thepkg-config
command on the linker command line or to store the output in a variable. -
Vaclav_Sal wrote:
However, I cannot find in any pkg_config related sites HOW to actually tell GCC linker to use this "opencv.pc".
The linker doesn't use .pc files. You must use the
pkg-config
command to generate the options for the compiler or linker. Use command substitution[^] to embed thepkg-config
command on the linker command line or to store the output in a variable.Thanks for actually answering my question without an additional commentaries. Appreciate that. I have also found that I could include the pkg_config command(s) in "make" file. Of course I need to figure out how to either modify the "make" automatically build by IDE or learn how to build my own. Cheers Vaclav
-
Vaclav_Sal wrote:
However, I cannot find in any pkg_config related sites HOW to actually tell GCC linker to use this "opencv.pc".
The linker doesn't use .pc files. You must use the
pkg-config
command to generate the options for the compiler or linker. Use command substitution[^] to embed thepkg-config
command on the linker command line or to store the output in a variable.Still struggling with the issue Here is exact syntax I have used - it suppose to "print" , I assume substitute, the libraries in package ( opencv ) to the linker as -l options. It does not matter if the options are --libs opencv or opencv --libs - which is expected. "$(pkg-config opencv --libs)" Here is partial liker output make all Building target: TEST_1 Invoking: GCC C++ Linker g++: error: missing argument to ā-lā g++ -L/usr/local/lib -o "TEST_1" ./src/TEST_1.o -l"" make: *** [TEST_1] Error 1 makefile:45: recipe for target 'TEST_1' failed I have tried different format / syntax and "$(command)" is correct per the link you have provided. From the output it is notable that no -l files were included - -l"". I do not know what else can be wrong. The command does not expands to anything linker can use and it should look as terminal output. jim-desktop:~$ pkg-config opencv --libs -L/usr/local/lib -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_viz -lopencv_core I have asked in several forums and all I am getting is how to add -L/-l options MANUALLY to the linker options. BTW including ":" before the manually inserted file name specifies to the pkg-config to use library file WITHOUT using the file extension. Nice to know but does not solve my issue. Cheers Vaclav