Results 1 to 2 of 2

Thread: Application deployment on Mac OS X (10.5)

  1. #1
    Join Date
    Nov 2006
    Location
    Dresden, Germany
    Posts
    95
    Thanks
    9
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Application deployment on Mac OS X (10.5)

    Hi everyone,

    I succeeded in building my application (with two shared libs, one of them QWT) into a framework using Qt Creator on my Mac (Mac OS X 10.5)

    When running the macdeployqt tool I get two warning messages that the tool cannot find my dylib files, but apart from that the Framework is created ok.
    (There seems to be a bug in the script though, because if I don't create the directory myapp.app/Contents/translations first, the script will just copy the system translation file into this file, but not into the directory).

    So far so good. Now I copy my own dylib files into the Frameworks directory and create the library links manually as described in the Qt Deployment documentation. This allows me to run the application, but during startup I get the information that multiple libraries are found and the ones in the Frameworks directory are used. Ok. But then the app crashes ("QWidget: Must construct a QApplication before a QPaintDevice").

    The strange thing is that when I remove the Qt-Framework packages from the Frameworks directory, the application runs fine - this time using the qt libraries in the system path.

    What am I doing wrong? Or is this generally a problem that you cannot run Qt apps with Qt Frameworks in the bundle when you have Qt Development tools also installed?

    Thanks for any help. Also, is there a flag or trick how I can get macdeployqt to find my own dylib files and put them into the Framework automatically?

    --- Detailed information on the Deployment procedure ---
    1. After building my application I find the following file and directory structure:
    Qt Code:
    1. $ ls -R RoomModel.app
    2. Contents
    3.  
    4. RoomModel.app/Contents:
    5. Info.plist MacOS PkgInfo Resources
    6.  
    7. RoomModel.app/Contents/MacOS:
    8. RoomModel
    9.  
    10. RoomModel.app/Contents/Resources:
    11. empty.lproj
    To copy to clipboard, switch view to plain text mode 

    2. Running otool gives
    Qt Code:
    1. $ otool -L RoomModel.app/Contents/MacOS/RoomModel
    2. RoomModel.app/Contents/MacOS/RoomModel:
    3. libRoomModel.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    4. libqwt.5.dylib (compatibility version 5.2.0, current version 5.2.1)
    5. QtSvg.framework/Versions/4/QtSvg (compatibility version 4.5.0, current version 4.5.2)
    6. QtGui.framework/Versions/4/QtGui (compatibility version 4.5.0, current version 4.5.2)
    7. /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 136.0.0)
    8. /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 949.54.0)
    9. QtCore.framework/Versions/4/QtCore (compatibility version 4.5.0, current version 4.5.2)
    10. /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
    11. /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
    12. /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
    13. /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    To copy to clipboard, switch view to plain text mode 

    3. Now I need to create the translations subdir manually
    Qt Code:
    1. $ mkdir RoomModel.app/Contents/translations
    To copy to clipboard, switch view to plain text mode 

    4. I run macdeployqt
    Qt Code:
    1. $ macdeployqt RoomModel.app -no-plugins
    2. ERROR: no file at "/usr/lib/libRoomModel.1.dylib"
    3. ERROR: no file at "/usr/lib/libqwt.5.dylib"
    4. copied "/Library/Frameworks/QtSvg.framework/Versions/4/QtSvg" to "RoomModel.app/Contents/Frameworks/QtSvg.framework/Versions/4/QtSvg"
    5. stripped "RoomModel.app/Contents/Frameworks/QtSvg.framework/Versions/4/QtSvg"
    6. copied "/Library/Frameworks/QtGui.framework/Versions/4/QtGui" to "RoomModel.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui"
    7. copied "/Library/Frameworks/QtGui.framework/Resources/qt_menu.nib/classes.nib" to "RoomModel.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/classes.nib"
    8. copied "/Library/Frameworks/QtGui.framework/Resources/qt_menu.nib/info.nib" to "RoomModel.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/info.nib"
    9. copied "/Library/Frameworks/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib" to "RoomModel.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib"
    10. stripped "RoomModel.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui"
    11. copied "/Library/Frameworks/QtCore.framework/Versions/4/QtCore" to "RoomModel.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore"
    12. stripped "RoomModel.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore"
    To copy to clipboard, switch view to plain text mode 

    How can I tell macdeployqt where my dylib files are?

    5. when running the app now, I get:
    Qt Code:
    1. $ RoomModel.app/Contents/MacOS/RoomModel
    2. dyld: Library not loaded: @executable_path/../Frameworks/libRoomModel.1.dylib
    3. Referenced from: /Users/xxx/Documents/room_model/bin/RoomModel.app/Contents/MacOS/RoomModel
    4. Reason: image not found
    5. Trace/BPT trap
    To copy to clipboard, switch view to plain text mode 

    so I copy the dynamic libraries into the Frameworks directory.

    Qt Code:
    1. $ cp ../src/libs/libRoomModel.1.dylib RoomModel.app/Contents/Frameworks/
    2. $ cp ../externals/qwt/lib/libqwt.5.dylib RoomModel.app/Contents/Frameworks/
    To copy to clipboard, switch view to plain text mode 

    6. Running otool again:
    Qt Code:
    1. @executable_path/../Frameworks/libRoomModel.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    2. @executable_path/../Frameworks/libqwt.5.dylib (compatibility version 5.2.0, current version 5.2.1)
    3. @executable_path/../Frameworks/QtSvg.framework/Versions/4/QtSvg (compatibility version 4.5.0, current version 4.5.2)
    4. @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.5.0, current version 4.5.2)
    5. /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 136.0.0)
    6. /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 949.54.0)
    7. @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.5.0, current version 4.5.2)
    8. /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
    9. /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
    10. /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
    11. /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    To copy to clipboard, switch view to plain text mode 
    All custom libraries are linked in the Frameworks directory, as it should be.

    7. Now running should work:
    Qt Code:
    1. $ RoomModel.app/Contents/MacOS/RoomModel
    2. objc[4049]: Class QCocoaColorPanelDelegate is implemented in both /Library/Frameworks/QtGui.framework/Versions/4/QtGui and
    3. /Users/xxx/Documents/room_model/bin/RoomModel.app/Contents/MacOS/../Frameworks/QtGui.framework/Versions/4/QtGui.
    4. Using implementation from /Users/xxx/Documents/room_model/bin/RoomModel.app/Contents/MacOS/../Frameworks/QtGui.framework/Versions/4/QtGui.
    5. (... many more of these double implementations)
    6. QWidget: Must construct a QApplication before a QPaintDevice
    7. Abort trap
    To copy to clipboard, switch view to plain text mode 
    I can't seem to find the problem with the QWidget and the QPaintDevice.

    8. Manually deleting the Qt frameworks from the bundle
    Qt Code:
    1. $ rm -r RoomModel.app/Contents/Frameworks/QtCore.framework/
    2. $ rm -r RoomModel.app/Contents/Frameworks/QtGui.framework/
    3. $ rm -r RoomModel.app/Contents/Frameworks/QtSvg.framework/
    To copy to clipboard, switch view to plain text mode 

    running: now it runs perfectly inside the bundle.

    What is the problem with the frameworks here???
    --- End Detailed information on the Deployment procedure ---
    Last edited by ghorwin; 26th August 2009 at 09:56. Reason: Added more details
    Andreas

  2. The following user says thank you to ghorwin for this useful post:

    Hodapp87 (11th March 2010)

  3. #2
    Join Date
    Mar 2010
    Posts
    3
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Application deployment on Mac OS X (10.5)

    Quote Originally Posted by ghorwin View Post
    8. Manually deleting the Qt frameworks from the bundle
    Qt Code:
    1. $ rm -r RoomModel.app/Contents/Frameworks/QtCore.framework/
    2. $ rm -r RoomModel.app/Contents/Frameworks/QtGui.framework/
    3. $ rm -r RoomModel.app/Contents/Frameworks/QtSvg.framework/
    To copy to clipboard, switch view to plain text mode 
    running: now it runs perfectly inside the bundle.

    What is the problem with the frameworks here???
    --- End Detailed information on the Deployment procedure ---
    I was receiving the same "QWidget: Must construct a QApplication before a QPaintDevice" error on an application which ran okay in Windows, but not in OS X - although on Windows it was in Visual Studio while on OS X it was in Qt Creator, so certainly the build steps differed a little. Most of the messages I read pertained to making sure that the libraries and program were both compiled in debug mode, or both in release mode, but my error persisted regardless of what way I built the program.

    Your commands at step (8) fixed my problem as well. I wish I could understand why.

Similar Threads

  1. Application deployment with assistant as help viewer
    By jml in forum Installation and Deployment
    Replies: 18
    Last Post: 5th January 2009, 21:42
  2. Qt 4.1.3 application Deployment
    By sivaganesan in forum Installation and Deployment
    Replies: 1
    Last Post: 24th July 2008, 17:15
  3. qt application deployment issue?
    By vishal.chauhan in forum Installation and Deployment
    Replies: 0
    Last Post: 1st May 2007, 06:09
  4. Application deployment problem
    By shapirlex in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 13th April 2007, 00:11
  5. Deployment of Application to freescale board
    By AP.Sakkthivel in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 26th April 2006, 04:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.