forked from qgis/QGIS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL.t2t
1933 lines (1346 loc) · 61.7 KB
/
INSTALL.t2t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Quantum GIS (QGIS)
Building QGIS from source - step by step
%!encoding: iso-8859-1
% These are comments and will not be generated in any output
% -------------------
%This document is in text2tags format. You can generate html, plain text and
%moinmoin formatted documentation by running txt2tags on this document. See the
%txt2tags home page for more details. Please insert manual line breaks in this
%document as it makes diffing for changes much easier. To do this in vim
%automatically, select a section then issue (gq) command. Please dont
%apply vim formatting to the whol document as it screws up some formatting
%rather apply it selectively to paragraphs where needed.
% To generate teh text version of this document:
% txt2tags -t txt --toc --enum-title -o INSTALL INSTALL.t2t
% To generate the moinmoin version of this document
% txt2tags -t moin --toc --enum-title -o INSTALL.moin INSTALL.t2t
% End of comments
% -------------------
= Introduction =
This document is the original installation guide of the described software
Quantum GIS. The software and hardware descriptions named in this
document are in most cases registered trademarks and are therefore subject
to the legal requirements. Quantum GIS is subject to the GNU General Public
License. Find more information on the Quantum GIS Homepage:
http://www.qgis.org
The details, that are given in this document have been written and verified
to the best of knowledge and responsibility of the editors. Nevertheless,
mistakes concerning the content are possible. Therefore, all data are not
liable to any duties or guarantees. The editors and publishers do not take
any responsibility or liability for failures and their consequences. You are
always welcome for indicating possible mistakes.
You can download this document as part of the Quantum GIS 'User and
Installation Guide' in HTML and PDF format via http://www.qgis.org. A current
version is also available at the wiki, see:
http://wiki.qgis.org/qgiswiki/BuildingFromSource
Translations of this document can also be downloaded at the documentation area
of the Quantum GIS project at http://www.qgis.org. More information is
available via http://wiki.qgis.org/qgiswiki/DocumentationWritersCorner.
Please visit http://qgis.org for information on joining our mailing lists
and getting involved in the project further.
/!\ ***Note to document writers:*** Please use this document as the central
place for describing build procefures. Please do not remove this notice.
/!\ ***Note:*** This is a 'cut and paste' tutorial - in most cases you can
simply copy the commands listed in codeblocks that look like this:
```
somecommand to be pasted
```
% -----------------------------------------------------------------------------
% ----Please leave this break marker here for clarity - it wont be rendered ---
% -----------------------------------------------------------------------------
= General Build Notes =
At version 0.8.1 QGIS no longer uses the autotools for building. QGIS, like a
number of major projects (eg. KDE 4.0), now uses cmake for building from
source. The configure script in this directory simply checks for the existence
of cmake and provides some clues to build QGIS.
For complete information, see the wiki at:
http://wiki.qgis.org/qgiswiki/Building_with_CMake
== An overview of the dependencies required for building ==
'''Required build deps:'''
* CMake >= 2.4.3
* Flex, Bison
'''Required runtime deps:'''
* Qt >= 4.2.0
* Proj >= ? (known to work with 4.4.x)
* GEOS >= 2.2 (3.0 is supported, maybe 2.1.x works too)
* Sqlite3 >= ? (probably 3.0.0)
* GDAL/OGR >= ? (1.2.x should work)
'''Optional dependencies:'''
* for GRASS plugin - GRASS >= 6.0.0
* for georeferencer - GSL >= ? (works with 1.8)
* for postgis support and SPIT plugin - PostgreSQL >= ?
* for gps plugin - expat >= ? (1.95 is OK)
* for mapserver export and PyQGIS - Python >= ? (probably 2.3)
* for PyQGIS - SIP >= 4.5, PyQt >= 4.1
'''Recommended runtime deps:'''
* for gps plugin - gpsbabel
% -----------------------------------------------------------------------------
% ----Please leave this break marker here for clarity - it wont be rendered ---
% -----------------------------------------------------------------------------
= Building under windows using msys =
== MSYS: ==
MSYS provides a unix style build environment under windows. We have created a
zip archive that contains just about all dependencies.
Get this:
http://qgis.org/uploadfiles/msys/msys.zip
and unpack to c:\msys
If you wish to prepare your msys environment yourself rather than using
our pre-made one, detailed instructions are provided elsewhere in this
document.
== Qt4.3 ==
Download qt4.3 opensource precompiled edition exe and install (including the
download and install of mingw) from here:
http://www.trolltech.com/developer/downloads/qt/windows
When the installer will ask for MinGW, you don't need to download and install
it, just point the installer to c:\msys\mingw
When Qt installation is complete:
Edit C:\Qt\4.3.0\bin\qtvars.bat and add the following lines:
```
set PATH=%PATH%;C:\msys\local\bin;c:\msys\local\lib
set PATH=%PATH%;"C:\Program Files\Subversion\bin"
```
I suggest you also add C:\Qt\4.3.0\bin\ to your Environment Variables Path in
the windows system preferences.
If you plan to do some debugging, you'll need to compile debug version of Qt:
C:\Qt\4.3.0\bin\qtvars.bat compile_debug
Note: there is a problem when compiling debug version of Qt 4.3, the script ends with
this message "mingw32-make: *** No rule to make target `debug'. Stop.". To
compile the debug version you have to go out of src directory and execute the
following command:
```
c:\Qt\4.3.0 make
```
== Flex and Bison ==
*** Note I think this section can be removed as it should be installed int the
msys image already. TS
Get Flex
http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=16424
(the zip bin) and extract it into c:\msys\mingw\bin
== Python stuff: (optional) ==
Follow this section in case you would like to use Python bindings for QGIS. To
be able to compile bindings, you need to compile SIP and PyQt4 from sources as
their installer doesn't include some development files which are necessary.
=== Download and install Python - use Windows installer ===
(It doesn't matter to what folder you'll install it)
http://python.org/download/
=== Download SIP and PyQt4 sources ===
http://www.riverbankcomputing.com/Downloads/sip4/
http://www.riverbankcomputing.com/Downloads/PyQt4/GPL/
Extract each of the above zip files in a temporary directory. Make sure
to get versions that match your current Qt installed version.
=== Compile SIP ===
```
c:\Qt\4.3.0\bin\qtvars.bat
python configure.py -p win32-g++
make
make install
```
=== Compile PyQt ===
```
c:\Qt\4.3.0\bin\qtvars.bat
python configure.py
make
make install
```
=== Final python notes ===
/!\ You can delete the directories with unpacked SIP and PyQt4 sources after a
successfull install, they're not needed anymore.
== Subversion: ==
In order to check out QGIS sources from the repository, you need Subversion
client. This installer should work fine:
http://subversion.tigris.org/files/documents/15/36797/svn-1.4.3-setup.exe
== CMake: ==
CMake is build system used by Quantum GIS. Download it from here:
http://www.cmake.org/files/v2.4/cmake-2.4.6-win32-x86.exe
== QGIS: ==
Start a cmd.exe window ( Start -> Run -> cmd.exe ) Create development
directory and move into it
```
md c:\dev\cpp
cd c:\dev\cpp
```
Check out sources from SVN For svn head:
```
svn co https://svn.qgis.org/repos/qgis/trunk/qgis
```
For svn 0.8 branch
```
svn co https://svn.qgis.org/repos/qgis/branches/Release-0_8_0 qgis0.8
```
== Compiling: ==
As a background read the generic building with CMake notes at the end of
this document.
Start a cmd.exe window ( Start -> Run -> cmd.exe ) if you don't have one
already. Add paths to compiler and our MSYS environment:
```
c:\Qt\4.3.0\bin\qtvars.bat
```
For ease of use add c:\Qt\4.3.0\bin\ to your system path in system
properties so you can just type qtvars.bat when you open the cmd console.
Create build directory and set it as current directory:
```
cd c:\dev\cpp\qgis
md build
cd build
```
== Configuration ==
```
cmakesetup ..
```
/!\ NOTE: You must include the '..' above.
Click 'Configure' button. When asked, you should choose 'MinGW Makefiles'
as generator.
There's a problem with MinGW Makefiles on Win2K. If you're compiling on this
platform, use 'MSYS Makefiles' generator instead.
All dependencies should be picked up automatically, if you have set up the
Paths correctly. The only thing you need to change is the installation
destination (CMAKE_INSTALL_PREFIX) and/or set 'Debug'.
For compatibility with NSIS packaging cripts I recommend to leave the
install prefix to its default c:\program files\
When configuration is done, click 'OK' to exit the setup utility.
== Compilation and installation ==
```
make make install
```
== Run qgis.exe from the directory where it's installed (CMAKE_INSTALL_PREFIX) ==
Make sure to copy all .dll:s needed to the same directory as the qgis.exe
binary is installed to, if not already done so, otherwise QGIS will complain
about missing libraries when started.
The best way to do this is to download both the QGIS current release installer
package from http://qgis.org/uploadfiles/testbuilds/ and install it. Now copy
the installation dir from C:\Program Files\Quantum GIS into c:\Program
Files\qgis-0.8.1 (or whatever the current version is. The name should strictly
match the version no.) After making this copy you can uninstall the release
version of QGIS from your c:\Program Files directory using the provided
uninstaller. Double check that the Quantum GIS dir is completely gone under
program files afterwards.
Another possibility is to run qgis.exe when your path contains
c:\msys\local\bin and c:\msys\local\lib directories, so the DLLs will be
used from that place.
== Create the installation package: (optional) ==
Downlad and install NSIS from (http://nsis.sourceforge.net/Main_Page)
Now using windows explorer, enter the win_build directory in your QGIS source
tree. Read the READMEfile there and follow the instructions. Next right click
on qgis.nsi and choose the option 'Compile NSIS Script'.
% -----------------------------------------------------------------------------
% ----Please leave this break marker here for clarity - it wont be rendered ---
% -----------------------------------------------------------------------------
= Building on Mac OSX using frameworks and cmake (QGIS > 0.8) =
In this approach I will try to avoid as much as possible building dependencies
from source and rather use frameworks wherever possible.
== Install XCODE ==
I recommend to get the latest xcode dmg from the Apple XDC Web site. Install
XCODE after the ~941mb download is complete.
== Install Qt4 from .dmg ==
You need a minimum of Qt4.2. I suggest getting the latest (at time of writing).
```
ftp://ftp.trolltech.com/qt/source/qt-mac-opensource-4.3.2.dmg
```
If you want debug libs, Qt also provide a dmg with these:
```
ftp://ftp.trolltech.com/qt/source/qt-mac-opensource-4.3.2-debug-libs.dmg
```
I am going to proceed using only release libs at this stage as the download for
the debug dmg is substantially bigger. If you plan to do any debugging though
you probably want to get the debug libs dmg. Once downloaded open the dmg and
run the installer. Note you need admin access to install.
After installing you need to make two small changes:
First edit ``/Library/Frameworks/QtCore.framework/Headers/qconfig.h`` and
change
/!\ Note this doesnt seem to be needed since version 4.2.3
``QT_EDITION_UNKNOWN`` to ``QT_EDITION_OPENSOURCE``
Second change the default mkspec symlink so that it points to macx-g++:
```
cd /usr/local/Qt4.3/mkspecs/ sudo rm default sudo ln -sf macx-g++ default
```
== Install development frameworks for QGIS dependencies ==
Download William Kyngesburye's excellent all in one framework that includes
proj, gdal, sqlite3 etc
```
http://www.kyngchaos.com/files/software/unixport/AllFrameworks.dmg
```
Once downloaded, open and install the frameworks.
William provides an additional installer package for Postgresql/PostGIS. Its
available here:
```
http://www.kyngchaos.com/software/unixport/postgres
```
There are some additional dependencies that at the time of writing are not
provided as frameworks so we will need to build these from source.
=== Additional Dependencies : GSL ===
Retrieve the Gnu Scientific Library from
```
curl -O ftp://ftp.gnu.org/gnu/gsl/gsl-1.8.tar.gz
```
Then extract it and build it to a prefix of /usr/local:
```
tar xvfz gsl-1.8.tar.gz
cd gsl-1.8
./configure --prefix=/usr/local
make
sudo make install
cd ..
```
=== Additional Dependencies : Expat ===
Get the expat sources:
```
http://sourceforge.net/project/showfiles.php?group_id=10127
```
```
tar xvfz expat-2.0.0.tar.gz
cd expat-2.0.0
./configure --prefix=/usr/local
make
sudo make install
cd ..
```
=== Additional Dependencies : SIP ===
Retrieve the python bindings toolkit SIP from
```
http://www.riverbankcomputing.com/Downloads/sip4/
```
Then extract and build it to a prefix of /usr/local:
```
tar xvfz sip-<version number>.tar.gz
cd sip-<version number>
python configure.py
make
sudo make install
cd ..
```
=== Additional Dependencies : PyQt ===
Make sure you have the latest python fom
```
http://www.python.org/download/mac/
```
If you encounter problems compiling PyQt using the instructions
below you can also try adding python from your frameworks dir
explicitly to your path e.g.
```
export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH$
```
Retrieve the python bindings toolkit for Qt from
```
http://www.riverbankcomputing.com/Downloads/PyQt4/GPL/
```
Then extract and build it to a prefix of /usr/local:
```
tar xvfz PyQt-mac<version number here>
cd PyQt-mac<version number here>
python configure.py
yes
make
sudo make install
cd ..
```
=== Additional Dependencies : Bison ===
The version of bison available by default on Mac OSX is too old so you need to
get a more recent one on your system. Download if from:
```
curl -O http://ftp.gnu.org/gnu/bison/bison-2.3.tar.gz
```
Now build and install it to a prefix of /usr/local :
```
tar xvfz bison-2.3.tar.gz
cd bison-2.3
./configure --prefix=/usr/local
make
sudo make install
cd ..
```
== Install CMAKE for OSX ==
Get the latest release from here:
```
http://www.cmake.org/HTML/Download.html
```
At the time of writing the file I grabbed was:
```
curl -O http://www.cmake.org/files/v2.4/cmake-2.4.6-Darwin-universal.dmg
```
Once downloaded open the dmg and run the installer
== Install subversion for OSX ==
The [http://sourceforge.net/projects/macsvn/ MacSVN] project has a downloadable
build of svn. If you are a GUI inclined person you may want to grab their gui
client too. Get the command line client here:
```
curl -O http://ufpr.dl.sourceforge.net/sourceforge/macsvn/Subversion_1.4.2.zip
```
Once downloaded open the zip file and run the installer.
You also need to install BerkleyDB available from the same
[http://sourceforge.net/projects/macsvn/ website]. At the time of writing the
file was here:
```
curl -O http://ufpr.dl.sourceforge.net/sourceforge/macsvn/Berkeley_DB_4.5.20.zip
```
Once again unzip this and run the installer therein.
Lastly we need to ensure that the svn commandline executeable is in the path.
Add the following line to the end of /etc/bashrc using sudo:
```
sudo vim /etc/bashrc
```
And add this line to the bottom before saving and quiting:
```
export PATH=/usr/local/bin:$PATH:/usr/local/pgsql/bin
```
/usr/local/bin needs to be first in the path so that the newer bison (that will
be built from source further down) is found before the bison (which is very
old) that is installed by MacOSX
Now close and reopen your shell to get the updated vars.
== Check out QGIS from SVN ==
Now we are going to check out the sources for QGIS. First we will create a
directory for working in:
```
mkdir -p ~/dev/cpp cd ~/dev/cpp
```
Now we check out the sources:
Trunk:
```
svn co https://svn.qgis.org/repos/qgis/trunk/qgis qgis
```
For svn 0.8 branch
```
svn co https://svn.qgis.org/repos/qgis/branches/Release-0_8_0 qgis0.8
```
For svn 0.9 branch
```
svn co https://svn.qgis.org/repos/qgis/branches/Release-0_9_0 qgis0.9
```
The first time you check out QGIS sources you will probably get a message like
this:
```
Error validating server certificate for 'https://svn.qgis.org:443':
- The certificate is not issued by a trusted authority. Use the fingerprint to
validate the certificate manually! Certificate information:
- Hostname: svn.qgis.org
- Valid: from Apr 1 00:30:47 2006 GMT until Mar 21 00:30:47 2008 GMT
- Issuer: Developer Team, Quantum GIS, Anchorage, Alaska, US
- Fingerprint: 2f:cd:f1:5a:c7:64:da:2b:d1:34:a5:20:c6:15:67:28:33:ea:7a:9b
(R)eject, accept (t)emporarily or accept (p)ermanently?
```
I suggest you press 'p' to accept the key permanently.
== Configure the build ==
CMake supports out of source build so we will create a 'build' dir for the
build process . By convention I build my software into a dir called 'apps'
in my home directory. If you have the correct permissions you may want to
build straight into your /Applications folder (although personally I dont
really recommend this). The instructions below assume you are building into
a pre-existing ${HOME}/apps directory ...
```
cd qgis
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=$HOME/apps/ -D CMAKE_BUILD_TYPE=Release ..
```
To use a specific GRASS version, You can optionally use the following
cmake invocation (with modifications to suite your system (thanks William
Kyngesburye for this hint):
```
cmake -D CMAKE_INSTALL_PREFIX=${HOME}/apps/ \
-D GRASS_INCLUDE_DIR=/Applications/GRASS-6.3.app/Contents/Resources/include \
-D GRASS_PREFIX=/Applications/GRASS-6.3.app/Contents/Resources \
-D CMAKE_BUILD_TYPE=Release \
..
```
== GEOS Issues ==
I had some issues with GEOS headers so I made the following edits:
In file /Library/Frameworks/GEOS.framework/Headers/io.h, comment out line 61
In file /Library/Frameworks/GEOS.framework/Headers/geom.h, comment out line 145
== Building ==
Now we can start the build process:
```
make
```
If all built without errors you can then install it:
```
make install
```
% -----------------------------------------------------------------------------
% ----Please leave this break marker here for clarity - it wont be rendered ---
% -----------------------------------------------------------------------------
= Building on GNU/Linux =
== Building QGIS with Qt4.x ==
**Requires:** Ubuntu Edgy / Debian derived distro
These notes are current for Ubuntu 7.10 - other versions and Debian derived
distros may require slight variations in package names.
These notes are for if you want to build QGIS from source. One of the major
aims here is to show how this can be done using binary packages for ***all***
dependencies - building only the core QGIS stuff from source. I prefer this
approach because it means we can leave the business of managing system packages
to apt and only concern ourselves with coding QGIS!
This document assumes you have made a fresh install and have a 'clean' system.
These instructions should work fine if this is a system that has already been
in use for a while, you may need to just skip those steps which are irrelevant
to you.
== Prepare apt ==
The packages qgis depends on to build are available in the "universe" component
of Ubuntu. This is not activated by default, so you need to activate it:
1. Edit your /etc/apt/sources.list file.
2. Uncomment the all the lines starting with "deb"
Also you will need to be running (K)Ubuntu 'edgy' or higher in order for
all dependencies to be met.
Now update your local sources database:
```
sudo apt-get update
```
== Install Qt4 ==
```
sudo apt-get install libqt4-core libqt4-debug \
libqt4-dev libqt4-gui libqt4-qt3support libqt4-sql lsb-qt4 qt4-designer \
qt4-dev-tools qt4-doc qt4-qtconfig uim-qt gcc libapt-pkg-perl resolvconf
```
/!\ ***A Special Note:*** If you are following this set of instructions on
a system where you already have Qt3 development tools installed, there will
be a conflict between Qt3 tools and Qt4 tools. For example, qmake will
point to the Qt3 version not the Qt4. Ubuntu Qt4 and Qt3 packages are
designed to live alongside each other. This means that for example if you
have them both installed you will have three qmake exe's:
```
/usr/bin/qmake -> /etc/alternatives/qmake
/usr/bin/qmake-qt3
/usr/bin/qmake-qt4
```
The same applies to all other Qt binaries. You will notice above that the
canonical 'qmake' is managed by apt alternatives, so before we start to
build QGIS, we need to make Qt4 the default. To return Qt3 to default later
you can use this same process.
You can use apt alternatives to correct this so that the Qt4 version of
applications is used in all cases:
```
sudo update-alternatives --config qmake
sudo update-alternatives --config uic
sudo update-alternatives --config designer
sudo update-alternatives --config assistant
sudo update-alternatives --config qtconfig
sudo update-alternatives --config moc
sudo update-alternatives --config lupdate
sudo update-alternatives --config lrelease
sudo update-alternatives --config linguist
```
Use the simple command line dialog that appears after running each of the
above commands to select the Qt4 version of the relevant applications.
== Install additional software dependencies required by QGIS ==
```
sudo apt-get install gdal-bin libgdal1-dev libgeos-dev proj \
libgdal-doc libhdf4g-dev libhdf4g-run python-dev \
libgsl0-dev g++ libjasper-dev libtiff4-dev subversion \
libsqlite3-dev sqlite3 ccache make libpq-dev flex bison cmake txt2tags \
python-qt4 python-qt4-dev python-sip4 sip4 python-sip4-dev
```
/!\ Debian users should use libgdal-dev above rather
/!\ ***Note:*** For python language bindings SIP >= 4.5 and PyQt4 >= 4.1 is required! Some stable GNU/Linux
distributions (e.g. Debian or SuSE) only provide SIP < 4.5 and PyQt4 < 4.1. To include support for python
language bindings you may need to build and install those packages from source.
== GRASS Specific Steps ==
/!\ ***Note:*** If you don't need to build with GRASS support, you can
skip this section.
Now you can install grass from dapper:
```
sudo apt-get install grass libgrass-dev libgdal-1.4.0-grass
```
/!\ You may need to explicitly state your grass version e.g. libgdal1-1.3.2-grass
== Setup ccache (Optional) ==
You should also setup ccache to speed up compile times:
```
cd /usr/local/bin
sudo ln -s /usr/bin/ccache gcc
sudo ln -s /usr/bin/ccache g++
```
== Prepare your development environment ==
As a convention I do all my development work in $HOME/dev/<language>, so in
this case we will create a work environment for C++ development work like
this:
```
mkdir -p ${HOME}/dev/cpp
cd ${HOME}/dev/cpp
```
This directory path will be assumed for all instructions that follow.
== Check out the QGIS Source Code ==
There are two ways the source can be checked out. Use the anonymous method
if you do not have edit privaleges for the QGIS source repository, or use
the developer checkout if you have permissions to commit source code
changes.
1. Anonymous Checkout
```
cd ${HOME}/dev/cpp
svn co https://svn.qgis.org/repos/qgis/trunk/qgis qgis
```
2. Developer Checkout
```
cd ${HOME}/dev/cpp
svn co --username <yourusername> https://svn.qgis.org/repos/qgis/trunk/qgis qgis
```
The first time you check out the source you will be prompted to accept the
qgis.org certificate. Press 'p' to accept it permanently:
```
Error validating server certificate for 'https://svn.qgis.org:443':
- The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually! Certificate
information:
- Hostname: svn.qgis.org
- Valid: from Apr 1 00:30:47 2006 GMT until Mar 21 00:30:47 2008 GMT
- Issuer: Developer Team, Quantum GIS, Anchorage, Alaska, US
- Fingerprint:
2f:cd:f1:5a:c7:64:da:2b:d1:34:a5:20:c6:15:67:28:33:ea:7a:9b (R)eject,
accept (t)emporarily or accept (p)ermanently?
```
== Starting the compile ==
I compile my development version of QGIS into my ~/apps directory to avoid
conflicts with Ubuntu packages that may be under /usr. This way for example
you can use the binary packages of QGIS on your system along side with your
development version. I suggest you do something similar:
```
mkdir -p ${HOME}/apps
```
Now we create a build directory and run ccmake:
```
cd qgis
mkdir build
cd build
ccmake ..
```
When you run ccmake (note the .. is required!), a menu will appear where
you can configure various aspects of the build. If you do not have root
access or do not want to overwrite existing QGIS installs (by your
packagemanager for example), set the CMAKE_BUILD_PREFIX to somewhere you
have write access to (I usually use /home/timlinux/apps). Now press
'c' to configure, 'e' to dismiss any error messages that may appear.
and 'g' to generate the make files. Note that sometimes 'c' needs to
be pressed several times before the 'g' option becomes available.
After the 'g' generation is complete, press 'q' to exit the ccmake
interactive dialog.
Now on with the build:
```
make
make install
```
It may take a little while to build depending on your platform.
== Running QGIS ==
Now you can try to run QGIS:
```
$HOME/apps/bin/qgis
```
If all has worked properly the QGIS application should start up and appear
on your screen.
% -----------------------------------------------------------------------------
% ----Please leave this break marker here for clarity - it wont be rendered ---
% -----------------------------------------------------------------------------
= Creation of MSYS environment for compilation of Quantum GIS =
== Initial setup ==
=== MSYS ===
This is the environment that supplies many utilities from UNIX world in Windows and is needed
by many dependencies to be able to compile.
Download from here:
http://puzzle.dl.sourceforge.net/sourceforge/mingw/MSYS-1.0.11-2004.04.30-1.exe
Install to ``c:\msys``
All stuff we're going to compile is going to get to this directory (resp. its subdirs).
=== MinGW ===
Download from here:
http://puzzle.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.3.exe
Install to ``c:\msys\mingw``
It suffices to download and install only ``g++`` and ``mingw-make`` components.
=== Flex and Bison ===
Flex and Bison are tools for generation of parsers, they're needed for GRASS and also QGIS compilation.
Download the following packages:
http://gnuwin32.sourceforge.net/downlinks/flex-bin-zip.php
http://gnuwin32.sourceforge.net/downlinks/bison-bin-zip.php
http://gnuwin32.sourceforge.net/downlinks/bison-dep-zip.php
Unpack them all to ``c:\msys\local``
== Installing dependencies ==
=== Getting ready ===
Paul Kelly did a great job and prepared a package of precompiled libraries for GRASS.
The package currently includes:
- zlib-1.2.3
- libpng-1.2.16-noconfig
- xdr-4.0-mingw2
- freetype-2.3.4
- fftw-2.1.5
- PDCurses-3.1
- proj-4.5.0
- gdal-1.4.1
It's available for download here:
http://www.stjohnspoint.co.uk/grass/wingrass-extralibs.tar.gz
Moreover he also left the notes how to compile it (for those interested):
http://www.stjohnspoint.co.uk/grass/README.extralibs
Unpack the whole package to ``c:\msys\local``
=== GDAL level one ===
Since Quantum GIS needs GDAL with GRASS support, we need to compile GDAL
from source - Paul Kelly's package doesn't include GRASS support in GDAL.
The idea is following:
+ compile GDAL without GRASS
+ compile GRASS
+ compile GDAL with GRASS
So, start with downloading GDAL sources:
http://download.osgeo.org/gdal/gdal141.zip
Unpack it to some directory, preferably ``c:\msys\local\src``.
Start MSYS console, go to gdal-1.4.1 directory and run the commands below.
You can put them all to a script, e.g. build-gdal.sh and run them at once.
The recipe is taken from Paul Kelly's instructions - basically they
just make sure that the library will be created as DLL and the utility
programs will be dynamically linked to it...
```
CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" LDFLAGS=-s ./configure --without-libtool --prefix=/usr/local --enable-shared --disable-static --with-libz=/usr/local --with-png=/usr/local
make
make install
rm /usr/local/lib/libgdal.a
g++ -s -shared -o ./libgdal.dll -L/usr/local/lib -lz -lpng ./frmts/o/*.o ./gcore/*.o ./port/*.o ./alg/*.o ./ogr/ogrsf_frmts/o/*.o ./ogr/ogrgeometryfactory.o ./ogr/ogrpoint.o ./ogr/ogrcurve.o ./ogr/ogrlinestring.o ./ogr/ogrlinearring.o ./ogr/ogrpolygon.o ./ogr/ogrutils.o ./ogr/ogrgeometry.o ./ogr/ogrgeometrycollection.o ./ogr/ogrmultipolygon.o ./ogr/ogrsurface.o ./ogr/ogrmultipoint.o ./ogr/ogrmultilinestring.o ./ogr/ogr_api.o ./ogr/ogrfeature.o ./ogr/ogrfeaturedefn.o ./ogr/ogrfeaturequery.o ./ogr/ogrfeaturestyle.o ./ogr/ogrfielddefn.o ./ogr/ogrspatialreference.o ./ogr/ogr_srsnode.o ./ogr/ogr_srs_proj4.o ./ogr/ogr_fromepsg.o ./ogr/ogrct.o ./ogr/ogr_opt.o ./ogr/ogr_srs_esri.o ./ogr/ogr_srs_pci.o ./ogr/ogr_srs_usgs.o ./ogr/ogr_srs_dict.o ./ogr/ogr_srs_panorama.o ./ogr/swq.o ./ogr/ogr_srs_validate.o ./ogr/ogr_srs_xml.o ./ogr/ograssemblepolygon.o ./ogr/ogr2gmlgeometry.o ./ogr/gml2ogrgeometry.o
install libgdal.dll /usr/local/lib
cd ogr
g++ -s ogrinfo.o -o ogrinfo.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s ogr2ogr.o -o ogr2ogr.exe -lgdal -L/usr/local/lib -lpng -lz -lgdal
g++ -s ogrtindex.o -o ogrtindex.exe -lgdal -L/usr/local/lib -lpng -lz -lgdal
install ogrinfo.exe ogr2ogr.exe ogrtindex.exe /usr/local/bin
cd ../apps
g++ -s gdalinfo.o -o gdalinfo.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdal_translate.o -o gdal_translate.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdaladdo.o -o gdaladdo.exe -L/usr/local/lib -lpng -lz -lgdal