Testing Qt applications on Mac



  • Hi, another question on Mac systems...

    To develop for windows platforms I use a development machine and a fresh installed windows 7 and windows XP to test the applications. This is the way I think I can be sure that all the components for an application are included in the package. This is no expensive, because I work with virtual machines, so the computer (hardware) is always the same :)

    on Mac platform the things are different because I can't install a VM so I use a real mac book for mac development. But when I create the application, how can I be sure that all components are delivered in the package?

    As a matter of fact the question can be slightly different: when I have checked and tested on windows platform for all the needed components to delivery an application, can I use this as the right knowledge creating the same package components also on mac and linux?

    Is someone has already experienced this problem, be welcome for any - no expensive - solution.



  • On the Mac you have basically the same problems as on the other platforms: To be entirely sure, you must install the application on a different machine.

    The basic tasks are the same (delivering the plugins and the like). Fortunately you need not provide the C and C++ runtimes, as these are already installed on all OS X boxes. On the Mac, watch out for the special layout of the application bundle.

    What you can do:

    @
    cd /path/to/your/FancyApplication.app/Contents
    otool -L MacOS/FancyApplication.app

    for every framework in Frameworks do

    otool -L Frameworks/QtGui.framework/QtGui

    for every other lib in Frameworks do

    otool -L Frameworks/libtiff.dylib

    repeat for other binaries too (PlugIns, etc.)

    @

    Then carefully inspect the output of the otool calls. It lists the libs linked into the respectiv binary (app or lib or plugin). You must not have any references to the path of your Qt installation or other libs that you have installed yourself.

    This is an example output for QtGui (be aware that the list is repeated for every architecture that is in the universal binary):

    @
    $ otool -L Frameworks/QtGui.framework/QtGui
    Frameworks/QtGui.framework/QtGui (architecture i386):
    @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.7.0, current version 4.7.2)
    @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.7.0, current version 4.7.2)
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 824.48.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.11)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 18.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 368.35.0)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 22.0.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 567.42.0)
    Frameworks/QtGui.framework/QtGui (architecture ppc):
    @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.7.0, current version 4.7.2)
    @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.7.0, current version 4.7.2)
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 824.48.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.11)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 18.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 368.35.0)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 22.0.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 567.42.0)
    @

    All the libs you have installed yourself should be referenced by something like this:

    @
    @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui
    @

    If those prerequisites are met, you are a good step further.



  • As Mac is basically a unix environment, you might want to try:

    • install your development environment locally (not system wide) and try to install with another user
    • try to run your application in a chroot-ed environment

    Haven't tried any of these however.

    [EDIT: fixed list markup, Volker]



  • Chroot will not work, as you have no system libs then.



  • Thank you Volker, it sound a great explanation. I have no installed library by myself for now.

    I posted in a previous thread a problem that I am experiencing on Mac only about some things that seems not found by Qt when it starts. I am worried that this message (shown in a window at the startup of Qt-Creator) can impact with the application components present or not. Do you have any idea? here follows the list again:

    @@GLSLEditor
    Could not resolve dependency 'Core(2.1.81)'
    Could not resolve dependency 'TextEditor(2.1.81)'
    Could not resolve dependency 'ProjectExplorer(2.1.81)'

    Macros
    Could not resolve dependency 'Core(2.1.81)'
    Could not resolve dependency 'Locator(2.1.81)'
    Could not resolve dependency 'Find(2.1.81)'
    Could not resolve dependency 'TextEditor(2.1.81)'

    QmlJSTools
    Could not resolve dependency 'TextEditor(2.1.81)'
    Could not resolve dependency 'ProjectExplorer(2.1.81)'
    Could not resolve dependency 'Locator(2.1.81)'
    Could not resolve dependency 'CppTools(2.1.81)'@@



  • Just to be complete, florent, I tried in other cases (not Mac but Linux) and i had problems of missing components...



  • Alicemirror, I never came across those error messages (could be the different packages I use). What surprises me, is the strange version numbers (2.1.81) - these look like some alpha or beta release.

    I've split off the original post to a separate thread in the Tools forum, that's the place where those questions should be asked.



  • Thank you Volker, the problem depends on the installation source of Qt under windows. If you replay to the new post (I have seen) I replay


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.