http://doc.trolltech.com/latest/deployment-mac.html
Anyway that's not the issue here. There is something wrong with your code.
http://doc.trolltech.com/latest/deployment-mac.html
Anyway that's not the issue here. There is something wrong with your code.
I really don't see anything wrong with it. Will it definitely have the word static in it? The code is way too large to post up here, so I guess I'll just keep looking. I don't understand why it works with the absolute paths to the libraries, but not with the relative paths.
One thing I noticed that this script does that seems strange is in the results of
otool -L
before the script
Qt Code:
/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.0) /Library/Frameworks/3DconnexionClient.framework/Versions/A/3DconnexionClient (compatibility version 1.0.0, current version 1.0.0) /usr/local/Trolltech/Qt-4.3.0beta/lib/QtXml.framework/Versions/4/QtXml (compatibility version 4.3.0, current version 4.3.0) /usr/local/Trolltech/Qt-4.3.0beta/lib/QtOpenGL.framework/Versions/4/QtOpenGL (compatibility version 4.3.0, current version 4.3.0) /System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime (compatibility version 1.0.0, current version 12.0.0) /usr/local/Trolltech/Qt-4.3.0beta/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.3.0, current version 4.3.0) /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 824.42.0) /usr/local/Trolltech/Qt-4.3.0beta/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.3.0, current version 4.3.0) /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.6) /usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 22.0.0) /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 7.4.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)To copy to clipboard, switch view to plain text mode
after the script
Qt Code:
/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.0) /Library/Frameworks/3DconnexionClient.framework/Versions/A/3DconnexionClient (compatibility version 1.0.0, current version 1.0.0) @executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml (compatibility version 4.3.0, current version 4.3.0) @executable_path/../Frameworks/QtOpenGL.framework/Versions/4/QtOpenGL (compatibility version 4.3.0, current version 4.3.0) /System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime (compatibility version 1.0.0, current version 12.0.0) @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.3.0, current version 4.3.0) /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 824.42.0) @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.3.0, current version 4.3.0) /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.6) /usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 22.0.0) /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 7.4.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)To copy to clipboard, switch view to plain text mode
saying @executable_path seems wrong, but I don't really know enough about it to know whether that's right or not.
No, the object doesn't have to be static. It's enough if it's global. Maybe your Qt installation is somehow broken?
it's 4.3 beta, but 4.2.3 had other errors that I couldn't figure out, and I found this post that said someone fixed the same errors I was having by upgrading to 4.3beta, so I did, and it fixed those errors, but gave me new ones.
oh joy. i really appreciate all your help. Changing my app to Qt from fltk has been a rollercoaster ride so far. thanks again,
dave
Try running your script on a dummy application and see if the problem persists. If so, this could mean a somehow invalid Qt installation or a problem with the script. But if it works, then surely the problem lies within your code.
I just tried on an example app , the 2dpainting opengl sample, and it did the same error. that's good to know. Now I just need to find a better script. Perhaps it's the order of the frameworks that I'm including that is the problem. I figured QtCore would need to be first...
I will try a different script. Thanks for your help,
dave
The script might be fine. If it's in the wiki then I assume it works for someone. The problem may lie in cooperation between the script and your Qt compilation.
I found a different version of a script that does essentially the same thing, but it's a little more robust, and it works perfectly. Here it is:
Qt Code:
#!/bin/sh # Copyright 2006 David Johnson # The author grants unlimited permission to # copy, distribute and modify this script # APPNAME=MyApp ### get system configuration ######################################## # as long as we can find qmake, we don't need QTDIR FWPATH=`qmake -query QT_INSTALL_LIBS` if [ ! -d $FWPATH/QtGui.framework ] ; then echo "ERROR: cannot find the Qt frameworks. Make sure Qt is installed" echo "and qmake is in your environment path." exit fi ### get required user input ######################################### if [ -z $APPNAME ] ; then echo echo "This script prepares a Qt application bundle for deployment. It will" echo "copy over the required Qt frameworks and sets the installation" echo "identifications. Please see the \"Deploying an Application on Qt/Mac\"" echo "page in the Qt documentation for more information." echo echo "This script assumes you have already built the application bundle." echo echo -n "What is the name of the application? " read userinput APPNAME=$userinput fi BUNDLE=$APPNAME.app if [ ! -d $BUNDLE ] ; then echo "ERROR: cannot find application bundle \"$BUNDLE\" in current directory" exit fi if [ ! -x $BUNDLE/Contents/MacOS/$APPNAME ] ; then echo "ERROR: cannot find application in bundle. Did you forget to run make?" exit fi echo "application: $APPNAME" echo "bundle: $BUNDLE" ### query binary for frameworks ##################################### for n in `otool -L $BUNDLE/Contents/MacOS/$APPNAME | grep Qt` ; do path=`echo $n | grep Qt` if [ $path ] ; then name=`basename $path` FRAMEWORKS="$FRAMEWORKS $name" # sanity check if [ "$path" != "$FWPATH/$name.framework/Versions/4/$name" ] ; then echo "ERROR: problem with framework paths. Perhaps this script " \ "has already been run?" exit fi fi done echo -n "Using frameworks" for n in $FRAMEWORKS ; do echo -n " $n" done echo ### make install #################################################### # assumes install target populates the application bundle echo "Running make install" if [ -e Makefile.Release ] ; then make -f Makefile.Release install else make install fi strip $BUNDLE/Contents/MacOS/$APPNAME ### copy over frameworks ############################################ mkdir -p $BUNDLE/Contents/Frameworks for framework in $FRAMEWORKS ; do if [ ! -d $FWPATH/$framework.framework ] ; then echo "ERROR: cannot find $FWPATH/$framework.framework" exit fi echo "Copying $framework framework" cp -fR $FWPATH/$framework.framework $BUNDLE/Contents/Frameworks # strip libs (-x is max allowable for shared libs) strip -x $BUNDLE/Contents/Frameworks/$framework.framework/Versions/4/$framework done # remove unwanted parts find $BUNDLE/Contents/Frameworks | egrep "debug|Headers" | xargs rm -rf ### set the identification names for frameworks ##################### echo -n "Setting framework IDs..." for framework in $FRAMEWORKS ; do echo -n " $framework" install_name_tool \ -id @executable_path/../Frameworks/$framework.framework/Versions/4/$framework \ $BUNDLE/Contents/Frameworks/$framework.framework/Versions/4/$framework done echo ### change framework location ####################################### echo -n "Changing framework paths..." for framework in $FRAMEWORKS ; do echo -n " $framework" install_name_tool \ -change $FWPATH/$framework.framework/Versions/4/$framework \ @executable_path/../Frameworks/$framework.framework/Versions/4/$framework \ $BUNDLE/Contents/MacOS/$APPNAME done echo ### change location for bundled frameworks ######################### echo -n "Fixing bundled frameworks..." for framework in $FRAMEWORKS ; do echo -n " $framework" fwdeps="" bundledfw="$BUNDLE/Contents/Frameworks/$framework.framework/Versions/4/$framework" # get framework dependencies for n in `otool -LX $bundledfw | grep Qt` ; do path=`echo $n | grep Qt` if [ $path ] ; then name=`basename $path` fwdeps="$fwdeps $name" fi done # fix dependency location for dep in $fwdeps ; do if [ "$dep" != "$framework" ] ; then install_name_tool \ -change $FWPATH/$dep.framework/Versions/4/$dep \ @executable_path/../Frameworks/$dep.framework/Versions/4/$dep \ $bundledfw fi done done echo ### create disk image ############################################### echo "Creating disk image" imagedir="/tmp/$APPNAME.$$" mkdir $imagedir cp -R $BUNDLE $imagedir # TODO: copy over additional files, if any hdiutil create -ov -srcfolder $imagedir -format UDBZ -volname "$APPNAME" "$APPNAME.dmg" rm -rf $imagedir echo "Done"To copy to clipboard, switch view to plain text mode
i believe my problem with the other script was the order of the list of Qt Frameworks to embed. I always put QtCore first, and this script it written to search for the dependencies and include them in that order, and QtCore seems to come up last, and QtXml first. I won't bother trying the other one again, because this one is a better script all around anyways.
Bookmarks