I have written a crossplatform Qt4/PyQt4/python application, namely MyGreatApp, whose last version requires the Phonon module. MyGreatApp runs just fine on my own machine under Mac OS X 10.6 Snow Leopard, and more generally on any mac where Qt4.4 happens to be installed. However, innocent machines miserably fail to load Phonon:
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
It seems obvious that some dependancies remain in the executable. Here's the included phonon stuff:
$ find . -name "*phonon*" -print
./Contents/Frameworks/phonon.framework
./Contents/Frameworks/phonon.framework/phonon
./Contents/Frameworks/phonon.framework/phonon.prl
./Contents/Frameworks/phonon.framework/Versions/4/phonon
./Contents/plugins/phonon_backend
./Contents/plugins/phonon_backend/libphonon_qt7.dylib
./Contents/Resources/lib/python2.5/lib-dynload/PyQt4/phonon.so
And here is the install_name_tool
commands I invoke after building the application:
PLUGINSREF = /usr/local/Trolltech/Qt-4.4.3/plugins
QTLIB = /usr/local/Trolltech/Qt-4.4.3/lib
PLUGINS = dist/MyGreatApp.app/Contents/plugins
RESOURCES = dist/MyGreatApp.app/Contents/Resources
PHONON = phonon.framework/Versions/4/phonon
QTCORE = QtCore.framework/Versions/4/QtCore
QTGUI = QtGui.framework/Versions/4/QtGui
echo "Installing plugins"
mkdir -p "$PLUGINS"/phonon_backend
cp $PLUGINSREF/phonon_backend/libphonon_qt7.dylib "$PLUGINS"/phonon_backend
install_name_tool -change $QTLIB/$PHONON @executable_path/../Frameworks/$PHONON "$PLUGINS"/phonon_backend/libphonon_qt7.dylib
install_name_tool -change $QTLIB/$QTCORE @executable_path/../Frameworks/$QTCORE "$PLUGINS"/phonon_backend/libphonon_qt7.dylib
install_name_tool -change $QTLIB/$QTGUI @executable_path/../Frameworks/$QTGUI "$PLUGINS"/phonon_backend/libphonon_qt7.dylib
echo "Adding Panther compatibility when building on Leopard"
install_name_tool -change /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore "$PLUGINS"/phonon_backend/libphonon_qt7.dylib
echo "Installing dynamic libraries"
install_name_tool -change $QTLIB/$PHONON @executable_path/../Resources/lib/$PHONON "$RESOURCES"/lib/python2.5/lib-dynload/PyQt4/phonon.so
install_name_tool -change $QTLIB/$QTCORE @executable_path/../Resources/lib/$QTCORE "$RESOURCES"/lib/python2.5/lib-dynload/PyQt4/phonon.so
install_name_tool -change $QTLIB/$QTGUI @executable_path/../Resources/lib/$QTGUI "$RESOURCES"/lib/python2.5/lib-dynload/PyQt4/phonon.so
Any idea on what goes wrong, or any hint to improve the diagnostic?