Installing Qt4 on Mac OS X
From QtCentreWiki
| This article needs a review. |
Intel note: small application don't need Intel build. Apple Rosetta is an emulator, that rebuilds small applications to make them run on Intel processors.
- download latest XCode 2.4 xcode_2.4_8k1079_6936199.dmg compiler from Apple Developer Connection site (you will have to register),
- install the base Xcode and all SDK you need Intel PPC or Older Mac OSX version Panther 10.3.9,
- download Qt4 from Trolltech download site and save the qt-mac-opensource-src-4.x.x.tar.gz (where 4.x.x stands for the version number of Qt bundle downloaded) file to /Developer (a new directory visible in Finder after installation of XCode),
- extract all of the files from the archive,
- open a terminal (/Applications/Utilities/Terminal.app) and run:
./configure -prefix /Developer/qt -qt-zlib -qt-libpng -qt-libjpeg -universal -sdk /Developer/SDKs/MacOSX10.4u.sdk make
- If you want to build static libraries run:
./configure -prefix /Developer/qt -qt-zlib -qt-libpng -qt-libjpeg -universal -sdk /Developer/SDKs/MacOSX10.4u.sdk -static -release make sub-src
- Note that this will build static libraries only in release mode, if you need static libraries with debugging symbols leave out -release and make sure you have at least 50 GB of free disk space.
- take a big break (2–5 hours in case of a static build), since compilation will take a while,
- and finally install Qt with:
sudo make install
After you have installed Qt4, you have to edit your .profile file to be able to use Qt4 tools. It should look like this:
# # Your previous .profile (if any) is saved as .profile.dpsaved # Setting the path for DarwinPorts. export PATH=/opt/local/bin:/opt/local/sbin:$PATH export PATH=/Developer/qt/bin:$PATH export QTDIR=/Developer/qt export QMAKESPEC=macx-g++
Now you can compile Qt4 applications. In /Developer/Applications directory you can find some utilities to create Mac icons or installers. You can generate Xcode project file with:
qmake -spec macx-xcode *name*.pro
To configure Xcode to build universal binaries see Macentwicklerwiki article (in German).
Tips to build universal and QT plugin
Open your profile file ( ~/.profile ) and insert the flag to tell, all future Makefile your plan.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH #### comment out here if you have static or not to swich! ####PATH=/opt/qt4static/bin:$PATH export PATH=/opt/qt/bin:$PATH export QTDIR=/opt/qt export QMAKESPEC=macx-g++ export LDFLAGS="-lz" export CC=gcc export CFLAGS="-arch ppc -arch i386 -g -Os -fno-omit-frame-pointer -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" export CPPFLAGS="" export CXX=gcc export CXXFLAGS="-arch ppc -arch i386 -g -Os -fno-omit-frame-pointer -fno-exceptions -fno-rtti -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
Use the tool port install from http://trac.macosforge.org/projects/macports/wiki/InstallingMacPorts to install external libs like xslt2 , curl, and other.
After you can install external lib:
# sample # port install libxslt
Now the result libs you can use to build universal. note you can append other flag arch ppc64 x86_64 ( Xeon processor and google all correct flag.)
Build Mysql QT plugin
As user from your mac get the last mysql server source only source ( ready package are compiled ppc or intel! ), from http://dev.mysql.com/downloads/ . Open file tar -zxvf mysql* and begin configure.
./configure --prefix=/usr/local/mysql2arch \ --with-extra-charsets=complex --enable-local-infile \ --disable-shared --disable-dependency-tracking \ --enable-thread-safe-client --enable-largefile \ --with-innodb --with-berkeley-db --with-big-tables \ --with-unix-socket-path=/tmp/mysql.sock --with-ndb-shm \ --with-ndb-port --with-ndb-port-base --with-comment --with-gnu-ld make sudo make install
Note i use --prefix=/usr/local/mysql2arch why i have other mysql server on board at other location to not mixed... at end i can remove recursive /usr/local/mysql2arch
Now the qt mysql plugin
cd $QTDIR/src/plugins/sqldrivers/mysql qmake -o Makefile "INCLUDEPATH+=/usr/local/mysql2arch/include/mysql" "LIBS+=-L/usr/local/mysql2arch/lib/mysql -lmysqlclient_r" mysql.pro
Check and test if /opt/qt/demos/sqlbrowser have QMYSQL driver ... to become confirm.
Tested on qt version
| This article or section needs a rewrite. |
The static build i found all version can build static and universal only all qt version 4.3 having trouble on exeption and stop build..
- qt-mac-opensource-src-4.1.5.tar.gz Used XCode 2.2 on a simple PPC Mini Mac Panther PPC G4 256 MB ram
- qt-mac-opensource-src-4.2.2.tar.gz Used XCode 2.2 on a simple PPC Mini Mac Tiger PPC G4 256 MB ram
- qt-mac-opensource-src-4.4.0-snapshot-20070608.tar.bz2 latest used XCode 2.4 xcode_2.4_8k1079_6936199.dmg on a simple PPC Mini Mac Tiger PPC G4 256 MB ram
Time to build 4-5 Hours
If you configure and build -static -universal -release only and make is only make sub-src (only needed lib + static plugin) at end make a symslink from path /usr/local/Trolltech ln -s /Developer/qt /usr/local/Trolltech/Qt-4.4.0-snapshot-20070608
on my install all point to /Developer/qt so i can rename dir ../qt and work on static or shared
Qt 4.4 on Mac Leopard with Xcode 3.1
To install and build Qt 4.4 the fast way, you can use qt4-mac port.
patrik08 01:09, 5 Agosto 2008 (CEST)
PS: Thanks to people who correct the grammar.


