-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathINSTALL
2665 lines (1557 loc) · 76.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
Quantum GIS (QGIS)
Building QGIS from source - step by step
------------------------------------------------------------------------
1. Introduction
2. General Build Notes
2.1. An overview of the dependencies required for building
3. Building under windows using msys
3.1. MSYS:
3.2. Qt4.3
3.3. Flex and Bison
3.4. Python stuff: (optional)
3.4.1. Download and install Python - use Windows installer
3.4.2. Download SIP and PyQt4 sources
3.4.3. Compile SIP
3.4.4. Compile PyQt
3.4.5. Final python notes
3.5. Subversion:
3.6. CMake:
3.7. QGIS:
3.8. Compiling:
3.9. Configuration
3.10. Compilation and installation
3.11. Run qgis.exe from the directory where it's installed (CMAKE_INSTALL_PREFIX)
3.12. Create the installation package: (optional)
4. Building on Mac OSX using frameworks and cmake or Xcode
4.1. Install Xcode
4.2. Install Qt4 from .dmg
4.3. Install development frameworks for QGIS dependencies
4.3.1. Additional Dependencies : General compatibility note
4.3.2. Additional Dependencies : Expat
4.3.3. Additional Dependencies : Python
4.3.4. Additional Dependencies : SIP
4.3.5. Additional Dependencies : PyQt
4.3.6. Additional Dependencies : Qwt/PyQwt
4.3.7. Additional Dependencies : Bison
4.4. Install CMake for OSX
4.5. Install subversion for OSX
4.6. Check out QGIS from SVN
4.7. Configure the build
4.7.1. Configure the CMake build
4.7.2. Configure the Xcode build
4.8. Building
4.8.1. Building with Cmake
4.8.2. Building with Xcode
5. Building on GNU/Linux
5.1. Building QGIS with Qt4.x
5.2. Prepare apt
5.3. Install Qt4
5.4. Install additional software dependencies required by QGIS
5.5. GRASS Specific Steps
5.6. Setup ccache (Optional)
5.7. Prepare your development environment
5.8. Check out the QGIS Source Code
5.9. Starting the compile
5.10. Building Debian packages
5.11. Running QGIS
5.12. A practical case: Building QGIS and GRASS from source on Ubuntu with ECW and MrSID formats support
5.12.1. Step 1: install base packages
5.12.2. Step 2: compile and install the ecw libraries
5.12.3. Step 3: download the MrSID binaries
5.12.4. Step 4: compile and install the gdal libraries
5.12.5. Step 5: compile and install GRASS
5.12.6. Step 6: compile and install QGIS
6. Creation of MSYS environment for compilation of Quantum GIS
6.1. Initial setup
6.1.1. MSYS
6.1.2. MinGW
6.1.3. Flex and Bison
6.2. Installing dependencies
6.2.1. Getting ready
6.2.2. GRASS
6.2.3. GEOS
6.2.4. SQLITE
6.2.5. GSL
6.2.6. EXPAT
6.2.7. POSTGRES
6.3. Cleanup
7. Building with MS Visual Studio
7.1. Setup Visual Studio
7.1.1. Express Edition
7.1.2. All Editions
7.2. Download/Install Dependencies
7.2.1. Flex and Bison
7.2.2. To include PostgreSQL support in Qt
7.2.3. Qt
7.2.4. Proj.4
7.2.5. GSL
7.2.6. GEOS
7.2.7. GDAL
7.2.8. PostGIS
7.2.9. Expat
7.2.10. CMake
7.3. Building QGIS with CMAKE
8. Building under Windows using MSVC Express
8.1. System preparation
8.2. Install the libraries archive
8.3. Install Visual Studio Express 2005
8.4. Install Microsoft Platform SDK2
8.5. Edit your vsvars
8.6. Environment Variables
8.7. Building Qt4.3.2
8.7.1. Compile Qt
8.7.2. Configure Visual C++ to use Qt
8.8. Install Python
8.9. Install SIP
8.10. Install PyQt4
8.11. Install CMake
8.12. Install Subversion
8.13. Initial SVN Check out
8.14. Create Makefiles using cmakesetup.exe
8.15. Running and packaging
9. Authors and Acknowledgments
------------------------------------------------------------------------
1. 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://www.qgis.org/wiki/Installation_Guide
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 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.
/!\ *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
2. General Build Notes
======================
Since 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 (http://www.cmake.org)
for building from source. The configure script in this directory simply checks
for the existence of cmake and provides some clues to build QGIS.
2.1. An overview of the dependencies required for building
==========================================================
'''Required build deps:'''
* CMake >= 2.6.0
* Flex, Bison
'''Required runtime deps:'''
* Qt >= 4.4.0
* Proj >= 4.4.x
* GEOS >= 3.0
* Sqlite3 >= 3.0.0
* GDAL/OGR >= 1.4.x
'''Optional dependencies:'''
* for GRASS plugin - GRASS >= 6.0.0 (libraries compiled with exceptions support)
* for georeferencer - GSL >= 1.8
* for postgis support and SPIT plugin - PostgreSQL >= 8.0.x
* for gps plugin - expat >= 1.95
* for mapserver export and PyQGIS - Python >= 2.3 (2.5+ preferred)
* for PyQGIS - SIP >= 4.8, PyQt >= must match Qt version
* for GPS tracking - Qwt >= 5.0
'''Recommended runtime deps:'''
* for gps plugin - gpsbabel
3. Building under windows using msys
====================================
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...
3.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.
3.2. Qt4.3
==========
Download qt4.3 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.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
3.3. 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
3.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.
3.4.1. Download and install Python - use Windows installer
==========================================================
(It doesn't matter to what folder you'll install it)
http://python.org/download/
3.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.
3.4.3. Compile SIP
==================
c:\Qt\4.3.0\bin\qtvars.bat
python configure.py -p win32-g++
make
make install
3.4.4. Compile PyQt
===================
c:\Qt\4.3.0\bin\qtvars.bat
python configure.py
make
make install
3.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.
3.5. 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
3.6. 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
3.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 SVN For svn head:
svn co https://svn.osgeo.org/qgis/trunk/qgis
For svn 0.8 branch
svn co https://svn.osgeo.org/qgis/branches/Release-0_8_0 qgis0.8
3.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
3.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 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.
3.10. Compilation and installation
==================================
make make install
3.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.
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.
3.12. 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'.
4. Building on Mac OSX using frameworks and cmake or Xcode
==========================================================
In this approach I will try to avoid as much as possible building dependencies
from source and rather use frameworks wherever possible.
The base system here is Mac OS X 10.4 (Tiger) and below. Included are a few notes
for building on Mac OS X 10.5 (Leopard) and 10.6 (Snow Leopard).
Snow Leopard note: A cmake/qt/sip bug currently exists where a 32-bit
cmake build fails to provide python bindings. This means that python plugin support
is currently lacking for 32-bit builds using cmake in Snow Leopard. See the Xcode
build method to if you require python support.
4.1. Install Xcode
==================
I recommend to get the latest Xcode dmg from the Apple XDC Web site
(http:/developer.apple.com). The Mac system install disks come with a copy of
Xcode, but it's likely out of date.
Install Xcode after the ~1gb download is complete.
/!\ Note: It may be that you need to create some symlinks after installing
Xcode (in particular if you are using Xcode 2.5 on Tiger):
cd /Developer/SDKs/MacOSX10.4u.sdk/usr/
sudo mv local/ local_
sudo ln -s /usr/local/ local
4.2. Install Qt4 from .dmg
==========================
You need a minimum of Qt-4.4.0. I suggest getting the latest.
Snow Leopard note: If you are building on Snow Leopard, you will need to
decide between 32-bit support in the older, Qt Carbon branch, or 64-bit
support in the Qt Cocoa branch. Appropriate installers are available for both
as of Qt-4.5.2. Qt 4.6+ is recommended for Cocoa.
http://qt.nokia.com/downloads
If you want debug frameworks, Qt also provides a dmg with these. These are in
addition to the non-debug frameworks.
Once downloaded open the dmg and run the installer. Note you need admin
privileges to install.
Qt note: Starting in Qt 4.4, libQtCLucene was added, and in 4.5
libQtUiTools was added, both in /usr/lib. When using a system SDK (which will
happen in the Xcode build), these libraries will not be found. To fix this problem,
add symlinks to /usr/local:
sudo ln -s /usr/lib/libQtUiTools.a /usr/local/lib/
sudo ln -s /usr/lib/libQtCLucene.dylib /usr/local/lib/
These should then be found automatically on Leopard and above. Earlier systems
may need some help by adding '-L/usr/local/lib' to CMAKE_SHARED_LINKER_FLAGS,
CMAKE_MODULE_LINKER_FLAGS and CMAKE_EXE_LINKER_FLAGS in the cmake build.
4.3. Install development frameworks for QGIS dependencies
=========================================================
Download William Kyngesburye's excellent GDAL Complete package that includes
PROJ, GEOS, GDAL, SQLite3, and image libraries, as frameworks. There is also
a GSL framework.
http://www.kyngchaos.com/wiki/software:frameworks
Once downloaded, open and install the frameworks.
William provides an additional installer package for Postgresql (for PostGIS support).
Qgis just needs the libpq client library, so unless you want to setup the full
Postgres + PostGIS server, all you need is the client-only package.
It's available here:
http://www.kyngchaos.com/wiki/software:postgres
Also available is a GRASS application:
http://www.kyngchaos.com/wiki/software:grass
4.3.1. Additional Dependencies : General compatibility note
===========================================================
There are some additional dependencies that, at the time of writing, are not
provided as frameworks or installers so we will need to build these from source.
If you are wanting to build Qgis as a 64-bit application, you will need to
provide the appropriate build commands to produce 64-bit support in dependencies.
Likewise, for 32-bit support on Snow Leopard, you will need to override the
default system architecture, which is 64-bit, according to instructions for
individual dependency packages.
4.3.2. Additional Dependencies : Expat
======================================
Snow Leopard note: Snow Leopard includes a usable expat, so this step is
not necessary on Snow Leopard.
Get the expat sources:
http://sourceforge.net/project/showfiles.php?group_id=10127
Double-click the source tarball to unpack, then, in Terminal.app, cd to the source folder and:
./configure
make
sudo make install
Leopard note: To compile for 64bit, substitute the standard configure line with:
./configure CFLAGS="-Os -arch x86_64"
4.3.3. Additional Dependencies : Python
=======================================
Leopard and Snow Leopard note: Leopard and Snow Leopard include a usable
Python 2.5 and 2.6, respectively. So there is no need to install Python on
Leopard and Snow Leopard. You can still install Python from python.org if preferred.
Make sure you install at least the latest Python 2.5 from
http://www.python.org/download/
Python 3 is a major change, and may have compatibility issues, so try it at your own risk.
4.3.4. Additional Dependencies : SIP
====================================
Retrieve the python bindings toolkit SIP from
http://www.riverbankcomputing.com/software/sip/download
Double-click the source tarball to unpack it, then, in Terminal.app, cd to the source folder
and (this installs by default into the Python framework, and is appropriate only for python.org Python installs):
python configure.py
make
sudo make install
Leopard notes
If building on Leopard, using Leopard's bundled Python, SIP wants to install in the
system path -- this is not a good idea. Use this configure command instead of the
basic configure above:
python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip
Snow Leopard notes
Similar to Leopard, you should install outside the system Python path.
Also, you need to specify the architecture you want (requires at least SIP 4.9),
and make sure to run the versioned python binary (this one responds to the
'arch' command, 'python' does not). If you are using 32-bit Qt (Qt Carbon):
python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip --arch=i386
For 64-bit Qt (Qt Cocoa), use this configure line:
python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64
4.3.5. Additional Dependencies : PyQt
=====================================
Retrieve the python bindings toolkit for Qt from
http://www.riverbankcomputing.com/software/pyqt/download
Double-click the source tarball to unpack it, then, in Terminal.app, cd to the source folder
and (this installs by default into the Python framework, and is appropriate only for python.org Python installs):
export QTDIR=/Developer/Applications/Qt
python configure.py
yes
There is a problem with the configuration that needs to be fixed now (it affects PyQwt compilation later). Edit pyqtconfig.py and change the qt_dir line to:
'qt_dir': '/usr',
Then continue with compilation and installation:
make
sudo make install
Leopard notes
If building on Leopard, using Leopard's bundled Python, PyQt wants to install
in the system path -- this is not a good idea. Use this configure command
instead of the basic configure above:
python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin
If there is a problem with undefined symbols in QtOpenGL on Leopard, edit
QtOpenGL/makefile and add -undefined dynamic_lookup to LFLAGS.
Then make again.
Snow Leopard notes
Similar to Leopard, you should install outside the system Python path.
Also, you need to specify the architecture you want (requires at least PyQt 4.6),
and make sure to run the versioned python binary (this one responds to the
'arch' command, which is important for pyuic4, 'python' does not).
If you are using 32-bit Qt (Qt Carbon):
python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch i386
For 64-bit Qt (Qt Cocoa), use this configure line:
python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch x86_64
4.3.6. Additional Dependencies : Qwt/PyQwt
==========================================
The GPS tracking feature uses Qwt. Some popular 3rd-party plugins use PyQwt.
You can take care of both with the PyQwt source from:
http://pyqwt.sourceforge.net/
Double-click the tarball to unpack it. The following assumes PyQwt v5.2.0 (comes with Qwt 5.2.1).
Now, first edit qwtconfig.pri in the qwt-5.2 subdir and change some settings so
you don't get a bloated debug static library (too bad they are not configurable from
qmake). Scroll down to the 'release/debug mode' block. Edit the last 'CONFIG +='
line, within an 'else' block, and change 'debug' to 'release'. Also uncomment
(remove # prefix) the line 'CONFIG += QwtDll'.
Save and close.
Now, cd into the qwt-5.2 subdir in a Terminal. Type these commands to build and install:
qmake -spec macx-g++
make
sudo make install
The Qwt shared library is now installed in /usr/local/qwt-5.x.x[-svn] (x.x is the
minor.point version, and it may be an SVN version). Remember this for QGIS and PyQwt configuration.
Now for PyQwt. Still in the Terminal:
cd ../configure
python configure.py --extra-include-dirs=/usr/local/qwt-5.2.1-svn/include \
--extra-lib-dirs=/usr/local/qwt-5.2.1-svn/lib --extra-libs=qwt
make
sudo make install
Make sure to use the qwt install path from the Qwt build above.
Snow Leopard note
If using Qt Carbon, you need to specify which architectures to build, otherwise
it will default to a combination that does not work (ie x86_64 for a Carbon Qt).
This is not needed for Qt Cocoa. Configure as follows:
python configure.py --extra-cflags="-arch i386" --extra-cxxflags="-arch i386" \
--extra-lflags="-arch i386" --extra-include-dirs=/usr/local/qwt-5.2.1-svn/include \
--extra-lib-dirs=/usr/local/qwt-5.2.1-svn/lib --extra-libs=qwt
4.3.7. Additional Dependencies : Bison
======================================
Leopard and Snow Leopard note: Leopard and Snow Leopard include Bison 2.3, so this step can be skipped on Leopard and Snow Leopard.
The version of bison available by default on Mac OS X 10.4 and older is too old so you need to
get a more recent one on your system. Download at least version 2.3 from:
ftp.gnu.org/gnu/bison/
Now build and install it to a prefix of /usr/local.Ê Double-click the source
tarball to unpack it, then cd to the source folder and:
./configure --prefix=/usr/local
make
sudo make install
4.4. Install CMake for OSX
==========================
Get the latest source release from here:
http://www.cmake.org/cmake/resources/software.html
Binary installers are available for OS X, but they are not recommended
(2.4 versions install in /usr instead of /usr/local, and 2.6 versions are a
strange application). Instead, download the source, double-click the source tarball,
then cd to the source folder and:
./bootstrap --docdir=/share/doc/CMake --mandir=/share/man
make
sudo make install
4.5. Install subversion for OSX
===============================
Leopard and Snow Leopard note: Leopard and Snow Leopard (Xcode 3+)
include SVN, so this step can be skipped on Leopard and Snow Leopard.
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.
4.6. 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 (or some folder of your choice):
mkdir -p ~/dev/cpp cd ~/dev/cpp
Now we check out the sources:
Trunk:
svn co https://svn.osgeo.org/qgis/trunk/qgis qgis
For a release branch version x.y.z:
svn co https://svn.qgis.org/qgis/branches/Release-x_y_z qgis-x.y.z
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.
4.7. Configure the build
========================
There are 2 different methods to build QGIS: the traditional CMake method,
and the new Xcode project (starting with QGIS 1.1). The Xcode project has
additional bundling steps, though some optional QGIS features must be explicitly
stated in a user configuration file. The CMake build handles optional features,
and some bundling steps are available with scripts in the mac directory.
4.7.1. Configure the CMake build
================================
CMake supports out of source build so we will create a 'build' dir for the
build process. OS X uses ${HOME}/Applications as a standard user app folder (it gives it the system app folder icon).
If you have the correct permissions you may want to build
straight into your /Applications folder. The instructions below assume you are
building into a pre-existing ${HOME}/Applications directory ...
cd qgis
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D CMAKE_BUILD_TYPE=Release ..
To use the application build of GRASS on OSX, you can optionally use the
following cmake invocation (minimum GRASS 6.3 required, substitute the GRASS
version as required):
cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D CMAKE_BUILD_TYPE=Release \
-D GRASS_INCLUDE_DIR=/Applications/GRASS-6.4.app/Contents/MacOS/include \
-D GRASS_PREFIX=/Applications/GRASS-6.4.app/Contents/MacOS \
..
Or, to use a Unix-style build of GRASS, use the following cmake invocation
(minimum GRASS version as stated in the Qgis requirements, substitute the GRASS
path and version as required):
cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D CMAKE_BUILD_TYPE=Release \
-D GRASS_INCLUDE_DIR=/user/local/grass-6.4.0/include \
-D GRASS_PREFIX=/user/local/grass-6.4.0 \
..
Leopard note: To find the custom install of SIP on Leopard, add
'-D SIP_BINARY_PATH=/usr/local/bin/sip' to the cmake commands above,
before the '..' at the end, ie:
cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D CMAKE_BUILD_TYPE=Release \
-D SIP_BINARY_PATH=/usr/local/bin/sip \
..
Snow Leopard note: To handle the appropriate version of Qt (32-bit or 64-bit), you will need to invoke cmake based on which version of Qt you installed. Also, SIP/PyQt detection will fail for 32bit because Python runs 64bit.
For 32-bit Qt (Carbon) with GRASS-6.4, create a 32bit python script and add arch flags to the configuration:
sudo cat >/usr/local/bin/python32 <<EOF
#!/bin/sh
exec arch -i386 /usr/bin/python2.6 \${1+"\$@"}
EOF
sudo chmod +x /usr/local/bin/python32
cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D CMAKE_BUILD_TYPE=Release \
-D SIP_BINARY_PATH=/usr/local/bin/sip \
-D CMAKE_CXX_FLAGS="-arch i386" -D CMAKE_OSX_ARCHITECTURES=i386 \
-D GRASS_INCLUDE_DIR=/Applications/GRASS-6.4.app/Contents/MacOS/include \
-D GRASS_PREFIX=/Applications/GRASS-6.4.app/Contents/MacOS \
-D PYTHON_EXECUTABLE=/usr/local/bin/python32 \
..
For 64-bit Qt (Cocoa) with GRASS-6.4:
cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D CMAKE_BUILD_TYPE=Release \
-D SIP_BINARY_PATH=/usr/local/bin/sip \
-D CMAKE_CXX_FLAGS="-arch x86_64" -D CMAKE_OSX_ARCHITECTURES=x86_64 \
-D GRASS_INCLUDE_DIR=/Applications/GRASS-6.4.app/Contents/MacOS/include \
-D GRASS_PREFIX=/Applications/GRASS-6.4.app/Contents/MacOS \
..