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