Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] MacOS runtime problem - dylb: Library not loaded
I'm having hard time running my app on MacOSX.
The .pro build just fine, but after when I tried to run the .app from inside QtCreator or outside, I get this error :
dyld: Library not loaded: /Users/tourlou2/Qt/5.2.1/clang_64/lib/QtOpenGL.framework/Versions/5/QtOpenGL
Referenced from: /Library/Frameworks/qwt.framework/Versions/6/qwt
Reason: image not found
Trace/BPT trap: 5
I don't know why It checks in that folder for QtOpenGL, here is my Otool of qwt
@otool -L /qwt.framework/Versions/6/qwt
@executable_path/../Frameworks/qwt.framework/Versions/6/qwt (compatibility version 6.1.0, current version 6.1.0)
@executable_path/../Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.2.0, current version 5.2.1)
@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.2.0, current version 5.2.1)
@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.2.0, current version 5.2.1)
@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.2.0, current version 5.2.1)
@executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.2.0, current version 5.2.1)
@executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.2.0, current version 5.2.1)
@executable_path/../Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent (compatibility version 5.2.0, current version 5.2.1)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)@
Here is my framework structure after I build :
I even copied QOpenGL.framework to "/Users/tourlou2/Qt/5.2.1/clang_64/lib/QtOpenGL.framework/"
Like it was requesting but I still have the same error
Thanks if you can guide me a little!
did you build Qwt with Qt 5.2.1 and are now using e.g. 5.3 ?
No I just reinstalled
and uninstalled 5.3
I can't even compile qwt now, I got error "qgl.h file not found"
Seems to be related to openGL, ahh why did I try to upgrade -_-
[Edit: reinstalled 5.3.1 on Mac, now I can compile qwt fine, I will check for my project tomorrow, thank]
It's looking in that folder because that is where it was linked when you built it. I had the same problem with some of the Qt files on my mac.
Easiest thing to do is redirect where you want it to actually look i.e. your real Qt directory using otool on the Qt libs.
Do an otool -L on the qwt framework to find where it is pointing then change that to your actual Qt install location, for instance /usr/local/Qt-5.2.1 or whatever you used for a prefix.
As for reinstalling, qgl.h is contained as part of Qt. It shouldn't have trouble finding it. You can post the error parts of your build process and I can see if I spot anything for you.
Yes ambershark you are right, it is still pointing in my old Qt installation folder for OpenGL (dyld: Library not loaded:/ Users/tourlou2/Qt/5.2.1/clang_64/lib/QtOpenGL.framework/Versions/5/QtOpenGL)
Qwt has just been recompiled with 5.3.1 and it shouldn't look for this old folder that no longer exist. I suspect it's my fault because I used "DYLD_LIBRARY_PATH" before and now I need to "unset" the old path, still looking for a command to do that. I should have never used the variable $DYLD_LIBRARY_PATH, otool is a better way.
If I run "set" on terminal", I get this line that is outdated :
I cleared all the DYLIB_LIBRARY_PATH and PATH of my old Qt install
I probably still have copied qwt.framework somewhere in the system file.
I suck at Mac, how do you find a file "qwt.framework" on the whole disk? lol..
[Edit: Good, I found the old lib that was in /Library/Framework,
deleted it, now I get the good version error at least :
dyld: Library not loaded: qwt.framework/Versions/6/qwt
Referenced from: /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_3_clang_64bit-Release/MaximumTrainer.app/Contents/MacOS/MaximumTrainer
Reason: image not found
Where is a good place to put "qwt.framework" library? I won't do the mistake of putting it in the system lib anymore. I tried to copy to Qt/5.3.1/5.3/clang64/lib but it's not loading
Copied the new compiled with 5.3.1 "qwt.framework" library into "/Library/Framework". Working out so far, will have to remember to clear this library on future install/update.. thanks for the help
You can use install_name_tool to update the path of your library in your bundle
No problem, glad you got that all worked out.
If you don't want the framework at a system level you can put it anywhere you want. In your home directory under ~/Library/Frameworks would be a good place maybe.
Anyway, then you just have to point to it using something like the CFLAGS to the compiler when you want to use it.
Whatever works though. There is nothing wrong with system level as long as you remember it's there and need updating with the rest. :)