-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
2089 lines (1381 loc) · 68.6 KB
/
INSTALL
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
QGIS
Building QGIS from source - step by step
Wednesday February 25, 2015
Last Updated: Wednesday February 25, 2015
Last Change : Wednesday February 25, 2015
1. Introduction
2. Overview
3. Building on GNU/Linux
3.1. Building QGIS with Qt 4.x
3.2. Prepare apt
3.3. Install build dependencies
3.4. Setup ccache (Optional)
3.5. Prepare your development environment
3.6. Check out the QGIS Source Code
3.7. Starting the compile
3.8. Building Debian packages
4. Building on Windows
4.1. Building with Microsoft Visual Studio
4.2. Building using MinGW
4.3. Creation of MSYS environment for compilation of QGIS
5. Building on MacOS X
5.1. Install Developer Tools
5.2. Install Qt4 from disk image
5.3. Install CMake for OSX
5.4. Install development frameworks for QGIS dependencies
5.5. API documentation
5.6. QGIS source
5.7. Configure the build
5.8. Building
5.9. Post-Install
6. Setting up the WCS test server on GNU/Linux
6.1. Preparation
6.2. Setup mapserver
6.3. Create a home page
6.4. Now deploy it
6.5. Debugging
7. Setting up a Jenkins Build Server
8. Debug output and running tests
9. Authors and Acknowledgments
1. Introduction
===============
This document is the original installation guide of the described software
QGIS. The software and hardware descriptions named in this
document are in most cases registered trademarks and are therefore subject
to the legal requirements. QGIS is subject to the GNU General Public
License. Find more information on the QGIS Homepage:
http://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 QGIS 'User and
Installation Guide' in HTML and PDF format via http://qgis.org. A current
version is also available at:
http://htmlpreview.github.io/?https://raw.github.com/qgis/QGIS/master/doc/INSTALL.html
Translations of this document can also be downloaded at the documentation area
of the QGIS project at http://qgis.org. More information is
available via http://qgis.org/en/site/getinvolved/governance/organisation/governance.html#community-resources.
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 procedures. Please do not remove this notice.
/!\ Note to document writers: This documented is generated from
doc/INSTALL.t2t - if you need to edit this document, be sure to edit that
file rather than the generated INSTALL document found in the root of the
source directory.
2. Overview
===========
QGIS, like a number of major projects (eg. KDE 4.0), uses CMake
(http://www.cmake.org) for building from source.
Following a summary of the required dependencies for building:
Required build tools:
- CMake >= 2.8.6
- Flex >= 2.5.6
- Bison >= 2.4
Required build dependencies:
- Qt >= 4.7.0
- Proj >= 4.4.x
- GEOS >= 3.0
- Sqlite3 >= 3.0.0
- GDAL/OGR >= 1.4.x
- Qwt >= 5.0 & (< 6.1 with internal QwtPolar)
- expat >= 1.95
- QScintilla2
Optional dependencies:
- for GRASS plugin - GRASS >= 6.0.0 (libraries compiled with exceptions support on Linux 32bit)
- for georeferencer - GSL >= 1.8
- for postgis support and SPIT plugin - PostgreSQL >= 8.0.x
- for gps plugin - gpsbabel
- for mapserver export and PyQGIS - Python >= 2.3 (2.5+ preferred)
- for python support - SIP >= 4.12, PyQt >= 4.8.3 must match Qt version, Qscintilla2
- for qgis mapserver - FastCGI
- for oracle provider - Oracle OCI library
Indirect dependencies:
Some proprietary formats (eg. ECW and MrSid) supported by GDAL require
proprietary third party libraries. QGIS doesn't need any of those itself to
build, but will only support those formats if GDAL is built accordingly. Refer
to http://gdal.org/formats_list.html ff. for instructions how to include
those formats in GDAL.
3. Building on GNU/Linux
========================
3.1. Building QGIS with Qt 4.x
==============================
Requires: Ubuntu / Debian derived distro
/!\ Note: Refer to the section Building Debian packages for building
debian packages. Unless you plan to develop on QGIS, that is probably the
easiest option to compile and install QGIS.
These notes are for Ubuntu - 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.
3.2. 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 all the lines starting with "deb"
Also you will need to be running Ubuntu 'precise' or higher in order for
all dependencies to be met.
Now update your local sources database:
sudo apt-get update
3.3. Install build dependencies
===============================
|| Distribution | install command for packages |
| wheezy | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal1-dev libgeos-dev libgsl0-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqscintilla2-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libqwt-dev libspatialindex-dev libspatialite-dev libsqlite3-dev lighttpd locales pkg-config poppler-utils pyqt4-dev-tools python python-dev python-qscintilla2 python-qt4 python-qt4-dev python-sip python-sip-dev spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| jessie | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl0-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqscintilla2-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libqwt-dev libspatialindex-dev libspatialite-dev libsqlite3-dev lighttpd locales pkg-config poppler-utils pyqt4-dev-tools python-all python-all-dev python-qscintilla2 python-qt4 python-qt4-dev python-sip python-sip-dev spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| precise | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl0-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqscintilla2-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libqwt5-qt4-dev libspatialindex-dev libspatialite-dev libsqlite3-dev lighttpd locales pkg-config poppler-utils pyqt4-dev-tools python python-qscintilla2 python-qt4 python-qt4-dev python-sip python-sip-dev spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| trusty | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl0-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqscintilla2-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libqwt5-qt4-dev libspatialindex-dev libspatialite-dev libsqlite3-dev lighttpd locales pkg-config poppler-utils pyqt4-dev-tools python-all python-all-dev python-qscintilla2 python-qt4 python-qt4-dev python-sip python-sip-dev spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| utopic | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl0-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqscintilla2-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libqwt5-qt4-dev libspatialindex-dev libspatialite-dev libsqlite3-dev lighttpd locales pkg-config poppler-utils pyqt4-dev-tools python-all python-all-dev python-qscintilla2 python-qt4 python-qt4-dev python-sip python-sip-dev spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| vivid | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl0-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqscintilla2-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libqwt5-qt4-dev libspatialindex-dev libspatialite-dev libsqlite3-dev lighttpd locales pkg-config poppler-utils pyqt4-dev-tools python-all python-all-dev python-qscintilla2 python-qt4 python-qt4-dev python-sip python-sip-dev spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
| sid | ``apt-get install bison cmake doxygen flex git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl0-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqscintilla2-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libqwt-dev libspatialindex-dev libspatialite-dev libsqlite3-dev lighttpd locales pkg-config poppler-utils pyqt4-dev-tools pyqt4.qsci-dev python-all python-all-dev python-qscintilla2 python-qt4 python-qt4-dev python-sip python-sip-dev spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` |
(extracted from the control.in file in debian/)
3.4. 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++
3.5. 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.
3.6. 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 privileges 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
git clone git://github.com/qgis/QGIS.git
2. Developer Checkout
cd ${HOME}/dev/cpp
git clone [email protected]:qgis/QGIS.git
3.7. 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-master
cd build-master
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_INSTALL_PREFIX to somewhere you
have write access to (I usually use ${HOME}/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.
After that 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.
3.8. Building Debian packages
=============================
Instead of creating a personal installation as in the previous step you can
also create debian package. This is done from the QGIS root directory, where
you'll find a debian directory.
First you need to install the debian packaging tools once:
apt-get install build-essential
First you need to create an changelog entry for your distribution. For example for Ubuntu Lucid:
dch -l ~precise --force-distribution --distribution precise "precise build"
The QGIS packages will be created with:
dpkg-buildpackage -us -uc -b
/!\ Note: Install devscripts to get dch.
/!\ Note: If dpkg-buildpackage complains about unmet build dependencies
you can install them using apt-get and re-run the command.
/!\ Note: If you have libqgis1-dev installed, you need to remove it first
using dpkg -r libqgis1-dev. Otherwise dpkg-buildpackage will complain about a
build conflict.
/!\ Note: By default tests are run in the process of building and their
results are uploaded to http://dash.orfeo-toolbox.org/index.php?project=QGIS.
You can turn the tests off using DEB_BUILD_OPTIONS=nocheck in front of the
build command. The upload of results can be avoided with DEB_TEST_TARGET=test.
The packages are created in the parent directory (ie. one level up).
Install them using dpkg. E.g.:
sudo debi
4. Building on Windows
======================
4.1. Building with Microsoft Visual Studio
==========================================
This section describes how to build QGIS using Visual Studio on Windows. This
is currently also how the binary QGIS packages are made (earlier versions used
MinGW).
This section describes the setup required to allow Visual Studio to be used to
build QGIS.
4.1.1. Visual C++ Express Edition
=================================
The free (as in free beer) Express Edition installer is available under:
http://download.microsoft.com/download/c/d/7/cd7d4dfb-5290-4cc7-9f85-ab9e3c9af796/vc_web.exe
You also need the Windows SDK for Windows 7 and .NET Framework 4:
http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/winsdk_web.exe
4.1.2. Other tools and dependencies
===================================
Download and install following packages:
|| Tool | Website |
| CMake | http://www.cmake.org/files/v3.0/cmake-3.0.2-win32-x86.exe |
| GNU flex, GNU bison and GIT | http://cygwin.com/setup-x86.exe (32bit) or http://cygwin.com/setup-x86_64.exe (64bit) |
| OSGeo4W | http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86.exe (32bit) or http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe (64bit) |
OSGeo4W does not only provide ready packages for the current QGIS release and
nightly builds of master, but also offers most of the dependencies needs to
build it.
For the QGIS build you need to install following packages from cygwin:
- bison
- flex
- git
and from OSGeo4W (select Advanced Installation):
- expat
- fcgi
- gdal
- grass
- gsl-devel
- iconv
- pyqt4
- qt4-devel
- qwt5-devel-qt4
- sip
- spatialite
- libspatialindex-devel
- python-qscintilla
This will also select packages the above packages depend on.
Earlier versions of this document also covered how to build all above
dependencies. If you're interested in that, check the history of this page in the Wiki
or the SVN repository.
4.1.3. Setting up the Visual Studio project with CMake
======================================================
/!\ Consider this section as example. It tends to outdate, when OSGeo4W and
SDKs move on. ms-windows/osgeo4w/package-nightly.cmd is used for the
nightly builds and constantly updated and hence might contain necessary
updates that are not yet reflected here.
To start a command prompt with an environment that both has the VC++ and the OSGeo4W
variables create the following batch file (assuming the above packages were
installed in the default locations):
@echo off
set VS90COMNTOOLS=%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\Tools\
call "%PROGRAMFILES%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
set INCLUDE=%INCLUDE%;%PROGRAMFILES%\Microsoft SDKs\Windows\v7.1\include
set LIB=%LIB%;%PROGRAMFILES%\Microsoft SDKs\Windows\v7.1\lib
set OSGEO4W_ROOT=C:\OSGeo4W
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"
path %PATH%;%PROGRAMFILES%\CMake\bin;c:\cygwin\bin
@set GRASS_PREFIX=c:/OSGeo4W/apps/grass/grass-6.4.4
@set INCLUDE=%INCLUDE%;%OSGEO4W_ROOT%\include
@set LIB=%LIB%;%OSGEO4W_ROOT%\lib;%OSGEO4W_ROOT%\lib
@cmd
Start the batch file and on the command prompt checkout the QGIS source from
git to the source directory QGIS:
git clone git://github.com/qgis/QGIS.git
Create a 'build' directory somewhere. This will be where all the build output
will be generated.
Now run cmake-gui (still from cmd) and in the Where is the source code:
box, browse to the top level QGIS directory.
In the Where to build the binaries: box, browse to the 'build' directory you
created.
If the path to bison and flex contains blanks, you need to use the short name
for the directory (i.e. C:\Program Files should be rewritten to
C:\Progra~n, where n is the number as shown in `dir /x C:\``).
Verify that the 'BINDINGS_GLOBAL_INSTALL' option is not checked, so that python
bindings are placed into the output directory when you run the INSTALL target.
Hit Configure to start the configuration and select Visual Studio 9 2008
and keep native compilers and click Finish.
The configuration should complete without any further questions and allow you to
click Generate.
Now close cmake-gui and continue on the command prompt by starting
vcexpress. Use File / Open / Project/Solutions and open the
qgis-x.y.z.sln File in your project directory.
Change Solution Configuration from Debug to RelWithDebInfo (Release
with Debug Info) or Release before you build QGIS using the ALL_BUILD
target (otherwise you need debug libraries that are not included).
After the build completed you should install QGIS using the INSTALL target.
Install QGIS by building the INSTALL project. By default this will install to
c:\Program Files\qgis<version> (this can be changed by changing the
CMAKE_INSTALL_PREFIX variable in cmake-gui).
You will also either need to add all the dependency DLLs to the QGIS install
directory or add their respective directories to your PATH.
4.1.4. Packaging
================
To create a standalone installer there is a perl script named 'creatensis.pl'
in 'qgis/ms-windows/osgeo4w'. It downloads all required packages from OSGeo4W
and repackages them into an installer using NSIS.
The script can be run on both Windows and Linux.
On Debian/Ubuntu you can just install the 'nsis' package.
NSIS for Windows can be downloaded at:
http://nsis.sourceforge.net
And Perl for Windows (including other requirements like 'wget', 'unzip', 'tar'
and 'bzip2') is available at:
http://cygwin.com
4.1.5. Packaging your own build of QGIS
=======================================
Assuming you have completed the above packaging step, if you want to include
your own hand built QGIS executables, you need to copy them in from your
windows installation into the ms-windows file tree created by the creatensis
script.
cd ms-windows/
rm -rf osgeo4w/unpacked/apps/qgis/*
cp -r /tmp/qgis1.7.0/* osgeo4w/unpacked/apps/qgis/
Now create a package.
./quickpackage.sh
After this you should now have a nsis installer containing your own build
of QGIS and all dependencies needed to run it on a windows machine.
4.1.6. Osgeo4w packaging
========================
The actual packaging process is currently not documented, for now please take a
look at:
ms-windows/osgeo4w/package.cmd
4.2. Building using MinGW
=========================
Note: This section might be outdated as nowadays Visual C++ is use to build
the "official" packages.
Note: For a detailed account of building all the dependencies yourself you
can visit Marco Pasetti's website here:
http://www.webalice.it/marco.pasetti/qgis+grass/BuildFromSource.html
Read on to use the simplified approach with pre-built libraries...
4.2.1. 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://download.osgeo.org/qgis/win32/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.
4.2.2. Qt
=========
Download Qt opensource precompiled edition exe and install (including the
download and install of mingw) from here:
http://qt.nokia.com/downloads/
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.7.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.7.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.7.0\bin\qtvars.bat compile_debug
Note: there is a problem when compiling debug version of Qt 4.7, 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.7.0 make
4.2.3. Flex and Bison
=====================
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
4.2.4. 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.
4.2.4.1. Download and install Python - use Windows installer
============================================================
(It doesn't matter to what folder you'll install it)
http://python.org/download/
4.2.4.2. Download SIP and PyQt4 sources
=======================================
http://www.riverbankcomputing.com/software/sip/download
http://www.riverbankcomputing.com/software/pyqt/download
Extract each of the above zip files in a temporary directory. Make sure
to get versions that match your current Qt installed version.
4.2.4.3. Compile SIP
====================
c:\Qt\4.7.0\bin\qtvars.bat
python configure.py -p win32-g++
make
make install
4.2.4.4. Compile PyQt
=====================
c:\Qt\4.7.0\bin\qtvars.bat
python configure.py
make
make install
4.2.4.5. Final python notes
===========================
/!\ You can delete the directories with unpacked SIP and PyQt4 sources after a
successfull install, they're not needed anymore.
4.2.5. git
==========
In order to check out QGIS sources from the repository, you need a git client.
This installer should work fine:
http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe
4.2.6. CMake
============
CMake is build system used by QGIS. Download it from here:
http://www.cmake.org/files/v2.8/cmake-2.8.2-win32-x86.exe
4.2.7. 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 GIT:
git clone git://github.com/qgis/QGIS.git
4.2.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.7.0\bin\qtvars.bat
For ease of use add c:\Qt\4.7.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
4.2.9. 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 scripts I recommend to leave the install
prefix to its default c:\program files\
When configuration is done, click 'OK' to exit the setup utility.
4.2.10. Compilation and installation
====================================
make make install
4.2.11. 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.
A 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.
4.2.12. Create the installation package: (optional)
===================================================
Download 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'.
4.3. Creation of MSYS environment for compilation of QGIS
=========================================================
4.3.1. Initial setup
====================
4.3.1.1. 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).
4.3.1.2. 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.
4.3.1.3. 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
4.3.2. Installing dependencies
==============================
4.3.2.1. 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
4.3.2.2. GRASS
==============
Grab sources from CVS or use a weekly snapshot, see:
http://grass.itc.it/devel/cvs.php
In MSYS console go to the directory where you've unpacked or checked out sources
(e.g. c:\msys\local\src\grass-6.3.cvs)
Run these commands:
export PATH="/usr/local/bin:/usr/local/lib:$PATH"
./configure --prefix=/usr/local --bindir=/usr/local --with-includes=/usr/local/include --with-libs=/usr/local/lib --with-cxx --without-jpeg \
--without-tiff --with-postgres=yes --with-postgres-includes=/local/pgsql/include --with-pgsql-libs=/local/pgsql/lib --with-opengl=windows --with-fftw \
--with-freetype --with-freetype-includes=/mingw/include/freetype2 --without-x --without-tcltk --enable-x11=no --enable-shared=yes \
--with-proj-share=/usr/local/share/proj
make
make install
It should get installed to c:\msys\local\grass-6.3.cvs
By the way, these pages might be useful:
- http://grass.gdf-hannover.de/wiki/WinGRASS_Current_Status
- http://geni.ath.cx/grass.html
4.3.2.3. GEOS
=============
Download the sources:
http://geos.refractions.net/geos-2.2.3.tar.bz2
Unpack to e.g. c:\msys\local\src
To compile, I had to patch the sources: in file source/headers/timeval.h line 13.
Change it from:
#ifdef _WIN32
to:
#if defined(_WIN32) && defined(_MSC_VER)
Now, in MSYS console, go to the source directory and run:
./configure --prefix=/usr/local
make
make install
4.3.2.4. SQLITE
===============
You can use precompiled DLL, no need to compile from source:
Download this archive:
http://www.sqlite.org/sqlitedll-3_3_17.zip
and copy sqlite3.dll from it to c:\msys\local\lib
Then download this archive:
http://www.sqlite.org/sqlite-source-3_3_17.zip
and copy sqlite3.h to c:\msys\local\include
4.3.2.5. GSL
============
Download sources:
ftp://ftp.gnu.org/gnu/gsl/gsl-1.9.tar.gz
Unpack to c:\msys\local\src
Run from MSYS console in the source directory:
./configure
make
make install
4.3.2.6. EXPAT
==============
Download sources:
http://dfn.dl.sourceforge.net/sourceforge/expat/expat-2.0.0.tar.gz
Unpack to c:\msys\local\src
Run from MSYS console in the source directory:
./configure
make
make install
4.3.2.7. POSTGRES
=================
We're going to use precompiled binaries. Use the link below for download:
http://wwwmaster.postgresql.org/download/mirrors-ftp?file=%2Fbinary%2Fv8.2.4%2Fwin32%2Fpostgresql-8.2.4-1-binaries-no-installer.zip
copy contents of pgsql directory from the archive to c:\msys\local
4.3.3. Cleanup
==============
We're done with preparation of MSYS environment. Now you can delete all stuff in c:\msys\local\src - it takes quite a lot
of space and it's not necessary at all.
5. Building on MacOS X
======================
In this approach I will try to avoid as much as possible building dependencies
from source and rather use frameworks wherever possible.
"Universal", SDK and non-default arch builds require more complex options and
some fiddling with the system. It is best to stick with a single, default,
architecture build and follow these instructions for an initial build.
Included are notes for building on Mac OS X 10.5 (Leopard), 10.6
(Snow Leopard), 10.7 (Lion), 10.8 (Mt. Lion) and 10.9 (Mavericks)
(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,
it means type "cd " (without the quotes, make sure to type a space after) and
then type the path to said folder, then <return>. A simple way to do this
without having to know and type the full path is, after type the "cd " part,
drag the folder (use the icon in its window title bar, or drag a folder from
within a window) from the Desktop to the Terminal, then tap <return>.
Parallel Compilation: On multiprocessor/multicore Macs, it's possible to
speed up compilation, but it's not automatic. Whenever you type "make" (but
NOT "make install"), instead type:
make -j [#cpus]
Replace [#cpus] with the number of cores and/or processors your Mac has. On recent
models with hyperthreading processors this can be double the physical count of
processors and cores.
ie: Mac Pro "8 Core" model (2 quad core processors) = 8
ie: Macbook Pro i5 (hyperthreading) = 2 cores X 2 = 4
To find out how many CPUs you have available, run the following in Terminal:
/usr/sbin/sysctl -n hw.ncpu
which can be used in build shell scripts like:
make -j $(/usr/sbin/sysctl -n hw.ncpu)
Note: if you get an error in parallel compilation, try removing the -j # flag,
so it's just 'make', or using a smaller number. Sometimes make can hiccup on too
many threads.
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.
Downloading Xcode/Developer Tools for up through Snow Leopard 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 and above, you can get Xcode from either a
free developer account or for a minimal fee from the app store.
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
On Lion and Mt. Lion, using Xcode 4.4+, the developer command line tools can be