How to successfully create a debuggable Qt application on Mac OS X?



  • I'm trying already quite a while to build a KDE application which can be debugged using gdb or Xcode on Mac OSX.

    Although the release version of the app runs fine - at least up to the point which I actually want to debug - the debug version(s) crash right at the start!!!

    The code can be found "in folder AboutBoxCrash in this zip":https://bitbucket.org/mkae/kde-tests/get/tip.zip

    I read the articles http://developer.qt.nokia.com/doc/qt-4.7/debug.html and http://developer.qt.nokia.com/wiki/Mac_OS_X_Troubleshooting, followed their advice, but nothing seems to work out.

    No, I didn't try the dsymutil-trick of this one here: http://stackoverflow.com/questions/1136734/installing-debug-version-of-qt-on-mac-osx yet...


    But I can imagine that I am not the only Lab Rat who would love to be able to get a -QT- Qt app into a debugger on Mac OSX...


    Yes, this is related to the thread "Crash when trying to start KMyMoney with -QT- Qt 4.7.3 debug version":http://developer.qt.nokia.com/forums/viewthread/6748 and I hope that the new title attracts someone who can help. :-)



  • OK, I am back again.

    In the meantime I understood - thanks to an advice from Ian Wadham - that the configure option
    @-no-separate-debug-info@
    could be used when building QT4.

    In the configure options setup I also found that
    @-debug-and-release@
    was actually set which always produced both lib versions being very likely the reason for unintended linking between release and debug library version, eventually being responsible for the crashing debug version of the application under test...

    So, I changed the configure options now to
    @configure.args-append -debug -no-separate-debug-info@

    I can verify that now only debug versions of the respective QT libs are installed:
    @...
    /opt/macports-test.new/lib/libQtCore_debug.4.7.3.dylib
    /opt/macports-test.new/lib/libQtCore_debug.4.7.dylib
    /opt/macports-test.new/lib/libQtCore_debug.4.dylib
    /opt/macports-test.new/lib/libQtCore_debug.dylib
    /opt/macports-test.new/lib/libQtCore_debug.la
    /opt/macports-test.new/lib/libQtCore_debug.prl
    ...
    @

    But above you can see that all debug libraries have the extension "_debug".

    When I try to build other applications using QT4 (here kdelibs4) I therefore run into other trouble:
    @...
    :info:build cd /opt/macports-test/var/macports/build/_Users_marko_WC_MacPorts_ports_kde_kdelibs4/work/build/kdecore && /opt/macports-test/bin/automoc4 /opt/macports-test/var/macports/build/_Users_marko_WC_MacPorts_ports_kde_kdelibs4/work/build/kdecore/kauth_backend_plugin_automoc.cpp /opt/macports-test/var/macports/build/_Users_marko_WC_MacPorts_ports_kde
    _kdelibs4/work/kdelibs-4.6.5/kdecore /opt/macports-test/var/macports/build/_Users_marko_WC_MacPorts_ports_kde_kdelibs4/
    work/build/kdecore /opt/macports-test/bin/moc /opt/macports-test/bin/cmake:info:build dyld: Library not loaded: /opt/macports-test/lib/libQtCore.4.dylib
    :info:build Referenced from: /opt/macports-test/bin/automoc4
    :info:build Reason: image not found
    :info:build /bin/sh: line 1: 82423 Trace/BPT trap /opt/macports-test/bin/automoc4 /opt/macports-test/var/macpo
    rts/build/_Users_marko_WC_MacPorts_ports_kde_kdelibs4/work/build/kdecore/kauth-policy-gen_automoc.cpp /opt/macports-tes
    t/var/macports/build/_Users_marko_WC_MacPorts_ports_kde_kdelibs4/work/kdelibs-4.6.5/kdecore /opt/macports-test/var/macp
    orts/build/_Users_marko_WC_MacPorts_ports_kde_kdelibs4/work/build/kdecore /opt/macports-test/bin/moc /opt/macports-test
    /bin/cmake
    ...@

    Above you can see that the build process of kdelibs4 expects to find libQtCore.4.dylib which, of course, cannot be found in my current setup.

    I am wondering what can be done to make cmake build QT4 a debug version without appending the "_debug" prefix to the library names.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.