[CMake] Qt assistant in OsX application bundle

Clinton Stimpson clinton at elemtech.com
Wed Mar 3 09:50:54 EST 2010


This works for me:

Foo.app/
-Contents/
--plugins/
---sqldrivers
--Resources/
---qt.conf
--MacOS/
---Foo
---Assistant.app/
----Contents/
-----plugins/   symlink to ../../../plugins
----Resources
-----qt.conf

You can change the location of plugins to your liking if you specify it 
in qt.conf.
That also means you can do without symlinking plugins and tell the 
assistant's qt.conf to go up 3 more directories.

Clint

On 03/03/2010 07:20 AM, Michael Wild wrote:
> Hmm, that's strange... Looks like you're doing the things the right way...
>
> Have you tried making the Doc/Assistant.app/Contents/Plugins not a symlink, but a copy of Bundle.app/Contents/Plugins instead? Just for debugging... Moving the libqsqlite.dylib library into MacOS can't help because Qt is always searching for $PLUGINS_DIR/sqldrivers/libsqlite.dylib, where $PLUGINS_DIR is the directory where Qt looks for plugins.
>
> I understand your frustration, deploying stuff on Mac OS X is a PITA.
>
> Michael
>
> On 3. Mar, 2010, at 14:47 , Martin Guillon wrote:
>
>    
>> In fact it was not solved
>>
>> It works great on my dev machine. But as soon as I copy my app on a machine without qt framework I get an error "Cannot Load SQLite database driver!"
>>
>> So let me first show you my layout
>>
>> Bundl.app
>> --MacOS
>> --Resources
>> --Framework
>> -----QtCore...
>> -----QGui...
>> -----QtXml...
>> -----QtHelp...
>> -----QtSql...
>> --Plugins
>> ----imageformats
>> -------- .....
>> ----sqldrivers
>> ------libsqlite.dylib
>> --Doc
>> ----Assistant.app
>> ------Frameworks (link to ../../Frameworks)
>> ------Plugins (link to ../../Plugins)
>> ------ Exactly the same layout as the assistant from qt/bin
>>
>>
>> Now I now Assistant find the frameworks as I get another error related to that if I change anything related to the frameworks.
>> Now I have spent 3 days of the "Cannot Load SQLite database driver!" error and I cant find the solution.
>> I tried copying libsqlite.dylib in the MacOS folder, tried creating a empty/filled qt.conf in Bundle.app/Doc/Assistant.app/Resources.
>> Nothing works!
>>
>> I really need help
>> Thanks
>>
>> Martin
>>
>> -----Original Message-----
>> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Martin Guillon
>> Sent: Monday, March 01, 2010 4:18 PM
>> To: Michael Wild; Michael Jackson
>> Cc: cmake at cmake.org
>> Subject: Re: [CMake] Qt assistant in OsX application bundle
>>
>> Thanks a lot Michael, I found the solution in ParaView!!!
>>
>> Martin
>>
>> -----Original Message-----
>> From: Michael Wild [mailto:themiwi at gmail.com]
>> Sent: Monday, March 01, 2010 3:14 PM
>> To: Michael Jackson
>> Cc: Martin Guillon; cmake at cmake.org
>> Subject: Re: [CMake] Qt assistant in OsX application bundle
>>
>> But only the stable release, the CVS version doesn't anymore.
>>
>> Michael
>>
>> On 1. Mar, 2010, at 15:05 , Michael Jackson wrote:
>>
>>      
>>> I would take a look at the ParaView project as ParaView uses QtAssistant for help.
>>> _________________________________________________________
>>> Mike Jackson                  mike.jackson at bluequartz.net
>>> BlueQuartz Software                    www.bluequartz.net
>>> Principal Software Engineer                  Dayton, Ohio
>>>
>>> On Mar 1, 2010, at 7:52 AM, Martin Guillon wrote:
>>>
>>>        
>>>> Hi,
>>>>
>>>> After successfully creating my application bundle with qt frameworks(thanks to all of you) I am now trying to integrate the qt assistant in my application bundle.
>>>> I first tried to put the whole Assistant.app in a folder of my app bundle. But then fixing the bundle wouldn't work with the assistant because of the double level of bundle app.
>>>> Then I thought that should just put the Assistant executable in the MacOS folder of my bundle. Then the fixing worked but launching the Assistant wouldn't work. It would just crash with a bus error during start.
>>>>
>>>> So did anyone successfully integrated the qt assistant in its app bundle?
>>>>
>>>> Thanks a lot
>>>>
>>>> Martin
>>>>
>>>> -----Original Message-----
>>>> From: Michael Wild [mailto:themiwi at gmail.com]
>>>> Sent: Thursday, February 25, 2010 9:36 AM
>>>> To: Martin Guillon
>>>> Cc: Werner Smekal; cmake at cmake.org
>>>> Subject: Re: [CMake] OsX bundle including Qt framework
>>>>
>>>> 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
>>>>>            
>>>> _______________________________________________
>>>> 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
>>      
> _______________________________________________
> 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