Qwt on mac os x
Hi everybody. I have compiled qwt using qtcreator. Now I have two directories, "qwt.framework" and "qwtmathml.framework".
In my project I have appended at my .pro file these rows:
INCLUDEPATH += ../../qwt-6.0.1/src
LIBS += ../../qwt-6.0.1/lib/qwt.framework/qwt
LIBS += ../../qwt-6.0.1/lib/qwtmathml.framework/qwtmathml
The compilation goes well but, on run time I obtain this error:
"dyld: Library not loaded: qwt.framework/Versions/6/qwt
Referenced from: /Users/denis/C++/...
Reason: image not found"
Where I must put the libraries in order to run the program?
I'd say that you must provide those frameworks in the "application bundle":http://doc-snapshot.qt-project.org/4.8/deployment-mac.html .
Thanks for your reply. Do you think that I must copy the folders “qwt.framework” and “qwtmathml.framework” in ".app/Contents/Frameworks"?
I think you must copy whatever is mentioned in the
"Referenced from: /Users/denis/C++/…"
line must be copied.
The magic part is changing the reference to the new location inside the bundle. That is explained in the linked article.
The libraries are 2:
I think that the program finds correctly the library but qwt.framework wants qwtmathml.framework for run but does not find it.
See the error:
Dyld Error Message:
Library not loaded: qwt.framework/Versions/6/qwt
Referenced from: /Users/USER/*/DomusBossClient.app/Contents/MacOS/../Frameworks/qwtmathml.framework/Versions/6/qwtmathml
Reason: image not found
You can use either of the following methods:
a) Instruct the OS where to find the lib
Set DYLD_FRAMEWORK_PATH in your environment. (Equivalent to Linux's LD_LIBRARY_PATH.) Mac OS X's fallback mechanism makes it looks for frameworks in paths specified by this env var.
Positive: You don't need to mangle with the compiled executable.
Negative: You need to set this on every environment. What's worse, this variable overwrites ALL application's framework finding mechanism, thus causing potential bugs.
Suitable for: Testing. Especially when using an IDE, in which case you can set it in the run setting once and for all without affecting system environment. For example, you can do "this":http://d.pr/i/JM9E in Qt Creator.
b) Use "otool":http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/otool.1.html
Using otool, you can modify the lookup table for a particular application. If you find this tool inconvenient (it is), "macdeployqt":http://qt-project.org/doc/qt-4.8/deployment-mac.html might be useful.
Positive: Does not pollute system environment
Negative: Need extra work every time after the application is built
Suitable for: Deployment. You don't do this very often, and you can't control your users' running environment.
c) "Static build":http://qt-project.org/doc/qt-4.8/deployment-mac.html#static-linking
If you build everything statically, there won't any lookups! Yay!!
Positive: No extra steps needed
Negative: You need some knowledge to do that. And if you do, you may find this option not so intriguing. (see note)
Suitable for: People who care building a static version of Qt (and all related frameworks).
(Note: Qwt, unlike Qt itself, does not require the author to provide the source even if you use static linking. Therefore, you can work around the licensing issue by statically linking only to Qwt. This can be done, but is certainly not a simple task.)
Thanks for reply. I think that the program wants the libraries in /usr/local/lib but I want to include them in .app