[SOLVED] Deploying .app on mac OSX
-
Don't worry, "macdeployqt" is probably where it should be.
This is how I start it on my Mac:!http://www.tripleboot.org/wp-content/uploads/2014/03/InvokingMacDeployQt.png(launching macdeployqt)!(picture is from "my blog post":http://www.tripleboot.org/?p=138 )
[Update: ] Checked your .pro files a bit, this line sure look suspicious:
LIBS += /Users/tourlou2/Dropbox/libANT_LIB.aWhat happens if you comment it out?
(Because linking to libANT_LIB.a is possible way for you to get the "double runtime" into your app) -
Double Qt Syndrome
The double Qt syndrome comes from a dependency that has not yet been update to load the Qt bundled with your application. That can be one of your custom lib (but generally macdeployqt handles that) That can be one of your external library that has been copied but not updated. Have a look at libvlc, they also use Qt for their GUI.
Once macdeployqt has run, check the error message, it might get lost trying to copy all dependencies. Then have a look at the Frameworks and PlugIns folder content and run otool -L on them to see if they indeed refer only to the Qt libraries/other non system libraries in your bundle. You should also check all non system libraries to see it their paths are correctly pointing inside your bundle.
LIBS
When doing LIBS += -Lsome_path you tell the linker to look in some_path to find additional libraries, on OS X you also have -F for folder containing frameworks.
LIBS += -lmylibname tells the linker that you want to link to a given library. Depending on what library file it finds, it will link to the dynamic or static version.
Giving the full path to the static library tells the linker to link against that specific static library file, it can't be used for dynamic library.On a side note, you should only need to do QT += qwt if the installation went correctly.
-
Solved
Thank you both for your kind help!
Since macdeployqt was complaining all the time about qwt.framework not in /Library/Frameworks, I added it to it. Then when running macdeployqt after a fresh build, qwt.frameworks get copied automatically and that seem to have fixed the problem. I suspect macdeployqt fixed bad dependencies on the qwt.frameworks that were not pointing at the good Qt libs (double qt syndrome)SGaist,
I get the LIBS+= [some_path] but not sure about the -L meaning before it.
In my .pro, I added the all the libs with LIBS+= [pathlib/libname] "
When I run otool -L on my app I get "this as result":https://www.dropbox.com/s/t1dnnftcdb4ochc/otoolaftermacDeploy.png
Does this mean all the other libs I added in the .pro are only used for building the app and not actually running it? how does Qt knows which one is needed at runtime vs not needed? For example I added a static library "LIBS += /Users/tourlou2/Dropbox/libANT_LIB.a"
and this one is not listed when I run otool. I'm happy it's working but i'd like to understand why so not to bother you guys again :)Have a great day, i'll certainly have one!
-
-L is a switch that tells the linker that what follows is a path that it must look in to find libraries.
A static library won't be listed as dependency since all the code used from it is copied inside the application or library that links against it.
-
Ohh I get it now, that is why the licensing difference with static lib
One last thing, i've been reading "this guide":http://qt-project.org/doc/qt-4.8/deployment-mac.html but it doesn't mention where to put the translation file ".qm" on macOSX, on windows I just added them in the folder with the executable but it doesn't seem to work here.
last update :
the double dependency problem comes again when I run the app from inside QtCreator after running macdeployqt, once I ran it in qtCreator just one time, the package is spoiled and I have to rebuild/package againSo the solution I found for now is to debug/test the application in QtCreator, and when everything is ready I can use macdeployqt as as* last step* but to get back to developpement later I'll have to rebuild again and delete what macdeployqt as done
@Starting /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_2_1_clang_64bit-Release/PowerVelo2.app/Contents/MacOS/PowerVelo2...
objc[2737]: Class NotificationReceiver is implemented in both /Users/tourlou2/Qt/5.2.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets and /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_2_1_clang_64bit-Release/PowerVelo2.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets. One of the two will be used. Which one is undefined.
objc[2737]: Class QCocoaPageLayoutDelegate is implemented in both /Users/tourlou2/Qt/5.2.1/clang_64/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport and /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_2_1_clang_64bit-Release/PowerVelo2.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport. One of the two will be used. Which one is undefined.
objc[2737]: Class QCocoaPrintPanelDelegate is implemented in both /Users/tourlou2/Qt/5.2.1/clang_64/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport and /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_2_1_clang_64bit-Release/PowerVelo2.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport. One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7f95cbc09940) is not the object's thread (0x7f95cbc25050).
Cannot move to target thread (0x7f95cbc09940)On Mac OS X, you might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
This application failed to start because it could not find or load the Qt platform plugin "cocoa".@ -
Indeed, macdeployqt is only to be used once you are ready to distribute your application.
-
Yeah I learn this the hard way
Could be good if macdeployqt just created another folder in the build folder instead of touching the real executable, but i'm always asking too much :)as for the translation file for MacOSX, is there a preferred place to put them?
-
Since it's an OS X program, put them in the Resources folder
-
You're welcome !
That's also a good solution