qt-interest@trolltech.com
[Top] [All Lists]

Re: OS X Deployment - Frameworks

Subject: Re: OS X Deployment - Frameworks
From: "Benjamin Sergeant"
Date: Fri, 10 Aug 2007 08:53:17 -0700
On 8/10/07, Kamil Klimek <naresh@xxxxxxx> wrote:
> Copy frameworks with -R instead of -r. If you use -r then you copy
> framework contents like 3 or 4 times (it will be bigger), instead of
> copying only symlinks...
>

... good to know :)
Maybe the dmg size will be less impressive !



> On Aug 10, 2007, at 3:09 AM, Benjamin Sergeant wrote:
>
> > Here is what I use (also create the dmg) to ease the install tool pain
> > (works for an OpenGL app) :)
> >
> > # Pre-requisites: QT is built as a framework
> > # Use otool -L <bin|lib> like ldd
> > #
> > # References: QAssistant "deploying on Mac OSX"
> > # http://developer.apple.com/documentation/DeveloperTools/
> > Conceptual/SoftwareDistribution/index.html
> >
> > myapp=foobarbaz
> >
> > make
> > rm $myapp.app/Contents/MacOS/$myapp
> >
> > qtprefix=/usr/local/Trolltech/Qt-4.2.3
> > appframeworkDir=$myapp.app/Contents/Frameworks
> > app=$myapp.app/Contents/MacOs/$myapp
> >
> > for lib in QtCore QtGui QtOpenGL
> > do
> >   continue
> >   # copy qt framework
> >   # FIXME: check that the copy method is correct
> >   cp -rp $qtprefix/lib/$lib.framework $appframeworkDir
> >
> >   # change id
> >   install_name_tool -id \
> >         @executable_path/../Frameworks/$lib.framework/Versions/4/
> > QtCore \
> >         $appframeworkDir/$lib.framework/Versions/4/$lib
> >
> >   # change lib path in the exec
> >   install_name_tool -change \
> >         $qtprefix/lib/$lib.framework/Versions/4/$lib \
> >         @executable_path/../Frameworks/$lib.framework/Versions/4/
> > $lib \
> >         $app
> > done
> >
> > # Change reference to QtCore
> > for lib in QtGui QtOpenGL
> > do
> >         install_name_tool -change
> > $qtprefix/lib/QtCore.framework/Versions/4/QtCore \
> >
> > @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \
> >                 $appframeworkDir/$lib.framework/Versions/4/$lib
> > done
> >
> > # Change reference to QtGui
> > lib=QtOpenGL
> > install_name_tool -change $qtprefix/lib/QtGui.framework/Versions/4/
> > QtGui \
> >
> > @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui \
> >                 $appframeworkDir/$lib.framework/Versions/4/$lib
> >
> > # Copy your personal libs here with the same method...
> >
> > # Finally, create the dmg
> > rm -f $myapp.dmg
> > hdiutil create -fs HFS+ -srcfolder $myapp.app -volname "App Name in
> > Finder" $myapp
> >
> >
> > Benjamin.
> >
> >
> > On 8/9/07, Willy P <willy.lists@xxxxxxxxx> wrote:
> >> Kamil,
> >> It worked.  Thank you, thank you, thank you.
> >>
> >> There are a number of differences between what I was doing and what
> >> you wrote.  The most significant of which was:
> >>
> >> cd ./myApp.app/Contents/Frameworks/
> >>
> >> before the last batch of install_name_tooling
> >>
> >> I know this sounds stupid but I was running those install_name_tool's
> >> from the build dir.
> >>
> >> When you have no idea what's going on it's nice to get line by line
> >> instructions.  Now I see what install_name_tool is trying to do...
> >>
> >> Thanks agian...
> >>
> >> -Willy
> >>
> >>
> >> On 8/9/07, Kamil Klimek <naresh@xxxxxxx> wrote:
> >>>
> >>> Well, you didn't change your executable with install_name_tool.
> >>> Everytime you recompile it you need to run:
> >>>
> >>> install_name_tool -change QtGui.framework/Versions/4/QtGui
> >>> @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui
> >>> myApp.app/Contents/MacOS/myApp
> >>> install_name_tool -change QtCore.framework/Versions/4/QtCore
> >>> @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore
> >>> myApp.app/Contents/MacOS/myApp
> >>>
> >>> Also you have to prepare your Qt frameworks to work with your
> >>> bundle:
> >>>
> >>> cp -Rf /path/to/your/Qt/copy/QtGui.framework ./myApp.app/Contents/
> >>> Frameworks/
> >>> cp -Rf /path/to/your/Qt/copy/QtCore.framework ./myApp.app/Contents/
> >>> Frameworks/
> >>> cd ./myApp.app/Contents/Frameworks/
> >>> install_name_tool -change QtCore.framework/Versions/4/QtCore
> >>> @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore ./
> >>> QtGui.framework/QtGui
> >>> install_name_tool -id @executable_path/../Frameworks/
> >>> QtCore.framework/
> >>> Versions/4/QtCore ./QtCore.framework/QtCore
> >>> install_name_tool -id @executable_path/../Frameworks/
> >>> QtGui.framewrok/
> >>> Versions/4/QtGui ./QtGui.framework/QtGui
> >>>
> >>> note that you have to copy frameworks with -R switch instead of -
> >>> r. -
> >>> R copies symbolic links, and with -r you copy file pointed by link.
> >>>
> >>>> Also here is the result of my otool:  It seems that no matter
> >>>> what I
> >>>> do with the install_name_tool the results of otool are always the
> >>>> same.  Not sure if that's good or bad.
> >>>>
> >>>> otool -L myApp.app/Contents/MacOS/myApp
> >>>> myApp.app/Contents/MacOS/myApp:
> >>>>         QtGui.framework/Versions/4/QtGui (compatibility version
> >>>> 4.2.0,
> >>>> current version 4.2.2)
> >>>>         /System/Library/Frameworks/Carbon.framework/Versions/A/
> >>>> Carbon
> >>>> (compatibility version 2.0.0, current version 128.0.0)
> >>>>         /System/Library/Frameworks/QuickTime.framework/Versions/A/
> >>>> QuickTime
> >>>> (compatibility version 1.0.0, current version 240.0.0)
> >>>>         /System/Library/Frameworks/AppKit.framework/Versions/C/
> >>>> AppKit
> >>>> (compatibility version 45.0.0, current version 824.42.0)
> >>>>         QtCore.framework/Versions/4/QtCore (compatibility version
> >>>> 4.2.0, current version 4.2.2)
> >>>>         /usr/lib/libz.1.dylib (compatibility version 1.0.0, current
> >>>> version 1.2.3)
> >>>>         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
> >>>> current version 88.3.9)
> >>>>         /usr/lib/libiconv.2.dylib (compatibility version 5.0.0,
> >>>> current version 5.0.0)
> >>>>         /System/Library/Frameworks/ApplicationServices.framework/
> >>>> Versions/A/ApplicationServices
> >>>> (compatibility version 1.0.0, current version 22.0.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)
> >>>>
> >>>> On 8/9/07, Willy P <willy.lists@xxxxxxxxx> wrote:
> >>>>> pelle$ myApp.app/Contents/MacOS/myApp
> >>>>>
> >>>>> dyld: Library not loaded: QtGui.framework/Versions/4/QtGui
> >>>>>   Referenced from: /Users/pelle/myApp/myApp.app/Contents/MacOS/
> >>>>> myApp
> >>>>>   Reason: image not found
> >>>>> Trace/BPT trap
> >>>>>
> >>>>>
> >>>>> On 8/9/07, Kamil Klimek <naresh@xxxxxxx> wrote:
> >>>>>> Please run your application from terminal like this:
> >>>>>>
> >>>>>> cd ~/myApp
> >>>>>> ./myApp.app/Contents/MacOS/myApp
> >>>>>>
> >>>>>> There "should" be some usefull output.
> >>>>>>
> >>>>>>
> >>>>>> On Aug 9, 2007, at 10:25 AM, Willy P wrote:
> >>>>>>
> >>>>>>> Hey,
> >>>>>>> I am trying to deploy a dynamically linked app on OS X.  I have
> >>>>>>> read
> >>>>>>> the docs < http://doc.trolltech.com/4.2/deployment-mac.html >
> >>>>>>> multiple
> >>>>>>> times and have created the simplest possible case and it doesn't
> >>>>>>> work.
> >>>>>>>  I am going to be extra explicit b/c I have followed the
> >>>>>>> directions
> >>>>>>> multiple times and I must be misinterpreting them or not making
> >>>>>>> some
> >>>>>>> assumption that they are making.
> >>>>>>>
> >>>>>>> Here goes:
> >>>>>>>
> >>>>>>> cd ~
> >>>>>>> mkdir myApp
> >>>>>>> cd myApp
> >>>>>>> touch main.cpp
> >>>>>>>
> >>>>>>> main.cpp looks like this:
> >>>>>>>
> >>>>>>> #include <QApplication>
> >>>>>>> #include <QtGui>
> >>>>>>>
> >>>>>>> int main( int argc, char** argv )
> >>>>>>> {
> >>>>>>>         QApplication app( argc, argv );
> >>>>>>>         QLabel label( "Hello Qt" );
> >>>>>>>         label.show();
> >>>>>>>         return app.exec();
> >>>>>>> }
> >>>>>>>
> >>>>>>> qmake -project
> >>>>>>> qmake -spec macx-g++ -config release
> >>>>>>> make
> >>>>>>>
> >>>>>>> ## my app works fine ##
> >>>>>>>
> >>>>>>> mkdir myApp.app/Contents/Frameworks
> >>>>>>> cp -R /Library/Frameworks/QtCore.framework myApp.app/Contents/
> >>>>>>> Frameworks
> >>>>>>> cp -R /Library/Frameworks/QtGui.framework myApp.app/Contents/
> >>>>>>> Frameworks
> >>>>>>>
> >>>>>>> #install_name_tool fun
> >>>>>>>
> >>>>>>> install_name_tool -id
> >>>>>>> @executable_path/../Frameworks/QtCore.framework/Versions/4.0/
> >>>>>>> QtCore
> >>>>>>> myApp.app/Contents/Frameworks/QtCore.framework/Versions/4.0/
> >>>>>>> QtCore
> >>>>>>>
> >>>>>>> install_name_tool -id
> >>>>>>> @executable_path/../Frameworks/QtGui.framework/Versions/4.0/
> >>>>>>> QtGui
> >>>>>>> myApp.app/Contents/Frameworks/QtCore.framework/Versions/4.0/
> >>>>>>> QtGui
> >>>>>>>
> >>>>>>> install_name_tool -change
> >>>>>>> /Library/Frameworks/QtCore.framework/Versions/4.0/QtCore
> >>>>>>> @executable_path/../Frameworks/QtCore.framework/Versions/4.0/
> >>>>>>> QtCore
> >>>>>>> myApp.app/Contents/MacOS/myApp
> >>>>>>>
> >>>>>>> install_name_tool -change
> >>>>>>> /Library/Frameworks/QtGui.framework/Versions/4.0/QtGui
> >>>>>>> @executable_path/../Frameworks/QtGui.framework/Versions/4.0/
> >>>>>>> QtGui
> >>>>>>> myApp.app/Contents/MacOS/myApp
> >>>>>>>
> >>>>>>> install_name_tool -change
> >>>>>>> /Library/Frameworks/QtCore.framework/Versions/4.0/QtCore
> >>>>>>> @executable_path/../Frameworks/QtCore.framework/Versions/4.0/
> >>>>>>> QtCore
> >>>>>>> myApp.app/Contents/Frameworks/QtGui.framework/Versions/4.0/QtGui
> >>>>>>>
> >>>>>>> cd /Library/Frameworks
> >>>>>>> mkdir hide
> >>>>>>> copy all the Qt frameworks into the "hide" directory so
> >>>>>>> myApp.app has
> >>>>>>>
> >>>>>>> Run myApp.app.
> >>>>>>>
> >>>>>>> It opens and closes quickly.
> >>>>>>>
> >>>>>>> I don't know what's going wrong and I don't even know how to
> >>>>>>> tell
> >>>>>>> what's going wrong.
> >>>>>>>
> >>>>>>> Help me qt user list.  You're my only hope.
> >>>>>>>
> >>>>>>> Thanks in advance...
> >>>>>>>
> >>>>>>> -Willy
> >>>>>>>
> >>>>>>> --
> >>>>>>> To unsubscribe - send a mail to qt-interest-
> >>>>>>> request@xxxxxxxxxxxxx
> >>>>>>> with "unsubscribe" in the subject or the body.
> >>>>>>> List archive and information: http://lists.trolltech.com/qt-
> >>>>>>> interest/
> >>>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> >>>>>> with "unsubscribe" in the subject or the body.
> >>>>>> List archive and information: http://lists.trolltech.com/qt-
> >>>>>> interest/
> >>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>> --
> >>>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> >>>> with "unsubscribe" in the subject or the body.
> >>>> List archive and information: http://lists.trolltech.com/qt-
> >>>> interest/
> >>>>
> >>>
> >>> --
> >>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> >>> with "unsubscribe" in the subject or the body.
> >>> List archive and information: http://lists.trolltech.com/qt-
> >>> interest/
> >>>
> >>>
> >>
> >> --
> >> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> >> with "unsubscribe" in the subject or the body.
> >> List archive and information: http://lists.trolltech.com/qt-interest/
> >>
> >>
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> > with "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
> >
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>