MacOS Troubleshooting

From Qt Wiki
Revision as of 16:05, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

OS X Troubleshooting

Using Qt debug libraries on Mac OS X 10.6 Snow Leopard

When using Qt frameworks, you might want to use the debug libraries instead of the release ones. This is done by setting the DYLD_IMAGE_SUFFIX environment variable to _debug.

Unfortunately, on Snow Leopard, this causes your application to crash. The reason is that Apple system frameworks crash when using the debug libraries. To be able to use Qt in debug mode, you must remove the debug version of the library (or overwrite it with the release version).

Another solution is to change the install name information in the executable directly with install_name_tool (an utility shipped with Xcode). First of all, we can see a Qt program will link to several libraries and frameworks:

We need to change the paths of QtTest, QtGui and QtCore here, which means:

In this way we can selectively use debug libraries for this program without affecting the system library. But changing this manually is cumbersome and error-prone, be sure to create a script for that if you are doing this constantly.

Categories: