Build on Mac OS X 10.8 for targets >= 10.6 (Snow Leopard)
I want to build my Qt application on Mac OS X 10.8. However, I want my application to run on Mac OS X 10.6 (Snow Leopard) or higher. My .pro file contains the lines
@QMAKE_CXXFLAGS_X86_64 += -mmacosx-version-min=10.6
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6@
However, my application only runs on 10.8 and not on 10.6, where it crashes immediately (I haven't tried 10.7 yet).
I'm using macdeployqt to create an application bundle, but I do get an error (although the .dmg is built):
@ERROR: "install_name_tool: changing install names or rpaths can't be redone for: sigviewer.app/Contents/Frameworks//libtiff.5.dylib (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)
ERROR: "install_name_tool: changing install names or rpaths can't be redone for: sigviewer.app/Contents/Frameworks//libtiff.5.dylib (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)
I'd appreciate any hints on how to build my app for 10.6. The source code is available at: http://sourceforge.net/projects/sigviewer/files/0.5.2/sigviewer-0.5.2-src.tar.gz/download
To build the app, you need to extract the following file into the source tree:
It looks like you use an additional library (libtiff.5.dylib) in your project. Your executable and the library itself need an install name so that the dynamic linker can find the library at program startup time.
If the library is not present on the 10.6 system but for sure is on your development system, program start will fail on 10.6 and succeed on 10.8.
macdeployqt starts the commandline tool install_name_tool to change the information inside the library but there is not enough space to fill in the complete information (AKA path). Therefore you must recompile the library with -headerpad or -headerpad_max_install_names. If you got the sources...
So you think this might be the reason why my program is not starting on 10.6? I always thought that Qt shipped this library, because I never added it to my project. I'm not even sure why it is needed. I don't think that I can recompile it either -- I would prefer to find out why it is linked in the first place. Is there a way how I can find out? I'm totally confused...
Hm, maybe it's even part of Qt, if you didn't add it in your .PRO file.
You can look with otool on wich libraries your executable depends.
For this specific one: look it up in the filesystem. That could show to whom it belongs.
Interestingly, this lib is nowhere to be seen in the output of otool -L:
@% otool -L bin/release/sigviewer.app/Contents/MacOS/sigviewer
/opt/local/Library/Frameworks/QtXml.framework/Versions/4/QtXml (compatibility version 4.8.0, current version 4.8.4)
/opt/local/Library/Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.4)
/opt/local/Library/Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.4)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)@
The lib is located in /opt/local/lib, therefore it is part of my MacPorts tree (provided by the tiff package). The qt4-mac package depends on tiff.
So your Qt package is also from MacPorts? I'm just asking because of the /opt/local/ path and the dependency to the library from MacPorts.
Any chance to use an official pre-compiled package or to compile it on your own?
Yes, I'm using the Qt package from MacPorts. I'll try to build my app with the official binary package and see if that works. If yes, this is likely a bug in the MacPorts package. I'll keep you updated.
OK, everything's fine with the official version. Will write a bug report for this port right now...
Please check this "link":http://qt-project.org/wiki/Qt500KnownIssues.
If you want to deploy your Qt5 application on Mac OS X 10.6 you'll have to build Qt5 yourself on Snow Leopard.