Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing debug version of Qt on Mac OSX

Tags:

macos

qt

I need to step through the Qt code to help solve a bug in my C++ application. I've downloaded qt-mac-opensource-src-4.5.2.tar from here and followed the install instructions that came with this:

  1. unpacked the file to /tmp.
  2. typed ./configure -debug.
  3. typed make.
  4. typed sudo make install.
  5. edited the PATH environment variable as instructed.
  6. set the DYLD_IMAGE_SUFFIX environment variable to _debug.

This installed Qt and my Qt application runs, but I still can't step into the Qt code.

I'm using Xcode 3.1.3 and tried changing the Executable Info to "use debug suffix when loading frameworks". This generated a lot of warnings like:

warning: Could not find object file "/private/tmp/qt-mac-opensource-src-4.5.2/src/corelib/.obj/debug-shared/qmalloc.o" - no debug information available for "global/qmalloc.cpp".

warning: Could not find object file "/private/tmp/qt-mac-opensource-src-4.5.2/src/corelib/.obj/debug-shared/qnumeric.o" - no debug information available for "global/qnumeric.cpp".

and also a lot of non-qt related warnings.

I'd shutdown the Macbook Pro overnight, which I can only assume clears the tmp directory as the unpacked file is no longer there.

I think I could fix it by rebuilding Qt without frameworks, but this is more of a work-around than a fix that will probably come back to bite me. I'm also a bit reluctant to do this, when each rebuild takes between 3 and 4 hours.

Alternatively, would downloading the binaries and debug libs work?

I'd be grateful for any suggestions on what I'm missing and how I address this.

Thanks.

like image 607
Robin Avatar asked Mar 01 '23 12:03

Robin


2 Answers

With the help of Qt support, I've now resolved this.

There were a couple of issues:

  • The Qt debug "make install" doesn't currently generate dSYM files for the _debug stuff. They've raised a bug about this. To get round this:

    4a. cd /usr/local/Trolltech/Qt-4.5.2/lib
    4b. Type /usr/bin/dsymutil -o QtGui.framework/QtGui_debug.dSYM QtGui.framework/Versions/4/QtGui_debug
    4c. Repeat for each Qt framework.

  • The tmp directory does indeed get wiped on each reboot. To get round this:

    7- Copy the entire contents of /tmp/qt-mac-opensource-src-4.5.2 to a new directory ~/Qt .

I also added both the frameworks and source code to the Xcode project.

like image 53
Robin Avatar answered Mar 07 '23 02:03

Robin


Have a look at this http://doc.trolltech.com/4.5/debug.html There is a section especially for debugging under MacOSX and Xcode... I guess you need to generate a makefile with debug option using qmake !

like image 26
Matthieu Avatar answered Mar 07 '23 03:03

Matthieu