Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] Framework - Adding .framework to my .app
I have a few private .framework that I would like to bundle in my app
I have linked the framework in my .pro file this way :
#SFML INCLUDEPATH += /Users/tourlou2/Dropbox/SFML-2.2-osx-clang-universal/include QMAKE_LFLAGS += -F/Users/tourlou2/Dropbox/SFML-2.2-osx-clang-universal/Frameworks QMAKE_LFLAGS += -F/Users/tourlou2/Dropbox/SFML-2.2-osx-clang-universal/extlibs LIBS += -framework sfml-audio LIBS += -framework sfml-system LIBS += -framework freetype LIBS += -framework sndfile #OSX Libs LIBS += -framework IOKit LIBS += -framework CoreFoundation
That seems to work fine, but the frameworks don't get copied inside my myApp.app/Content/Framework/ when I run macdeployqt. (like normal Qt frameworks do) Is there a specific flag I should put if I want the .framework to get copied in my .app?
Thanks for any help, having a hard time creating the OSX bundle
Which version of Qt are you using ?
Hey SGaist, always using the greatest and latest (5.4.1)!
What I would like is an easy way to link my custom libs (.dylib or .framework) on OSX like on windows.
On windows, I just link the .lib and copy the lib into /release afterward.
But for OSX, It seems I need to have the lib installed on my system, which can get complicated when upgrading.
For example, I just upgraded my project from using SFML 2.1 to 2.2 and I don't like having to put custom lib inside /usr/lib, I would prefer a way that just rely on QMake and and lib linkings in my .pro so that the .dylib or .framework are copied inside the bundled .app and I don't need to install the libs on my dev system.
Will try a little bit more, just upgraded to OSX 10.10, running in VMware
Thanks for your help!
No you don't. On OS X you provide everything inside your application bundle (except of course system libraries). macdeployqt should find, copy and update your dependencies inside your application bundle.
Here is the list of dependency for my app:
The only one being copied correctly: qwt.framework
tourlou3s-Mac:MacOS tourlou3$ otool -L MaximumTrainer
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1153.18.0)
@rpath/libsfml-audio.2.3.dylib (compatibility version 2.3.0, current version 2.3.0)
@executable_path/../Frameworks/qwt.framework/Versions/6/qwt (compatibility version 6.1.0, current version 6.1.0)
@loader_path/lib/libvlc.5.dylib (compatibility version 11.0.0, current version 11.0.0)
@loader_path/lib/libvlccore.8.dylib (compatibility version 9.0.0, current version 9.0.0)
@loader_path/lib/liblzma.5.dylib (compatibility version 6.0.0, current version 6.3.0)
@executable_path/../Frameworks/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets (compatibility version 5.4.0, current version 5.4.1)
@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.4.0, current version 5.4.1)
@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.4.0, current version 5.4.1)
@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.4.0, current version 5.4.1)
/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
@executable_path/../Frameworks/QtWebKit.framework/Versions/5/QtWebKit (compatibility version 5.4.0, current version 5.4.1)
@executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.4.0, current version 5.4.1)
@executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.4.0, current version 5.4.1)
@executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.4.0, current version 5.4.1)
@executable_path/../Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent (compatibility version 5.4.0, current version 5.4.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/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
Shoud I assume the user to have libc++.1.dylib, libcrypto.0.9.8.dylib and libssl.0.9.8.dylib ?
I'm not sure what @rpath mean, I tried to copy the .dylib all over the place in the bundle without success.
Here is my .pro part for SFML libs
INCLUDEPATH += /Users/tourlou3/Dropbox/SFML-2.3-osx-clang-universal/include
LIBS += /Users/tourlou3/Dropbox/SFML-2.3-osx-clang-universal/lib/libsfml-audio.2.3.0.dylibsystem.2.2.0.dylib
To include a 3rd party library in the application bundle, copy the library into the bundle manually, after the bundle is created.
Really? no other way?
So I have to copy the .dylibs, change the linking with Otool manually?
This is a lot of work to do at each release
Having problem doing an "install_name_tool" on the library that is causing problem
tourlou3s-Mac:MacOS tourlou3$ install_name_tool -change /@rpath/libsfml-audio.2.3.dylib @executable_path/../Frameworks/libsfml-audio.2.3.dylib
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input
How are you calling macdeployqt ?
Yes finally I rolled back to SFML 2.1, since 2.2 they use @rpath and this seem to be causing the problem.
I was not able to use "install_name_tool" to change the @rpath to @executable_path/../Frameworks. Probably me not knowing how to use install_name_tool correctly
install_name_tool -change @rpath/libsfml-audio.2.3.dylib @executable_path/../Frameworks/libsfmlaudio.2.3.dylib path/to/your/executable/in/bundle/name_of_your_executable_or_library
Thanks this command worked, will save it for later.
SFML 2.3 relies on a bunch of external frameworks (5) compared to (1) for 2.1 so I'll stick to 2.1. Using all theses install_name_tool commands for each deployment is killing me! Windows deployment is much easier..
You can write a script for such cases
Just wanted to say, I finally figured how to set RPATH when building the project.
This way it's much easier and no need for install_name_tool
#set RPATH (place to look for .dylib & framework by default) QMAKE_RPATHDIR += @executable_path/../Frameworks QMAKE_RPATHDIR += @executable_path/lib
Thank you for your help!