[CMake] OsX bundle including Qt framework

Michael Wild themiwi at gmail.com
Thu Feb 25 03:35:31 EST 2010


I think this is because Qt by default loads some optional plugins and finds them in your Qt installation because they do not get copied into your application bundle automatically. Since the prefixes do not match, Qt is complaining... You can confirm this by setting the environment variables DYLD_PRINT_LIBRARIES or DYLD_PRINT_LIBRARIES_POST_LAUNCH to a non-empty string and then starting your application from the command line (i.e. /<path-to>/<application>.app/Contents/MacOS/<executable>, where you have to replace the parts in <>). Then watch for the library names that get loaded. Nothing should come from your Qt installation.

If this is the source for the error, try including an empty qt.conf file in your bundle (or as a resource) as described here: http://doc.trolltech.com/4.6/qt-conf.html

HTH

Michael


On 25. Feb, 2010, at 9:11 , Martin Guillon wrote:

> A little feedback on what s happening. After using the fixbundle  script, my app works great on a machine without QT installed. I loads the frameworks I put in the bundle perfectly. 
> But now I have a problem in my dev environment. After fixing the bundle, if I start my app, I get qt errors saying it finds multiple versions of qt, and then some of my executables wont start.
> That s not that bad in my dev environment but what if the user already have a qt somewhere? 
> 
> Is there a way to make so that my app only see the qt frameworks in the bundle?
> 
> Thanks
> 
> MArtin
> 
> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Martin Guillon
> Sent: Wednesday, February 24, 2010 4:05 PM
> To: Werner Smekal; cmake at cmake.org
> Subject: Re: [CMake] OsX bundle including Qt framework
> 
> Thanks a lot, it now works perfectly!!!!
> 
> MArtin
> 
> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Werner Smekal
> Sent: Wednesday, February 24, 2010 3:34 PM
> To: cmake at cmake.org
> Subject: Re: [CMake] OsX bundle including Qt framework
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi Martin,
> 
>> 
>> I use cmake to make an osx bundle of my qt application. During install 
>> I copy qt framework from my qt install dir to the Frameworks directory 
>> of my bundle.
> 
> This will be done automagically using the BundleUtilities module. E.g.
> in my project I do:
> 
> 	# fixup bundle, copy dynamic libraries into app bundle
> 	set(APPS "\${CMAKE_INSTALL_PREFIX}/${SESSA_BUNDLE_NAME}.app")  # paths to executables
> 	set(DIRS "${CMAKE_SOURCE_DIR}/local/Release/lib")   # directories to
> search for prerequisites
> 	INSTALL(CODE "
>  	include(BundleUtilities)
>   	fixup_bundle(\"${APPS}\"   \"\"   \"${DIRS}\")
>   	")
> 
> Look in the mailing list or in the net about BundleUtilities to get more information, or look in the module.
> 
>> 
>> The problem I have now is that when using "ostool -L " I see that my 
>> executable look for qt frameworks in a dir which is the absolute path 
>> to my qt install dir.
> 
> Reason is, that if you link to a library, the reference inside the
> *library* (use otool -L on that library) is used and set in the executable as well. You need at least to set the new reference
> (@executable_path/....) in the executable, so that it can find the libraries (if libraries depend on other libraries you need to change that as well). Use install_name_tool for that.
> 
> But everything is done by the BundleUtilities macro, so you don't need to mess around here.
> 
> HTH,
> Werner
> 
>> 
>> What I want is for my executable to look in the "Frameworks"
>> directory of my bundle.
>> 
>> 
>> 
>> Is there a way to do that directly during build using Cmake?
>> 
>> 
>> 
>> Thanks
>> 
>> 
>> 
>> MArtin
>> 
>> 
>> 
>> _______________________________________________ Powered by 
>> www.kitware.com
>> 
>> Visit other Kitware open-source projects at 
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>> 
>> Follow this link to subscribe/unsubscribe: 
>> http://www.cmake.org/mailman/listinfo/cmake
> 
> 
> - --
> Dr. Werner Smekal
> Institut fuer Angewandte Physik
> Technische Universitaet Wien
> Wiedner Hauptstr 8-10/134
> A-1040 Wien
> Austria
> DVR-Nr: 0005886
> 
> email: smekal at iap.tuwien.ac.at  (GPG: EDCAF4A79)
> web:   http://www.iap.tuwien.ac.at/~smekal
> phone: +43-(0)1-58801-13463 (office)
>       +43-(0)1-58801-13469 (laboratory)
> fax:   +43-(0)1-58801-13499
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iQEcBAEBAgAGBQJLhTjHAAoJEG1QQcXtyvSnRK0H/3NwjN7DB7IH339Szs0iqTMf
> 3ONaiP0IIjdzer2Ak4Ao3+Yl+vVksyGCaeB/goYEy5mBbLxLNHIjY71+pS2zNk4L
> 62tAolQZCJfRzxv9mQVZsX92wHw5DC1mtPnyqWl1DuQu4lrp+WVQlfareC25keI/
> 1TBndC7A74uTz9IZJWOkUZRUgK9uHD8MRWBL4ujYJw0ocghHYjbeSxySrAGBC/oG
> DRp8l6N3UfFzTRVE+FZUnBdKcMkSTQXTdzK6oBtszKwJxkCKbcI94lAOgYqA49kU
> TWcxwQEbYXoXXFzI1Qo5evG2NgjDmicHluXnSuNNMTkVGoxnJbECZcoi3d5dlJU=
> =TUd7
> -----END PGP SIGNATURE-----
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list