Using "DYLD_IMAGE_SUFFIX" & Apple Debug System Libraries

Michael Dickens michaelld at macports.org
Wed Aug 4 09:39:23 PDT 2010


Playing around with 'qmake' & Qt, I noticed that for framework installs
both the release and debug libraries are installed under the release's
name -- for example in ".../lib/QtCore.framework/" one would find both
"QtCore" as well as "QtCore_debug" [for standard libraries, two
libraries are installed as ".../lib/libFOO.dylib" and
".../lib/libFOO_debug.dylib"].  I wondered if the installation of the
debug library in the release framework was a bug .. so I started
searching around for info.

After much experimentation & searching around, I finally found the
environment variable "DYLD_IMAGE_SUFFIX" as the means for accessing
"debug" libraries embedded in a framework as Qt does [or as a standard
library under a different but related name].  Let's assume that the
library FOO is installed along with FOO_debug (as a library or
framework; doesn't matter).  Then, I can link with FOO to create my
application or library, and then set "DYLD_IMAGE_SUFFIX=_debug" in my
shell to use FOO_debug instead of FOO even though the linking was with
FOO.  Very neat.

To get more info on this variable and other cool DYLD variables /
tricks, one can read through Apple Tech Note 2124
https://developer.apple.com/mac/library/technotes/tn2004/tn2124.html#SECDYLD
>.  Of course, this variable works (at least in my testing) only when
one has the "Mac OS X System Debug and Profile Libraries Libraries"
installed.  These libraries can be obtained at the Apple Developer
Connection < https://connect.apple.com >: logging in, clicking on
'Developer Tools', and then searching the page for 'Debug and Profile
Libraries' (works for 10.5, which is what I'm running; and is supposed
to for 10.6 but I don't see them).

I've searched all over MacPorts lists & guide (to the best of my
ability), and can find no references to this variable or how to use it. 
It seems like an important variable for developers who regularly use
debug libraries -- such as those provided by Qt or some other ports. 
I've thought of inserting a NOTE into the Qt (and some other)
Portfile's, but that seems silly since this info should be more easily
available than that -- and, I'd need to insert it into a bunch of
Portfiles for various ports that depend on Qt (e.g., QCA), which just
seems like a waste of Portfile space.

So, I'm wondering what MP-devs think about this variable & debug
libraries, and the idea of inserting a section into the MP Guide about
using debug libraries & Apple's Tech Note & such. - MLD


More information about the macports-dev mailing list