dyld: Library not loaded when debugging but ok when running (on OS X El Capitan) [SOLVED]



  • Hi all, I upgraded recently my OS X to 10.11 (El Capitan) and Xcode 7.0.1, I am unable to debug my custom libraries-based project. In particular, the project builds and runs correctly, but when starting in debug mode, i get the following message:

    dyld: Library not loaded: libquGUI.1.dylib
    Referenced from: /Users/ucmar/Repositories/build-quTestGUI-Desktop_Qt_5_5_0_clang_64bit-Debug/quTestGUI.app/Contents/MacOS/quTestGUI
    Reason: image not found

    Does anyone experience the same problem or have an idea on how to fix this? On Yosemite everything worked properly... Thank you in advance!

    Mario


  • Lifetime Qt Champion

    Hi,

    From a recent thread on the mailing list, it seams that with El Capitan Apple modified the handling of the DYLD_* variables that are used to find frameworks/dylibs so it might be related to that



  • Thanks @SGaist. The weird thing is that when doing a simple run, everything works properly. It looks like the debugger uses a different set of env variables than the ones in the run project settings. Or maybe there might be different env variable than DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH?

    This error is very annoying because it makes it hard or impossible to debug a libs based app! I hope Apple fixes it soon!

    ps. Do you think this error appears in Xcode libs based projects, too?


  • Lifetime Qt Champion

    One thing you can try:

    • Close your project
    • Delete the .pro.user file (or rename it to something else
    • Re-open the project (you'll have to reconfigure it)


  • @SGaist thanks, but I have just tried it and it doesn't work. This issue is really making debugging impossible... I hope a workaround can be found! I have been googling around but nothing so far.


  • Lifetime Qt Champion

    Might be a silly question but did you also nuke the shadow build folder ?



  • @SGaist yep...


  • Lifetime Qt Champion

    One last thing you can check is whether you can debug with Xcode itself



  • Good call. I'll try and let you know...



  • ok after some further research I have found this page (probably the one you @SGaist were referring to) https://forums.developer.apple.com/thread/9233.

    As you mentioned, it seems that DYLD_* variables have been disabled (they are ignored) since El Capitan because of a new feature called System Integrity Protection (SIP). According to Apple Developer website, debugging can be happily performed only by Xcode (although I haven't tried it yet). What about Qt? Will 5.5.1 or 5.6 allow debugging on El Cap with SIP?

    I read on another page SIP can be disabled in Recovery mode. Anyway, I am not keen at hacking my own system... the alternative is to wait for the next version of Qt and hope for a solution. Unsure what to do for now, in the meanwhile I am stuck! Grrr

    UPDATE: I ended up disabling SIP following the following step:

    1. Enter Recovery mode (Cmd+R on startup)
    2. Open Terminal
    3. csrutil disable; reboot

    Now debugging went back to normality!

    My only doubt is that when i do csrutil status, I receive the following message:

    "System Integrity Protection status: enabled (Custom Configuration).

    Configuration:
    Apple Internal: disabled
    Kext Signing: disabled
    Filesystem Protections: disabled
    Debugging Restrictions: disabled
    DTrace Restrictions: disabled
    NVRAM Protections: disabled

    This is an unsupported configuration, likely to break in the future and leave your machine in an unknown state."

    Not very reassuring uh? (and why is that still saying SIP enabled?)


Log in to reply
 

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