Skip to content

Commit

Permalink
fix bd916b1
Browse files Browse the repository at this point in the history
  • Loading branch information
kyngchaos committed Apr 5, 2012
1 parent bd916b1 commit 2a126af
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1,731 deletions.
196 changes: 100 additions & 96 deletions INSTALL
@@ -1,10 +1,10 @@
Quantum GIS (QGIS)
Building QGIS from source - step by step
Monday February 06, 2012
Wednesday April 04, 2012


Last Updated: Monday February 06, 2012
Last Change : Wednesday February 01, 2012
Last Updated: Wednesday April 04, 2012
Last Change : Monday December 26, 2011


1. Introduction
Expand All @@ -24,12 +24,13 @@ Last Change : Wednesday February 01, 2012
4.2. Building using MinGW
4.3. Creation of MSYS environment for compilation of Quantum GIS
5. Building on MacOS X
5.1. Install Qt4 from disk image
5.2. Install development frameworks for QGIS dependencies
5.3. Install CMake for OSX
5.4. QGIS source
5.5. Configure the build
5.6. Building
5.1. Install Developer Tools
5.2. Install Qt4 from disk image
5.3. Install development frameworks for QGIS dependencies
5.4. Install CMake for OSX
5.5. QGIS source
5.6. Configure the build
5.7. Building
6. Authors and Acknowledgments


Expand Down Expand Up @@ -1148,9 +1149,12 @@ of space and it's not necessary at all.
In this approach I will try to avoid as much as possible building dependencies
from source and rather use frameworks wherever possible.

The base system here is Mac OS X 10.4 (Tiger), with a single architecture
build. Included are notes for building on Mac OS X 10.5 (Leopard), 10.6
The base system here is Mac OS X 10.4 (Tiger), with a single, default,
architecture build. "Universal", SDK and non-default arch builds require
more complex options and some fiddling with the system.
Included are notes for building on Mac OS X 10.5 (Leopard), 10.6
(Snow Leopard) and 10.7 (Lion).
(These names will be used throughout the instructions.)
Make sure to read each section completely before typing the first command you see.

General note on Terminal usage: When I say "cd" to a folder in a Terminal,
Expand All @@ -1175,12 +1179,36 @@ ie: Mac Pro "8 Core" model (2 quad core processors) = 8
ie: Macbook Pro i5 (hyperthreading) = 2 cores X 2 = 4


5.1. Install Qt4 from disk image
5.1. Install Developer Tools
============================

Developer tools are not a part of a standard OS X installation. Up through
Snow Leopard, the Developer Tools, later called Xcode, were included with the
system install disks, though it's best to download the latest version compatible
with your system to get important updates fixing various issues.
Starting with Lion, Xcode is available as a download and from the App Store.
BUT, there is really no need for the full Xcode on Lion, and in fact could be
tricky to use for compiling QGIS.

Downloading Xcode/Developer Tools requires a free developer account at
developer.apple.com. Up through Snow Leopard, get the latest Xcode that is
supported for your system. For Lion, all you need is the much smaller
Command Line Tools for Xcode (you don't get the IDE or system SDKs but they are not
necessary for QGIS). When installing Xcode up through Snow Leopard, make sure to
do a custom install and install the Unix Development or Command Line Tools option.

On Lion, if you have installed Xcode 4.0 - 4.2 and are upgrading to 4.3, it's
a good idea to uninstall the old version first with:

sudo /Developer/Library/uninstall-devtools


5.2. Install Qt4 from disk image
================================

You need a minimum of Qt-4.4.0. I suggest getting the latest. There is no need
for the full Qt SDK, so save yourself some download time and get the frameworks
only.
only. This is available in the Libraries section of the Qt download page.

Snow Leopard+ note: If you are building on Snow Leopard+, you will need to
decide between 32-bit support in the older Qt Carbon branch, or 64-bit
Expand All @@ -1198,30 +1226,33 @@ http://qt.nokia.com/downloads
If you want debug frameworks, Qt also provides a separate download with these.
These are in addition to the non-debug frameworks.

Earlier OS X systems may need an old Qt version - check the requirements of the
current Qt version. To get old Qt downloads, there is an FTP link at the bottom
of the download page. Files are in the qt/source (yes, even the binary packages).

Once downloaded open the disk image and run the installer. Note you need admin
privileges to install.

Qt note: Starting in Qt 4.4, libQtCLucene was added, and in 4.5
libQtUiTools was added, both in /usr/lib. When using a system SDK
these libraries will not be found. To fix this problem,
Leopard note: Qt includes a couple non-framework libraries in /usr/lib.
When using a system SDK these libraries will not be found. To fix this problem,
add symlinks to /usr/local:

sudo ln -s /usr/lib/libQtUiTools.a /usr/local/lib/
sudo ln -s /usr/lib/libQtCLucene.dylib /usr/local/lib/

