1
1
Quantum GIS (QGIS)
2
2
Building QGIS from source - step by step
3
- Sunday August 07 , 2011
3
+ Sunday November 06 , 2011
4
4
5
5
6
- Last Updated: Sunday August 07 , 2011
7
- Last Change : Tuesday June 28 , 2011
6
+ Last Updated: Sunday November 06 , 2011
7
+ Last Change : Sunday November 06 , 2011
8
8
9
9
10
10
1. Introduction
@@ -81,9 +81,9 @@ Following a summary of the required dependencies for building:
81
81
82
82
Required build tools:
83
83
84
- - CMake >= 2.6.0
84
+ - CMake >= 2.6.2
85
85
- Flex
86
- - Bison
86
+ - Bison >= 2.4
87
87
88
88
Required build deps:
89
89
@@ -321,10 +321,10 @@ Install them using dpkg. E.g.:
321
321
3.9. A practical case: Building QGIS and GRASS from source on Ubuntu with ECW and MrSID formats support
322
322
=======================================================================================================
323
323
324
- The following procedure has been tested on Ubuntu 8.04, 8.10 and 9.04 32bit. If you want
325
- to use different versions of the software (gdal, grass, qgis), just make the
326
- necessary adjustments to the following code. This guide assumes that you don't have
327
- installed any previous version of gdal, grass and qgis.
324
+ The following procedure has been tested on Ubuntu 8.04, 8.10 and 9.04 32bit. If
325
+ you want to use different versions of the software (gdal, grass, qgis), just
326
+ make the necessary adjustments to the following code. This guide assumes that
327
+ you don't have installed any previous version of gdal, grass and qgis.
328
328
329
329
330
330
3.9.1. Step 1: install base packages
@@ -344,7 +344,7 @@ Go to the ERDAS web site http://www.erdas.com/ and follow the links
344
344
then download the "'Image Compression SDK Source Code 3.3'" (you'll need to make a registration
345
345
and accept a license).
346
346
347
- Uncompress the arquive in a proper location (this guide assumes
347
+ Uncompress the archive in a proper location (this guide assumes
348
348
that all the downloaded source code will be placed in the user home)
349
349
and the enter the newly created folder
350
350
@@ -439,23 +439,32 @@ leave the folder
439
439
Before downloading and compile GRASS source code you need to install a few
440
440
other libraries and programs. We can do this through apt
441
441
442
- sudo apt-get install flex bison libreadline5-dev libncurses5-dev lesstif2-dev debhelper dpatch libtiff4-dev \
443
- tcl8.4-dev tk8.4-dev fftw-dev xlibmesa-gl-dev libfreetype6-dev autoconf2.13 autotools-dev \
444
- libgdal1-dev proj libjpeg62-dev libpng12-dev libpq-dev unixodbc-dev doxygen fakeroot cmake \
445
- python-dev python-qt4-common python-qt4-dev python-sip4 python2.5-dev sip4 libglew1.5-dev libxmu6 \
446
- libqt4-dev libgsl0-dev python-qt4 swig python-wxversion python-wxgtk2.8 libwxgtk2.8-0 libwxbase2.8-0 tcl8.4-dev \
447
- tk8.4-dev tk8.4 libfftw3-dev libfftw3-3
442
+ sudo apt-get install flex bison libreadline5-dev libncurses5-dev lesstif2-dev \
443
+ debhelper dpatch libtiff4-dev tcl8.4-dev tk8.4-dev fftw-dev xlibmesa-gl-dev \
444
+ libfreetype6-dev autoconf2.13 autotools-dev libgdal1-dev proj libjpeg62-dev \
445
+ libpng12-dev libpq-dev unixodbc-dev doxygen fakeroot cmake python-dev \
446
+ python-qt4-common python-qt4-dev python-sip4 python2.5-dev sip4 libglew1.5-dev \
447
+ libxmu6 \ libqt4-dev libgsl0-dev python-qt4 swig python-wxversion \
448
+ python-wxgtk2.8 libwxgtk2.8-0 libwxbase2.8-0 tcl8.4-dev tk8.4-dev tk8.4 \
449
+ libfftw3-dev libfftw3-3
448
450
449
451
At this point we can get the GRASS source code: you may want to download it
450
- through svn or maybe you want just to download the latest available source code arquive.
451
- For example the GRASS 6.4rc4 is available at http://grass.itc.it/grass64/source/grass-6.4.0RC4.tar.gz
452
+ through svn or maybe you want just to download the latest available source code
453
+ archive. For example the GRASS 6.4rc4 is available at
454
+ http://grass.itc.it/grass64/source/grass-6.4.0RC4.tar.gz
452
455
453
- Uncompress the arquive , enter the newly created folder and run configure with a few specific parameters
456
+ Uncompress the archive , enter the newly created folder and run configure with a few specific parameters
454
457
455
- CFLAGS="-fexceptions" ./configure --with-tcltk-includes=/usr/include/tcl8.4 --with-proj-share=/usr/share/proj --with-gdal=/usr/local/bin/gdal-config \
458
+ CFLAGS="-fexceptions" ./configure \
459
+ --with-tcltk-includes=/usr/include/tcl8.4 \
460
+ --with-proj-share=/usr/share/proj \
461
+ --with-gdal=/usr/local/bin/gdal-config \
456
462
--with-python=/usr/bin/python2.5-config
457
463
458
- The additional gcc option -fexceptions is necessary to enable exceptions support in GRASS libraries. It is currently the only way to avoid QGIS crashes if a fatal error happens in GRASS library. See also http://trac.osgeo.org/grass/ticket/869
464
+ The additional gcc option -fexceptions is necessary to enable exceptions
465
+ support in GRASS libraries. It is currently the only way to avoid QGIS crashes
466
+ if a fatal error happens in GRASS library. See also
467
+ http://trac.osgeo.org/grass/ticket/869
459
468
460
469
Then as usual (it will take a while)
461
470
@@ -475,31 +484,21 @@ may want to give it a try
475
484
grass64 -wxpython
476
485
477
486
478
- 3.9.6. Step 6: compile and install QGIS
487
+ 3.9.6. Step 6: Compile and install QGIS
479
488
=======================================
480
489
481
- As for GRASS you can obtain the QGIS source code from different sources,
482
- for instance from svn or just by downloading one of the source code arquives available
483
- at http://www.qgis.org/download/sources.html
490
+ As for GRASS you can obtain the QGIS source code from different sources as described
491
+ in section 2 above. Once you have the sources, create a build directory in them:
484
492
485
- For example download the QGIS 1.1.0 source code here http://download.osgeo.org/qgis/src/qgis_1.1.0.tar.gz
486
-
487
- uncompress the arquive and enter the newly created folder
488
-
489
- cd /qgis_1.1.0
493
+ cd Quantum-GIS
494
+ mkdir build
495
+ cd build
490
496
491
497
then run ccmake
492
498
493
- ccmake .
494
-
495
- press the "c" key, then when the option list will appear we need to manually
496
- configure the "GRASS_PREFIX" parameter. Scroll down until the "GRASS_PREFIX" will appear,
497
- press enter and manually set it to
498
-
499
- /usr/local/grass-6.4.0RC4
500
-
501
- then press enter again.
499
+ ccmake ..
502
500
501
+ Press the "c" key to do an initial configure.
503
502
Press the "c" again and the option "Press [g] to generate and exit" will appear.
504
503
Press the "g" key to generate and exit.
505
504
@@ -621,13 +620,9 @@ installed in the default locations):
621
620
@cmd
622
621
623
622
Start the batch file and on the command prompt checkout the QGIS source from
624
- svn to the source directory qgis-trunk:
625
-
626
- svn co https://svn.osgeo.org/qgis/trunk/qgis qgis-trunk
623
+ git to the source directory Quantum-GIS:
627
624
628
- or using git-svn (from the git shell):
629
-
630
- git svn clone --username $USER --revision 15611:HEAD https://svn.osgeo.org/qgis/trunk/qgis
625
+ git clone git://github.com/qgis/Quantum-GIS.git
631
626
632
627
Create a 'build' directory somewhere. This will be where all the build output
633
628
will be generated.
@@ -1154,9 +1149,9 @@ In this approach I will try to avoid as much as possible building dependencies
1154
1149
from source and rather use frameworks wherever possible.
1155
1150
1156
1151
The base system here is Mac OS X 10.4 (Tiger), with a single architecture
1157
- build. Included are notes for building on Mac OS X 10.5 (Leopard) and 10.6
1158
- (Snow Leopard). Make sure to read each section completely before typing
1159
- the first command you see.
1152
+ build. Included are notes for building on Mac OS X 10.5 (Leopard), 10.6
1153
+ (Snow Leopard) and 10.7 (Lion).
1154
+ Make sure to read each section completely before typing the first command you see.
1160
1155
1161
1156
General note on Terminal usage: When I say "cd" to a folder in a Terminal,
1162
1157
it means type "cd " (without the quotes, make sure to type a space after) and
@@ -1187,10 +1182,12 @@ You need a minimum of Qt-4.4.0. I suggest getting the latest. There is no need
1187
1182
for the full Qt SDK, so save yourself some download time and get the frameworks
1188
1183
only.
1189
1184
1190
- Snow Leopard note: If you are building on Snow Leopard, you will need to
1191
- decide between 32-bit support in the older, Qt Carbon branch, or 64-bit
1185
+ Snow Leopard+ note: If you are building on Snow Leopard+ , you will need to
1186
+ decide between 32-bit support in the older Qt Carbon branch, or 64-bit
1192
1187
support in the Qt Cocoa branch. Appropriate installers are available for both
1193
- as of Qt-4.5.2. Qt 4.6+ is recommended for Cocoa.
1188
+ as of Qt-4.5.2, though they stopped making Carbon packages at Qt 4.7.4.
1189
+ Qt 4.6+ is recommended for Cocoa.
1190
+ Starting with Lion, Carbon may not work properly, if at all.
1194
1191
1195
1192
PPC note: The readymade Qt Cocoa installers don't include PPC support, you'd
1196
1193
have to compile Qt yourself. But, there appear to be issues with Qt Cocoa on
@@ -1258,8 +1255,8 @@ have problems and you are on your own with those.
1258
1255
5.2.2. Additional Dependencies: Expat
1259
1256
=====================================
1260
1257
1261
- Snow Leopard note: Snow Leopard includes a usable expat, so this step is
1262
- not necessary on Snow Leopard.
1258
+ Snow Leopard+ note: Snow Leopard includes a usable expat, so this step is
1259
+ not necessary on Snow Leopard or Lion .
1263
1260
1264
1261
Get the expat sources:
1265
1262
@@ -1276,10 +1273,10 @@ source folder and:
1276
1273
5.2.3. Additional Dependencies: Python
1277
1274
======================================
1278
1275
1279
- Leopard and Snow Leopard note: Leopard and Snow Leopard include a usable
1280
- Python 2.5 and 2.6 , respectively. So there is no need to install Python on
1281
- Leopard and Snow Leopard. You can still install Python from python.org if
1282
- preferred.
1276
+ Leopard+ note: Starting with Leopard a usable Python is included
1277
+ in the system. This Python 2.5, 2.6 and 2.7 , respectively for Leo, Snow and Lion.
1278
+ So there is no need to install Python on Leopard and newer.
1279
+ You can still install Python from python.org if preferred.
1283
1280
1284
1281
If installing from python.org, make sure you install at least the latest Python
1285
1282
2.x from
@@ -1314,12 +1311,13 @@ More configuration is needed to install outside the system path:
1314
1311
python configure.py -n -d /Library/Python/2.5/site-packages -b /usr/local/bin \
1315
1312
-e /usr/local/include -v /usr/local/share/sip -s MacOSX10.5.sdk
1316
1313
1317
- Snow Leopard system Python
1314
+ Snow Leopard+ system Python
1318
1315
1319
1316
Similar to Leopard, you should install outside the system Python path.
1320
1317
Also, you need to specify the architecture you want (requires at least SIP
1321
1318
4.9), and make sure to run the versioned python binary (this one responds to
1322
1319
the 'arch' command, 'python' does not).
1320
+ Substitute '2.7' for python version and 10.7 for SDK version below for Lion.
1323
1321
1324
1322
If you are using 32-bit Qt (Qt Carbon):
1325
1323
@@ -1361,12 +1359,13 @@ More configuration is needed to install outside the system path:
1361
1359
1362
1360
python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin
1363
1361
1364
- Snow Leopard system Python
1362
+ Snow Leopard+ system Python
1365
1363
1366
1364
Similar to Leopard, you should install outside the system Python path.
1367
1365
Also, you need to specify the architecture you want (requires at least PyQt 4.6),
1368
1366
and make sure to run the versioned python binary (this one responds to the
1369
1367
'arch' command, which is important for pyuic4, 'python' does not).
1368
+ Substitute '2.7' for python version and 10.7 for SDK version below for Lion.
1370
1369
1371
1370
If you are using 32-bit Qt (Qt Carbon):
1372
1371
@@ -1435,7 +1434,7 @@ Carbon note below):
1435
1434
1436
1435
Make sure to use the qwt install path from the Qwt build above.
1437
1436
1438
- Snow Leopard note
1437
+ Snow Leopard+ note
1439
1438
1440
1439
If using Qt Carbon, you need to specify which architectures to build, otherwise
1441
1440
it will default to a combination that does not work (ie x86_64 for a Carbon Qt).
@@ -1449,18 +1448,15 @@ This is not needed for Qt Cocoa. Configure as follows:
1449
1448
5.2.7. Additional Dependencies: Bison
1450
1449
=====================================
1451
1450
1452
- Leopard and Snow Leopard note: Leopard and Snow Leopard include Bison 2.3,
1453
- so this step can be skipped on Leopard and Snow Leopard.
1454
-
1455
- The version of bison available by default on Mac OS X 10.4 is too old so you
1456
- need to get a more recent one on your system. Download at least version 2.3 from:
1451
+ The version of bison available by default on Mac OS X is too old so you
1452
+ need to get a more recent one on your system. Download at least version 2.4 from:
1457
1453
1458
1454
ftp.gnu.org/gnu/bison/
1459
1455
1460
- Now build and install it to a prefix of /usr/local.� Double-click the source
1456
+ Now build and install it to a prefix of /usr/local. Double-click the source
1461
1457
tarball to unpack it, then cd to the source folder and:
1462
1458
1463
- ./configure --prefix=/usr/local
1459
+ ./configure --disable-dependency-tracking CFLAGS=-Os
1464
1460
make
1465
1461
sudo make install
1466
1462
@@ -1474,8 +1470,9 @@ http://www.cmake.org/cmake/resources/software.html
1474
1470
1475
1471
Binary installers are available for OS X, but they are not recommended
1476
1472
(2.4 versions install in /usr instead of /usr/local, and 2.6+ versions are a
1477
- strange application). Instead, download the source, double-click the source
1478
- tarball, then cd to the source folder and:
1473
+ strange application). Instead, download the source.
1474
+ NOTE: 2.8.5 is broken for detecting part of Qt. Fixed in 2.8.6.
1475
+ Double-click the source tarball, then cd to the source folder and:
1479
1476
1480
1477
./bootstrap --docdir=/share/doc/CMake --mandir=/share/man
1481
1478
make
@@ -1508,16 +1505,17 @@ CMake supports out of source build so we will create a 'build' dir for the
1508
1505
build process. OS X uses ${HOME}/Applications as a standard user app folder (it
1509
1506
gives it the system app folder icon). If you have the correct permissions you
1510
1507
may want to build straight into your /Applications folder. The instructions
1511
- below assume you are building into a pre-existing ${HOME}/Applications directory.
1508
+ below assume you are building into a ${HOME}/Applications directory.
1512
1509
In a Terminal cd to the qgis source folder previously downloaded, then:
1513
1510
1514
1511
mkdir build
1515
1512
cd build
1516
1513
cmake -D CMAKE_INSTALL_PREFIX=~/Applications \
1517
1514
-D CMAKE_BUILD_TYPE=MinSizeRel \
1518
- -D WITH_INTERNAL_SPATIALITE=FALSE -D WITH_MAPSERVER=TRUE \
1515
+ -D WITH_INTERNAL_SPATIALITE=FALSE \
1519
1516
-D QWT_LIBRARY=/usr/local/qwt-5.2.1-svn/lib/libqwt.dylib \
1520
1517
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.1-svn/include \
1518
+ -D BISON_EXECUTABLE=/usr/local/bin/bison \
1521
1519
..
1522
1520
1523
1521
This will automatically find and use the previously installed frameworks, and
@@ -1529,10 +1527,11 @@ path and version as required):
1529
1527
1530
1528
cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D CMAKE_BUILD_TYPE=Release \
1531
1529
-D CMAKE_BUILD_TYPE=MinSizeRel \
1532
- -D WITH_INTERNAL_SPATIALITE=FALSE -D WITH_MAPSERVER=TRUE \
1530
+ -D WITH_INTERNAL_SPATIALITE=FALSE \
1533
1531
-D QWT_LIBRARY=/usr/local/qwt-5.2.1-svn/lib/libqwt.dylib \
1534
1532
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.1-svn/include \
1535
1533
-D GRASS_PREFIX=/user/local/grass-6.4.1 \
1534
+ -D BISON_EXECUTABLE=/usr/local/bin/bison \
1536
1535
..
1537
1536
1538
1537
Snow Leopard note: To handle 32-bit Qt (Carbon), create a 32bit python wrapper
@@ -1547,12 +1546,23 @@ script and add arch flags to the configuration:
1547
1546
1548
1547
cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D \
1549
1548
-D CMAKE_BUILD_TYPE=MinSizeRel \
1550
- -D WITH_INTERNAL_SPATIALITE=FALSE -D WITH_MAPSERVER=TRUE \
1549
+ -D WITH_INTERNAL_SPATIALITE=FALSE \
1551
1550
-D QWT_LIBRARY=/usr/local/qwt-5.2.1-svn/lib/libqwt.dylib \
1552
1551
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.1-svn/include \
1552
+ -D BISON_EXECUTABLE=/usr/local/bin/bison \
1553
1553
-D CMAKE_OSX_ARCHITECTURES=i386 -D PYTHON_EXECUTABLE=/usr/local/bin/python32 \
1554
1554
..
1555
1555
1556
+ The Qgis Mapserver feature requires fastcgi support. This is included in
1557
+ Leopard and Snow Leopard, but was dropped at Lion. To build the Mapserver
1558
+ component on Leopard and Snow, add the followling line before the last line in
1559
+ the above configuration:
1560
+
1561
+ -D WITH_MAPSERVER=TRUE \
1562
+
1563
+ On Lion you are on your own to figure out how to install libfcgi and add fcgi
1564
+ support to the system Apache. Not recommended for the average user.
1565
+
1556
1566
Bundling note: Older Qt versions may have problems with some Qt plugins and
1557
1567
Qgis. The way to handle this is to bundle Qt inside the Qgis application. You
1558
1568
can do this now or wait to see if there are immediate crashes when running Qgis.
0 commit comments