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:
  1. #!/bin/sh
  2. # Copyright 2006 David Johnson
  3. # The author grants unlimited permission to
  4. # copy, distribute and modify this script
  5.  
  6. # APPNAME=MyApp
  7.  
  8. ### get system configuration ########################################
  9.  
  10. # as long as we can find qmake, we don't need QTDIR
  11. FWPATH=`qmake -query QT_INSTALL_LIBS`
  12. if [ ! -d $FWPATH/QtGui.framework ] ; then
  13. echo "ERROR: cannot find the Qt frameworks. Make sure Qt is installed"
  14. echo "and qmake is in your environment path."
  15. exit
  16. fi
  17.  
  18. ### get required user input #########################################
  19.  
  20. if [ -z $APPNAME ] ; then
  21. echo
  22. echo "This script prepares a Qt application bundle for deployment. It will"
  23. echo "copy over the required Qt frameworks and sets the installation"
  24. echo "identifications. Please see the \"Deploying an Application on Qt/Mac\""
  25. echo "page in the Qt documentation for more information."
  26. echo
  27. echo "This script assumes you have already built the application bundle."
  28. echo
  29. echo -n "What is the name of the application? "
  30. read userinput
  31. APPNAME=$userinput
  32. fi
  33.  
  34. BUNDLE=$APPNAME.app
  35.  
  36. if [ ! -d $BUNDLE ] ; then
  37. echo "ERROR: cannot find application bundle \"$BUNDLE\" in current directory"
  38. exit
  39. fi
  40.  
  41. if [ ! -x $BUNDLE/Contents/MacOS/$APPNAME ] ; then
  42. echo "ERROR: cannot find application in bundle. Did you forget to run make?"
  43. exit
  44. fi
  45.  
  46. echo "application: $APPNAME"
  47. echo "bundle: $BUNDLE"
  48.  
  49. ### query binary for frameworks #####################################
  50.  
  51. for n in `otool -L $BUNDLE/Contents/MacOS/$APPNAME | grep Qt` ; do
  52. path=`echo $n | grep Qt`
  53. if [ $path ] ; then
  54. name=`basename $path`
  55. FRAMEWORKS="$FRAMEWORKS $name"
  56. # sanity check
  57. if [ "$path" != "$FWPATH/$name.framework/Versions/4/$name" ] ; then
  58. echo "ERROR: problem with framework paths. Perhaps this script " \
  59. "has already been run?"
  60. exit
  61. fi
  62. fi
  63. done
  64.  
  65. echo -n "Using frameworks"
  66. for n in $FRAMEWORKS ; do
  67. echo -n " $n"
  68. done
  69. echo
  70.  
  71. ### make install ####################################################
  72.  
  73. # assumes install target populates the application bundle
  74. echo "Running make install"
  75. if [ -e Makefile.Release ] ; then
  76. make -f Makefile.Release install
  77. else
  78. make install
  79. fi
  80. strip $BUNDLE/Contents/MacOS/$APPNAME
  81.  
  82. ### copy over frameworks ############################################
  83.  
  84. mkdir -p $BUNDLE/Contents/Frameworks
  85. for framework in $FRAMEWORKS ; do
  86. if [ ! -d $FWPATH/$framework.framework ] ; then
  87. echo "ERROR: cannot find $FWPATH/$framework.framework"
  88. exit
  89. fi
  90. echo "Copying $framework framework"
  91. cp -fR $FWPATH/$framework.framework $BUNDLE/Contents/Frameworks
  92. # strip libs (-x is max allowable for shared libs)
  93. strip -x $BUNDLE/Contents/Frameworks/$framework.framework/Versions/4/$framework
  94. done
  95.  
  96. # remove unwanted parts
  97. find $BUNDLE/Contents/Frameworks | egrep "debug|Headers" | xargs rm -rf
  98.  
  99. ### set the identification names for frameworks #####################
  100.  
  101. echo -n "Setting framework IDs..."
  102.  
  103. for framework in $FRAMEWORKS ; do
  104. echo -n " $framework"
  105. install_name_tool \
  106. -id @executable_path/../Frameworks/$framework.framework/Versions/4/$framework \
  107. $BUNDLE/Contents/Frameworks/$framework.framework/Versions/4/$framework
  108. done
  109. echo
  110.  
  111. ### change framework location #######################################
  112.  
  113. echo -n "Changing framework paths..."
  114. for framework in $FRAMEWORKS ; do
  115. echo -n " $framework"
  116. install_name_tool \
  117. -change $FWPATH/$framework.framework/Versions/4/$framework \
  118. @executable_path/../Frameworks/$framework.framework/Versions/4/$framework \
  119. $BUNDLE/Contents/MacOS/$APPNAME
  120. done
  121. echo
  122.  
  123. ### change location for bundled frameworks #########################
  124.  
  125. echo -n "Fixing bundled frameworks..."
  126. for framework in $FRAMEWORKS ; do
  127. echo -n " $framework"
  128. fwdeps=""
  129. bundledfw="$BUNDLE/Contents/Frameworks/$framework.framework/Versions/4/$framework"
  130. # get framework dependencies
  131. for n in `otool -LX $bundledfw | grep Qt` ; do
  132. path=`echo $n | grep Qt`
  133. if [ $path ] ; then
  134. name=`basename $path`
  135. fwdeps="$fwdeps $name"
  136. fi
  137. done
  138. # fix dependency location
  139. for dep in $fwdeps ; do
  140. if [ "$dep" != "$framework" ] ; then
  141. install_name_tool \
  142. -change $FWPATH/$dep.framework/Versions/4/$dep \
  143. @executable_path/../Frameworks/$dep.framework/Versions/4/$dep \
  144. $bundledfw
  145. fi
  146. done
  147. done
  148. echo
  149.  
  150. ### create disk image ###############################################
  151.  
  152. echo "Creating disk image"
  153. imagedir="/tmp/$APPNAME.$$"
  154. mkdir $imagedir
  155. cp -R $BUNDLE $imagedir
  156.  
  157. # TODO: copy over additional files, if any
  158. hdiutil create -ov -srcfolder $imagedir -format UDBZ -volname "$APPNAME" "$APPNAME.dmg"
  159. rm -rf $imagedir
  160.  
  161. 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.