These should then be found automatically on Leopard and above. Earlier systems
These should then be found automatically. Earlier systems
may need some help by adding '-L/usr/local/lib' to CMAKE_SHARED_LINKER_FLAGS,
CMAKE_MODULE_LINKER_FLAGS and CMAKE_EXE_LINKER_FLAGS in the cmake build.


5.2. Install development frameworks for QGIS dependencies
5.3. Install development frameworks for QGIS dependencies
=========================================================

Download William Kyngesburye's excellent GDAL Complete package that includes
PROJ, GEOS, GDAL, SQLite3, Spatialite, and image libraries, as frameworks.
There is also a GSL framework.

http://www.kyngchaos.com/software/frameworks
http://www.kyngchaos.com/wiki/software/frameworks

Once downloaded, open and install the frameworks.

Expand All @@ -1230,14 +1261,17 @@ support). QGIS just needs the libpq client library, so unless you want to
setup the full Postgres + PostGIS server, all you need is the client-only
package. It's available here:

http://www.kyngchaos.com/software/postgres
http://www.kyngchaos.com/wiki/software/postgres

Also available is a GRASS application:

http://www.kyngchaos.com/software/grass
http://www.kyngchaos.com/wiki/software/grass

Old versions of these packages for older systems are available in the
software archive section.


5.2.1. Additional Dependencies: General compatibility note
5.3.1. Additional Dependencies: General compatibility note
==========================================================

There are some additional dependencies that, at the time of writing, are not
Expand All @@ -1252,7 +1286,7 @@ Stable release versions are preferred. Beta and other development versions may
have problems and you are on your own with those.


5.2.2. Additional Dependencies: Expat
5.3.2. Additional Dependencies: Expat
=====================================

Snow Leopard+ note: Snow Leopard includes a usable expat, so this step is
Expand All @@ -1270,15 +1304,15 @@ source folder and:
sudo make install


5.2.3. Additional Dependencies: Python
5.3.3. Additional Dependencies: Python
======================================

Leopard+ note: Starting with Leopard a usable Python is included
in the system. This Python 2.5, 2.6 and 2.7, respectively for Leo, Snow and Lion.
So there is no need to install Python on Leopard and newer.
You can still install Python from python.org if preferred.

If installing from python.org, make sure you install at least the latest Python
If installing from python.org, make sure you install the latest Python
2.x from

http://www.python.org/download/
Expand All @@ -1287,7 +1321,7 @@ Python 3 is a major change, and may have compatibility issues, so try it at
your own risk.


5.2.4. Additional Dependencies: SIP
5.3.4. Additional Dependencies: SIP
===================================

Retrieve the python bindings toolkit SIP from
Expand All @@ -1311,7 +1345,7 @@ More configuration is needed to install outside the system path:
python configure.py -n -d /Library/Python/2.5/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip -s MacOSX10.5.sdk

Snow Leopard+ system Python
Snow Leopard system Python

