On Windows, a debug library's name has a d as a postfix. But I don't know if there is a rule on Linux.
I know there is some dbg packages on Debian. For example, the library of the package libjpeg62-dbg is placed in /usr/lib/debug/usr/lib/libjpeg.so.62.0.0
. Is it a standard rule to place a debug version library into /usr/lib/debug
?
And more. For example, if I run pkg-config --libs opencv
that will return the GCC link options to me such as:
-L/usr/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
It's very good. But I don't find a option in pkg-config
which can return link options of those debug version libraries such as:
-L/usr/lib/debug -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
Why pkg-config
has not a option to return debug version of options if there is a standard rule about debug version library?
So, I want to know:
pkg-config --libs
? Thanks.
Linux and windows have differing views on this. In Linux, there's really not much of a point in offering a debug library, because if someone really wants to debug the library they usually have the source code. Otherwise, you can mix and match (linking a "release" library with a "debug" program is just fine). You can be a nice guy and leave the debugging symbols in if you really want to (sysadmins can strip symbols out if they think there's too much bloat).
The other problem is that under linux there are too many compiler flags. There's not just "debug" and "release". There are a million flags you can turn on and off, as well as various target architectures. That's why most library developers just release the source code and let the user (or distro maintainer) decide what to turn on and off. In other words, there's no way your idea of a "debug" library would anticipate every developer's needs.
You don't need to link with a debug version of the library in order to use it, which is why pkg-config
doesn't offer such an option. All you need to do is set up your LD_LIBRARY_PATH
appropriately when you run the program, and the debug library will get used at runtime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With