PDA

View Full Version : Deploy Qt application on Mac OS X



giandrea77
10th February 2009, 15:46
Hi!

I'm trying to deploy my application. I've followed the instruction in http://doc.trolltech.com/4.4/mac-differences.html and with otool I can see this:



Heisenberg:~/Documents/Works/Project/G-Squared/remote_xreport/bin andrea$ otool -L xreport.app/Contents/MacOS/xreport
xreport.app/Contents/MacOS/xreport:
QtScript.framework/Versions/4/QtScript (compatibility version 4.4.0, current version 4.4.3)
QtSvg.framework/Versions/4/QtSvg (compatibility version 4.4.0, current version 4.4.3)

but when I try to start this is the error:


Dyld Error Message:
Library not loaded: QtScript.framework/Versions/4/QtScript
Referenced from: /Volumes/andrea/Documents/Works/Project/G-Squared/remote_xreport/bin/xreport.app/Contents/MacOS/xreport
Reason: image not found

I've tried with install_name_tool and this is the result!
Dyld Error Message:
Library not loaded: @executable_path/../Frameworks/QtScript/Version/4/QtScript

why????? I don't understand......

This is the otool -L QtScript output

xreport.app/Contents/Frameworks/QtScript.framework/Versions/4/QtScript:

@executable_path/../Frameworks/QtScript.framework/Version/4/QtScript (compatibility version 4.4.0, current version 4.4.3)
@executable_path/../Frameworks/QtCore/Version/4/QtCore (compatibility version 4.4.0, current version 4.4.3)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.11)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 22.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

ayoy
10th February 2009, 16:25
Hey,

I assume that you want to have dynamically linked libraries in your bundle on purpose. If not, consider compiling statically linked Qt libraries and compile your app using them. You'll find more info on wiki - Building_static_applications.

Back to the topic. If you want to have QtScript and QtSvg added to your application, the proper way to do this using install_name_tool would be:

1. make Frameworks dir inside the bundle:


# cd /Volumes/andrea/Documents/Works/Project/G-Squared/remote_xreport/bin/xreport.app/Contents
# mkdir Frameworks

2. copy libraries to Frameworks dir:


# cp <full_path_to_QtScript_given_by_otool> Frameworks
# cp <full_path_to_QtSvg_given_by_otool> Frameworks

3. change library references for your app:


# install_name_tool -change <full_path_to_QtScript_given_by_otool> Frameworks/QtScript MacOS/xreport
# install_name_tool -change <full_path_to_QtSvg_given_by_otool> Frameworks/QtSvg MacOS/xreport

4. Check with otool if library references really changed - they definitely ought to.

This works perfectly for me. But I really prefer to build an app using statically linked Qt :)
Good luck!

giandrea77
11th February 2009, 07:59
Thanks,

I've to do the same for Firebird plugin?


There is a 3rd party software to build bundle application?

Andrea

ayoy
11th February 2009, 09:34
You should do this for every non-system library that your application links to.

For a deployment script take a look at this thread:

http://www.qtcentre.org/forum/f-qt-software-16/t-third-party-tool-for-deploy-qt-application-on-mac-6861.html