Similar to Leopard, you should install outside the system Python path.
Also, you need to specify the architecture you want (requires at least SIP
Expand All @@ -1329,6 +1363,15 @@ For 64-bit Qt (Qt Cocoa), use this configure line:
python2.6 configure.py -n -d /Library/Python/2.6/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.6.sdk

Lion system Python

Similar to Snow Leopard, you should install outside the system Python path.
There is no need for the SDK option (the CLI tools for Lion don't inlcude SDKs)
or arch option:

python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip

continue...

Then continue with compilation and installation:
Expand All @@ -1337,7 +1380,7 @@ Then continue with compilation and installation:
sudo make install


5.2.5. Additional Dependencies: PyQt
5.3.5. Additional Dependencies: PyQt
====================================

Retrieve the python bindings toolkit for Qt from
Expand All @@ -1359,7 +1402,7 @@ More configuration is needed to install outside the system path:

python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin

Snow Leopard+ system Python
Snow Leopard system Python

Similar to Leopard, you should install outside the system Python path.
Also, you need to specify the architecture you want (requires at least PyQt 4.6),
Expand All @@ -1375,16 +1418,14 @@ For 64-bit Qt (Qt Cocoa), use this configure line:

python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch x86_64

continue...
Snow Leopard system Python

There is a problem with the configuration that needs to be fixed now
(it affects PyQwt compilation later). Edit pyqtconfig.py and change the qt_dir
line to:
Similar to Snow Leopard, you should install outside the system Python path.
But you don't need the arch option:

'qt_dir': '/usr',
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin

Then continue with compilation and installation (this is a good place to use
parallel compilation, if you can):
continue...

make
sudo make install
Expand All @@ -1394,58 +1435,33 @@ QtOpenGL/makefile and add -undefined dynamic_lookup to LFLAGS.
Then make again.


5.2.6. Additional Dependencies: Qwt/PyQwt
=========================================

The GPS tracking feature uses Qwt. Some popular 3rd-party plugins use PyQwt.
You can take care of both with the PyQwt source from:
5.3.6. Additional Dependencies: Qwt
===================================

http://pyqwt.sourceforge.net/
The GPS tracking feature uses Qwt.

Double-click the tarball to unpack it. The following assumes PyQwt v5.2.0
(comes with Qwt 5.2.1). Normal compilation does both Qwt and PyQwt at the same
time, but Qwt is statically linked into PyQwt, and QGIS can't use it. So, we
need to split the build.
NOTE: PyQwt is not compatible with PyQt 4.9, so we will skip that.

Now, cd into the qwt-5.2 subdir in a Terminal. Type these commands to build
and install:
Download the latest Qwt 5.x source (6.x is untested) from:

cat >> qwtconfig.pri <<EOF
CONFIG += release QwtDll
EOF
qmake -spec macx-g++
make
sudo make install
sudo install_name_tool -id /usr/local/qwt-5.2.1-svn/lib/libqwt.5.dylib \
/usr/local/qwt-5.2.1-svn/lib/libqwt.5.dylib
http://sourceforge.net/projects/qwt

The Qwt shared library is now installed in /usr/local/qwt-5.x.x[-svn] (x.x is
the minor.point version, and it may be an SVN version). Remember this for
QGIS and PyQwt configuration.
Double-click the tarball to unpack it.

Now for PyQwt. Still in the Terminal (for all Pythons, except see Snow Leopard
Carbon note below):
Now, cd to the qwt source folder in a Terminal. Type these commands to build
and install (assumes v5.2.2, adjust commands for other version as needed):

cd ../configure
python configure.py --extra-include-dirs=/usr/local/qwt-5.2.1-svn/include \
--extra-lib-dirs=/usr/local/qwt-5.2.1-svn/lib --extra-libs=qwt
qmake -spec macx-g++
make
sudo make install
sudo install_name_tool -id /usr/local/qwt-5.2.2/lib/libqwt.5.dylib \
/usr/local/qwt-5.2.2/lib/libqwt.5.dylib

Make sure to use the qwt install path from the Qwt build above.

Snow Leopard+ note
The Qwt shared library is now installed in /usr/local/qwt-5.x.x (x.x is
the minor.point version). Remember this for QGIS configuration.

If using Qt Carbon, you need to specify which architectures to build, otherwise
it will default to a combination that does not work (ie x86_64 for a Carbon Qt).
This is not needed for Qt Cocoa. Configure as follows:

python configure.py --extra-cflags="-arch i386" --extra-cxxflags="-arch i386" \
--extra-lflags="-arch i386" --extra-include-dirs=/usr/local/qwt-5.2.1-svn/include \
--extra-lib-dirs=/usr/local/qwt-5.2.1-svn/lib --extra-libs=qwt


5.2.7. Additional Dependencies: Bison
5.3.7. Additional Dependencies: Bison
=====================================

The version of bison available by default on Mac OS X is too old so you
Expand All @@ -1461,7 +1477,7 @@ tarball to unpack it, then cd to the source folder and:
sudo make install


5.3. Install CMake for OSX
5.4. Install CMake for OSX
==========================

Get the latest source release from here:
Expand All @@ -1479,7 +1495,7 @@ Double-click the source tarball, then cd to the source folder and:
sudo make install


5.4. QGIS source
5.5. QGIS source
================

Unzip the QGIS source tarball to a working folder of your choice
Expand All @@ -1498,7 +1514,7 @@ select Download .tar.gz.
Double-click the tarball to unzip it.


5.5. Configure the build
5.6. Configure the build
========================

CMake supports out of source build so we will create a 'build' dir for the
Expand All @@ -1513,26 +1529,14 @@ In a Terminal cd to the qgis source folder previously downloaded, then:
cmake -D CMAKE_INSTALL_PREFIX=~/Applications \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D WITH_INTERNAL_SPATIALITE=FALSE \
-D QWT_LIBRARY=/usr/local/qwt-5.2.1-svn/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.1-svn/include \
-D QWT_LIBRARY=/usr/local/qwt-5.2.2/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.2/include \
-D BISON_EXECUTABLE=/usr/local/bin/bison \
..

This will automatically find and use the previously installed frameworks, and
the GRASS application if installed.

Or, to use a Unix-style build of GRASS, use the following cmake invocation
(minimum GRASS version as stated in the QGIS requirements, substitute the GRASS
path and version as required):

cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D WITH_INTERNAL_SPATIALITE=FALSE \
-D QWT_LIBRARY=/usr/local/qwt-5.2.1-svn/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.1-svn/include \
-D GRASS_PREFIX=/user/local/grass-6.4.1 \
-D BISON_EXECUTABLE=/usr/local/bin/bison \
..
the GRASS application if installed. Remember to change the Qwt version if a
different version was compiled.

Snow Leopard note: To handle 32-bit Qt (Carbon), create a 32bit python wrapper
script and add arch flags to the configuration:
Expand Down Expand Up @@ -1580,7 +1584,7 @@ non-standard, libs (ie postgres' libpq) bump the bundle number to 2:
-D QGIS_MACAPP_BUNDLE=2 \


5.6. Building
5.7. Building
=============

Now we can start the build process (remember the parallel compilation note at
Expand Down

0 comments on commit 2a126af

Please sign in to comment.