views:

33

answers:

1

I have debug versions of libstdc++ and libc, among others, and would like to link against them. They live in /usr/lib/debug as opposed to /usr/lib. Any ideas?

+2  A: 

Assuming Linux,

  1. Static libraries: add a -L/usr/lib/debug to your linker command line. gcc/ld will look there before default system directories. Use ldd command to verify that correct library versions were linked against (shared libraries only).
  2. Shared libraries: set LD_LIBRARY_PATH=usr/lib/debug, and your application will pick up libraries from there even without step 1, as long as there is a version of a library, which is very likely if you are installing with distribution's package manager.

It's a good idea to do both, though, as some libraries may be only in static form.

Alex B
That works, but I guess I have to change the LD_LIBRARY_PATH to get the debug shared libraries to load, right?
Jonathan Fischoff
@Jonathan Fischoff, if you are linking against shared libraries, yes.
Alex B