@@ -29,16 +29,21 @@ Building QGIS from source - step by step
29
29
4.1. Install XCODE
30
30
4.2. Install Qt4 from .dmg
31
31
4.3. Install development frameworks for QGIS dependencies
32
- 4.3.1. Additional Dependencies : GSL
33
- 4.3.2. Additional Dependencies : Expat
34
- 4.3.3. Additional Dependencies : SIP
35
- 4.3.4. Additional Dependencies : PyQt
36
- 4.3.5. Additional Dependencies : Bison
32
+ 4.3.1. Additional Dependencies : General compatibility note
33
+ 4.3.2. Additional Dependencies : GSL
34
+ 4.3.3. Additional Dependencies : Expat
35
+ 4.3.4. Additional Dependencies : SIP
36
+ 4.3.5. Additional Dependencies : PyQt
37
+ 4.3.6. Additional Dependencies : Bison
37
38
4.4. Install CMAKE for OSX
38
39
4.5. Install subversion for OSX
39
40
4.6. Check out QGIS from SVN
40
41
4.7. Configure the build
42
+ 4.7.1. Configure the Cmake build
43
+ 4.7.2. Configure the Xcode build
41
44
4.8. Building
45
+ 4.8.1. Building with Cmake
46
+ 4.8.2. Building with Xcode
42
47
5. Building on GNU/Linux
43
48
5.1. Building QGIS with Qt4.x
44
49
5.2. Prepare apt
@@ -51,6 +56,14 @@ Building QGIS from source - step by step
51
56
5.9. Starting the compile
52
57
5.10. Building Debian packages
53
58
5.11. Running QGIS
59
+ 5.12. A practical case: Building QGIS and GRASS from source on Ubuntu with ECW and MrSID formats support
60
+ 5.12.1. Step 1: install base packages
61
+ 5.12.2. Step 2: compile and install the ecw libraries
62
+ 5.12.3. Step 3: download the MrSID binaries
63
+ 5.12.4. Step 4: compile and install the gdal libraries
64
+ 5.12.5. Step 5: compile and install GRASS
65
+ 5.12.6. Step 6: compile and install the GDAL-GRASS libraries
66
+ 5.12.7. Step 6: compile and install QGIS
54
67
6. Creation of MSYS environment for compilation of Quantum GIS
55
68
6.1. Initial setup
56
69
6.1.1. MSYS
@@ -453,14 +466,20 @@ on qgis.nsi and choose the option 'Compile NSIS Script'.
453
466
In this approach I will try to avoid as much as possible building dependencies
454
467
from source and rather use frameworks wherever possible.
455
468
456
- Included are a few notes for building on Mac OS X 10.5 (Leopard).
469
+ Included are a few notes for building on Mac OS X 10.5 (Leopard) and 10.6
470
+ (Snow Leopard).
471
+
472
+ Snow Leopard note: A cmake/qt/sip bug currently exists where a 32-bit
473
+ cmake build fails to provide python bindings. This means that python plugin support
474
+ is currently lacking for 32-bit builds using cmake in Snow Leopard. See the Xcode
475
+ build method to if you require python support.
457
476
458
477
459
478
4.1. Install XCODE
460
479
==================
461
480
462
481
I recommend to get the latest xcode dmg from the Apple XDC Web site. Install
463
- XCODE after the ~941mb download is complete.
482
+ XCODE after the ~1gb download is complete.
464
483
465
484
/!\ Note: It may be that you need to create some symlinks after installing
466
485
the XCODE SDK (in particular if you are using XCODE 2.5 on tiger):
@@ -475,29 +494,40 @@ the XCODE SDK (in particular if you are using XCODE 2.5 on tiger):
475
494
4.2. Install Qt4 from .dmg
476
495
==========================
477
496
478
- You need a minimum of Qt4.3.0. I suggest getting the latest (at time of writing).
497
+ You need a minimum of Qt-4.3.0. I suggest getting the latest (at time of writing).
498
+
499
+ Snow Leopard note: If you are building on Snow Leopard, you will need to
500
+ decide between 32-bit support in the older, Qt Carbon branch, or 64-bit
501
+ support in the Qt Cocoa branch. Appropriate installers are available for both
502
+ as of Qt-4.6.0, but the beta version of Qt-4.6.0 has proven to introduce numerous
503
+ bugs in Qgis. Unfortunately, the 32-bit branch of Qt currently does not build with
504
+ python bindings (see notes below). You can achieve support for python in Qgis with
505
+ the Xcode build method noted below.
506
+
479
507
508
+ ftp://ftp.trolltech.com/qt/source/
480
509
481
- ftp://ftp.trolltech.com/qt/source/qt-mac-opensource-4.3.2.dmg
482
510
511
+ Mac versions are named as:
483
512
484
- If you want debug libs, Qt also provide a dmg with these:
485
513
514
+ qt-mac-opensource-x.y.z.dmg
486
515
487
- ftp://ftp.trolltech.com/qt/source/qt-mac-opensource-4.3.2-debug-libs.dmg
488
516
517
+ x, y, z being the major, minor and revision version.
489
518
490
- I am going to proceed using only release libs at this stage as the download for
491
- the debug dmg is substantially bigger. If you plan to do any debugging though
492
- you probably want to get the debug libs dmg. Once downloaded open the dmg and
493
- run the installer. Note you need admin access to install.
519
+ If you want debug frameworks, Qt also provide a dmg with these. These are in
520
+ addition to the non-debug frameworks.
521
+
522
+ Once downloaded open the dmg and run the installer. Note you need admin
523
+ privileges to install.
494
524
495
525
After installing you need to make two small changes:
496
526
497
527
First edit /Library/Frameworks/QtCore.framework/Headers/qconfig.h and
498
528
change
499
529
500
- /!\ Note this doesnt seem to be needed since version 4.2.3
530
+ /!\ Note: this isn't needed since version 4.2.3
501
531
502
532
QT_EDITION_Unknown to QT_EDITION_OPENSOURCE
503
533
@@ -509,116 +539,161 @@ Second change the default mkspec symlink so that it points to macx-g++:
509
539
sudo ln -sf macx-g++ default
510
540
511
541
542
+ /!\ Note: this doesn't seem to be needed since version 4.4.
543
+
512
544
513
545
4.3. Install development frameworks for QGIS dependencies
514
546
=========================================================
515
547
516
548
Download William Kyngesburye's excellent all in one framework that includes
517
- proj, gdal, sqlite3 etc
549
+ proj, gdal, sqlite3, etc.
518
550
519
551
520
552
http://www.kyngchaos.com/wiki/software:frameworks
521
553
522
554
523
555
Once downloaded, open and install the frameworks.
524
556
525
- William provides an additional installer package for Postgresql/PostGIS. Its
557
+ William provides an additional installer package for Postgresql/PostGIS. It's
526
558
available here:
527
559
528
560
529
561
http://www.kyngchaos.com/wiki/software:postgres
530
562
531
563
532
- There are some additional dependencies that at the time of writing are not
533
- provided as frameworks so we will need to build these from source.
564
+ Also available is a GRASS application:
565
+
566
+
567
+ http://www.kyngchaos.com/wiki/software:grass
568
+
569
+
570
+ 4.3.1. Additional Dependencies : General compatibility note
571
+ ===========================================================
534
572
573
+ There are some additional dependencies that, at the time of writing, are not
574
+ provided as frameworks or installers so we will need to build these from source.
575
+ If you are wanting to build Qgis as a 64-bit application, you will need to
576
+ provide the appropriate build commands to produce 64-bit support in dependencies.
577
+ Likewise, for 32-bit support on Snow Leopard, you will need to override the
578
+ default system architecture, which is 64-bit according to instructions for
579
+ individual dependency packages.
535
580
536
- 4.3.1. Additional Dependencies : GSL
581
+
582
+ 4.3.2. Additional Dependencies : GSL
537
583
====================================
538
584
539
- Retrieve the Gnu Scientific Library from
585
+ Retrieve the current version of the Gnu Scientific Library from:
540
586
541
587
542
- curl -O ftp://ftp.gnu.org/gnu/gsl/gsl-1.8.tar.gz
588
+ ftp://ftp.gnu.org/gnu/gsl/
543
589
544
590
545
- Then extract it and build it to a prefix of /usr/local:
591
+ Then extract it and build it to a prefix of /usr/local. Double-click the source
592
+ tarball to unpack it, then cd to the source folder and:
546
593
547
594
548
- tar xvfz gsl-1.8.tar.gz
549
- cd gsl-1.8
550
- ./configure --prefix=/usr/local
595
+ ./configure
551
596
make
552
597
sudo make install
553
- cd ..
554
598
555
599
600
+ Snow Leopard note: For explicit 32-bit support in gsl, substitute the standard
601
+ configure line with:
602
+
603
+
604
+ ./configure --build=i386
605
+
606
+
607
+ And for 64-bit gsl:
608
+
609
+
610
+ ./configure --build=x86_64
556
611
557
- 4.3.2. Additional Dependencies : Expat
612
+
613
+
614
+ 4.3.3. Additional Dependencies : Expat
558
615
======================================
559
616
617
+ Snow Leopard note: Snow Leopard includes a usable expat, so this step is
618
+ not necessary.
619
+
560
620
Get the expat sources:
561
621
562
622
563
623
http://sourceforge.net/project/showfiles.php?group_id=10127
564
624
565
625
626
+ Double-click the source tarball to unpack, then cd to the source folder and:
566
627
567
- tar xvfz expat-2.0.0.tar.gz
568
- cd expat-2.0.0
569
- ./configure --prefix=/usr/local
628
+
629
+ ./configure
570
630
make
571
631
sudo make install
572
- cd ..
573
632
574
633
575
634
576
- 4.3.3 . Additional Dependencies : SIP
635
+ 4.3.4 . Additional Dependencies : SIP
577
636
====================================
578
637
579
- Make sure you have the latest Python fom
638
+ Leopard and Snow Leopard note: Leopard and Snow Leopard include a usable Python
639
+ 2.5 or 2.6, respectively. You can install Python from python.org if preferred.
580
640
641
+ Make sure you have the latest Python 2.5 from
581
642
582
- http://www.python.org/download/mac/
583
643
644
+ http://www.python.org/download/mac/
584
645
585
- Leopard note: Leopard includes a usable Python 2.5. Though you can install Python from python.org if preferred.
586
646
587
647
Retrieve the python bindings toolkit SIP from
588
648
589
649
590
650
http://www.riverbankcomputing.com/software/sip/download
591
651
592
652
593
- Then extract and build it (this installs by default into the Python framework):
653
+ Double-click the source tarball to unpack it, then cd to the source folder
654
+ and (this installs by default into the Python framework):
594
655
595
656
596
- tar xvfz sip-<version number>.tar.gz
597
- cd sip-<version number>
598
657
python configure.py
599
658
make
600
659
sudo make install
601
- cd ..
602
660
603
661
604
662
Leopard notes
605
663
606
- 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:
664
+ If building on Leopard, using Leopard's bundled Python, SIP wants to install in the
665
+ system path -- this is not a good idea. Use this configure command instead of the
666
+ basic configure above:
607
667
608
668
609
669
python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip
610
670
611
671
672
+ Snow Leopard notes
673
+
674
+ If building on Snow Leopard, you need to use one of the following configure lines
675
+ based on your installed version of Qt. If you are using 32-bit Qt (Qt Carbon):
676
+
677
+
678
+ python configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip --arch i386
679
+
680
+
681
+ For 64-bit Qt (Qt Cocoa), use this configure line:
682
+
683
+
684
+ python 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
685
+
686
+
612
687
613
- 4.3.4 . Additional Dependencies : PyQt
688
+ 4.3.5 . Additional Dependencies : PyQt
614
689
=====================================
615
690
616
691
If you encounter problems compiling PyQt using the instructions
617
692
below you can also try adding python from your frameworks dir
618
693
explicitly to your path e.g.
619
694
620
695
621
- export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH$
696
+ export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
622
697
623
698
624
699
Retrieve the python bindings toolkit for Qt from
@@ -627,17 +702,15 @@ Retrieve the python bindings toolkit for Qt from
627
702
http://www.riverbankcomputing.com/software/pyqt/download
628
703
629
704
630
- Then extract and build it (this installs by default into the Python framework):
705
+ Double-click the source tarball to unpack it, then cd to the source folder
706
+ and (this installs by default into the Python framework):
631
707
632
708
633
- tar xvfz PyQt-mac<version number here>
634
- cd PyQt-mac<version number here>
635
709
export QTDIR=/Developer/Applications/Qt
636
710
python configure.py
637
711
yes
638
712
make
639
713
sudo make install
640
- cd ..
641
714
642
715
643
716
Leopard notes
@@ -648,55 +721,72 @@ If building on Leopard, using Leopard's bundled Python, PyQt wants to install in
648
721
python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin
649
722
650
723
651
- There may be a problem with undefined symbols in QtOpenGL on Leopard. Edit QtOpenGL/makefile and add -undefined dynamic_lookup to LFLAGS.
724
+ If there is a problem with undefined symbols in QtOpenGL on Leopard, edit
725
+ QtOpenGL/makefile and add -undefined dynamic_lookup to LFLAGS.
726
+ Then make again.
652
727
728
+ Snow Leopard notes
653
729
654
- 4.3.5. Additional Dependencies : Bison
730
+ If building on Snow Leopard, you need to use one of the following configure lines based on your installed version of Qt. If you are using 32-bit Qt (Qt Carbon):
731
+
732
+
733
+ python configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch i386
734
+
735
+
736
+ For 64-bit Qt (Qt Cocoa), use this configure line:
737
+
738
+
739
+ python configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch x86_64
740
+
741
+
742
+
743
+ 4.3.6. Additional Dependencies : Bison
655
744
======================================
656
745
657
- Leopard note: Leopard includes Bison 2.3, so this step can be skipped on Leopard.
746
+ Leopard and Snow Leopard note: Leopard and Snow Leopard includes Bison 2.3, so this step can be skipped on Leopard and Snow Leopard.
658
747
659
- The version of bison available by default on Mac OSX is too old so you need to
660
- get a more recent one on your system. Download if from:
748
+ The version of bison available by default on Mac OS X 10.4 and older is too old so you need to
749
+ get a more recent one on your system. Download at least version 2.3 from:
661
750
662
751
663
- curl -O http:// ftp.gnu.org/gnu/bison/bison-2.3.tar.gz
752
+ ftp.gnu.org/gnu/bison/
664
753
665
754
666
- Now build and install it to a prefix of /usr/local :
755
+ Now build and install it to a prefix of /usr/local.� Double-click the source
756
+ tarball to unpack it, then cd to the source folder and:
667
757
668
758
669
- tar xvfz bison-2.3.tar.gz
670
- cd bison-2.3
671
759
./configure --prefix=/usr/local
672
760
make
673
761
sudo make install
674
- cd ..
675
762
676
763
677
764
678
765
4.4. Install CMAKE for OSX
679
766
==========================
680
767
681
- Get the latest release from here:
768
+ Get the latest source release from here:
682
769
683
770
684
- http://www.cmake.org/HTML/Download .html
771
+ http://www.cmake.org/cmake/resources/software .html
685
772
686
773
687
- At the time of writing the file I grabbed was:
774
+ Binary installers are available for OS X, but they are not recommended
775
+ (2.4 versions install in /usr instead of /usr/local, and 2.6 versions are a
776
+ strange application). Instead, download the source, double-click the source tarball,
777
+ then cd to the source folder and:
688
778
689
779
690
- curl -O http://www.cmake.org/files/v2.4/cmake-2.4.6-Darwin-universal.dmg
691
-
780
+ ./bootstrap --docdir=/share/doc/CMake --mandir=/share/man
781
+ make
782
+ sudo make install
692
783
693
- Once downloaded open the dmg and run the installer
694
784
695
785
696
786
4.5. Install subversion for OSX
697
787
===============================
698
788
699
- Leopard note: Leopard includes SVN, so this step can be skipped on Leopard .
789
+ Leopard and Snow Leopard note: Leopard and Snow Leopard include SVN, so this step can be skipped on these Operating Systems .
700
790
701
791
The http://sourceforge.net/projects/macsvn/ (MacSVN) project has a downloadable
702
792
build of svn. If you are a GUI inclined person you may want to grab their gui
@@ -756,16 +846,10 @@ Trunk:
756
846
svn co https://svn.osgeo.org/qgis/trunk/qgis qgis
757
847
758
848
759
- For svn 0.8 branch
760
-
849
+ For a release branch version x.y.z:
761
850
762
- svn co https://svn.osgeo.org/qgis/branches/Release-0_8_0 qgis0.8
763
851
764
-
765
- For svn 0.9 branch
766
-
767
-
768
- svn co https://svn.qgis.org/qgis/branches/Release-0_9_0 qgis0.9
852
+ svn co https://svn.qgis.org/qgis/branches/Release-x_y_z qgis-x.y.z
769
853
770
854
771
855
The first time you check out QGIS sources you will probably get a message like
@@ -788,6 +872,16 @@ I suggest you press 'p' to accept the key permanently.
788
872
4.7. Configure the build
789
873
========================
790
874
875
+ There are 2 different methods to build QGIS: the traditional Cmake method,
876
+ and the new Xcode project (starting with QGIS 1.1). The Xcode project has
877
+ additional bundling steps, though some optional Qgis features must be explicitly
878
+ stated in a user configuration file. The Cmake build handles optional features,
879
+ and some bundling steps are available with scripts in the mac directory.
880
+
881
+
882
+ 4.7.1. Configure the Cmake build
883
+ ================================
884
+
791
885
CMake supports out of source build so we will create a 'build' dir for the
792
886
build process. By convention I build my software into a dir called 'apps' in
793
887
my home directory. If you have the correct permissions you may want to build
@@ -806,8 +900,10 @@ D SIP_BINARY_PATH=/usr/local/bin/sip"" to the cmake command above,
806
900
before the .. at the end, ie:
807
901
808
902
809
- cmake -D CMAKE_INSTALL_PREFIX=$HOME/apps/ -D CMAKE_BUILD_TYPE=Release -
810
- D SIP_BINARY_PATH=/usr/local/bin/sip ..
903
+ cmake -D CMAKE_INSTALL_PREFIX=$HOME/apps/ \
904
+ -D CMAKE_BUILD_TYPE=Release \
905
+ -D SIP_BINARY_PATH=/usr/local/bin/sip \
906
+ ..
811
907
812
908
813
909
To use the application build of GRASS on OSX, you can optionally use the
@@ -816,9 +912,9 @@ version as required):
816
912
817
913
818
914
cmake -D CMAKE_INSTALL_PREFIX=${HOME}/apps/ \
819
- -D GRASS_INCLUDE_DIR=/Applications/GRASS-6.3 .app/Contents/MacOS/
915
+ -D GRASS_INCLUDE_DIR=/Applications/GRASS-6.4 .app/Contents/MacOS/
820
916
include \
821
- -D GRASS_PREFIX=/Applications/GRASS-6.3 .app/Contents/MacOS \
917
+ -D GRASS_PREFIX=/Applications/GRASS-6.4 .app/Contents/MacOS \
822
918
-D CMAKE_BUILD_TYPE=Release \
823
919
..
824
920
@@ -829,16 +925,66 @@ path and version as required):
829
925
830
926
831
927
cmake -D CMAKE_INSTALL_PREFIX=${HOME}/apps/ \
832
- -D GRASS_INCLUDE_DIR=/user/local/grass-6.3 .0/include \
833
- -D GRASS_PREFIX=/user/local/grass-6.3 .0 \
928
+ -D GRASS_INCLUDE_DIR=/user/local/grass-6.4 .0/include \
929
+ -D GRASS_PREFIX=/user/local/grass-6.4 .0 \
834
930
-D CMAKE_BUILD_TYPE=Release \
835
931
..
836
932
837
933
934
+ 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.
935
+
936
+ For 32-bit Qt (Carbon) with GRASS-6.4:
937
+
938
+
939
+ cmake -D CMAKE_INSTALL_PREFIX=$HOME/apps/ \
940
+ -D CMAKE_BUILD_TYPE=Release \
941
+ -D SIP_BINARY_PATH=/usr/local/bin/sip
942
+ -D CMAKE_C_FLAGS=-m32 \
943
+ -D CMAKE_CXX_FLAGS=-m32
944
+ -D CMAKE_OSX_ARCHITECTURES=i386
945
+ -D GRASS_PREFIX=/Applications/GRASS-6.4.app/Contents/MacOS \
946
+ -D GRASS_INCLUDE_DIR=/Applications/GRASS-6.4.app/Contents/MacOS/include\
947
+ ..
948
+
949
+
950
+ For 64-bit Qt (Cocoa) with GRASS-6.4:
951
+
952
+
953
+ cmake -D CMAKE_INSTALL_PREFIX=$HOME/apps/ \
954
+ -D CMAKE_BUILD_TYPE=Release \
955
+ -D SIP_BINARY_PATH=/usr/local/bin/sip
956
+ -D CMAKE_C_FLAGS=-m64 \
957
+ -D CMAKE_CXX_FLAGS=-m64
958
+ -D CMAKE_OSX_ARCHITECTURES=x86_64
959
+ -D GRASS_PREFIX=/Applications/GRASS-6.4.app/Contents/MacOS \
960
+ -D GRASS_INCLUDE_DIR=/Applications/GRASS-6.4.app/Contents/MacOS/include\
961
+ ..
962
+
963
+
964
+
965
+ 4.7.2. Configure the Xcode build
966
+ ================================
967
+
968
+ In the mac/xcode folder in the source, duplicate the 'qgis_user-template.xcconfig'
969
+ file and name it 'qgis_user.xcconfig'. A default build will use the KyngChaos
970
+ frameworks, Postgres, GRASS 6.4, the python.org Python 2.5 and extra dependencies
971
+ as described above, and compile for the current OSX architecture and version, so no
972
+ extra configuration is necessary. If building on Leopard or newer, you may want to
973
+ use the system Python, which requires editing qgis_user.xcconfig.
974
+
975
+ See the mac/xcode/readme.rtf for details, if you need to customize the build.
976
+ The default build will also bundle the Qt frameworks, Postgres library, and
977
+ other dependency libraries to create a self-contained package. The KyngChaos
978
+ frameworks and GRASS application are not bundled.
979
+
838
980
839
981
4.8. Building
840
982
=============
841
983
984
+
985
+ 4.8.1. Building with Cmake
986
+ ==========================
987
+
842
988
Now we can start the build process:
843
989
844
990
@@ -851,6 +997,38 @@ If all built without errors you can then install it:
851
997
make install
852
998
853
999
1000
+ or, for a Unix-style build
1001
+
1002
+
1003
+ sudo make install
1004
+
1005
+
1006
+
1007
+ 4.8.2. Building with Xcode
1008
+ ==========================
1009
+
1010
+ Open the Xcode project file in the mac/xcode directory. Select 'Release' build
1011
+ configuration and select the 'Full Qgis' target, then build. If you use ccache,
1012
+ there have been compilation problems reported, so it is suggested that you disable
1013
+ ccache support.
1014
+
1015
+ Alternatively, from within the mac/xcode directory, build with the command:
1016
+
1017
+
1018
+ xcodebuild
1019
+
1020
+ Snow Leopard note: You can also build Qgis using the new llvm compilers supplied
1021
+ with Xcode 3.2.x. To do this, you first need to export the proper compiler settings:
1022
+
1023
+
1024
+ export CC=/Developer/usr/bin/llvm-gcc
1025
+ export CXX=/Developer/usr/bin/llvm-g++
1026
+ xcodebuild
1027
+
1028
+
1029
+ The Qgis application will be found in the 'build/$SYSTEM/Release' folder in the xcode folder.
1030
+ Copy this to whereever you like.
1031
+
854
1032
855
1033
5. Building on GNU/Linux
856
1034
========================
@@ -1142,6 +1320,319 @@ If all has worked properly the QGIS application should start up and appear
1142
1320
on your screen.
1143
1321
1144
1322
1323
+ 5.12. A practical case: Building QGIS and GRASS from source on Ubuntu with ECW and MrSID formats support
1324
+ ========================================================================================================
1325
+
1326
+ The following procedure has been tested on Ubuntu 8.04, 8.10 and 9.04 32bit. If you want
1327
+ to use different versions of the software (gdal, grass, qgis), just make the
1328
+ necessary adjustments to the following code. This guide assumes that you don't have
1329
+ installed any previous version of gdal, grass and qgis.
1330
+
1331
+
1332
+ 5.12.1. Step 1: install base packages
1333
+ =====================================
1334
+
1335
+ First you need to install the necessary packages required to download the source
1336
+ code and compile it. Open the terminal and issue the following command:
1337
+
1338
+
1339
+ sudo apt-get install build-essential g++ subversion
1340
+
1341
+
1342
+
1343
+ 5.12.2. Step 2: compile and install the ecw libraries
1344
+ =====================================================
1345
+
1346
+ Go to the ERDAS web site http://www.erdas.com/ and follow the links
1347
+ "'''products --> ECW JPEG2000 Codec SDK --> downloads'''"
1348
+ then download the "'''Image Compression SDK Source Code 3.3'''" (you'll need to make a registration
1349
+ and accept a license).
1350
+
1351
+ Uncompress the arquive in a proper location (this guide assumes
1352
+ that all the downloaded source code will be placed in the user home)
1353
+ and the enter the newly created folder
1354
+
1355
+
1356
+ cd /libecwj2-3.3
1357
+
1358
+
1359
+ Compile the code with the standard commands
1360
+
1361
+
1362
+ ./configure
1363
+
1364
+
1365
+ then
1366
+
1367
+
1368
+ make
1369
+
1370
+
1371
+ then
1372
+
1373
+
1374
+ sudo make install
1375
+
1376
+
1377
+ leave the folder
1378
+
1379
+
1380
+ cd ..
1381
+
1382
+
1383
+
1384
+ 5.12.3. Step 3: download the MrSID binaries
1385
+ ===========================================
1386
+
1387
+ Go to the LIZARDTECH web site http://www.lizardtech.com/ and follow the links
1388
+ "'''download --> Developer SDKs'''",
1389
+ then download the "'''GeoExpress SDK for Linux (x86) - gcc 4.1 32-bit'''"
1390
+ (you'll need to make a registration and accept a license).
1391
+
1392
+ Uncompress the downloaded file. The resulting directory name should be similar to "Geo_DSDK-7.0.0.2167"
1393
+
1394
+
1395
+ 5.12.4. Step 4: compile and install the gdal libraries
1396
+ ======================================================
1397
+
1398
+ Download the latest gdal source code
1399
+
1400
+
1401
+ svn checkout https://svn.osgeo.org/gdal/trunk/gdal gdal
1402
+
1403
+
1404
+ then copy a few files from the MrSID binaries folder to the folder with the gdal source code
1405
+ ('''replace "USERNAME" with your actual account username''')
1406
+
1407
+
1408
+ cp /home/USERNAME/Geo_DSDK-7.0.0.2167/include/*.* /home/USERNAME/gdal/frmts/mrsid/
1409
+
1410
+
1411
+ enter the gdal source code folder
1412
+
1413
+
1414
+ cd /gdal
1415
+
1416
+
1417
+ and run configure with a few specific parameters
1418
+
1419
+
1420
+ ./configure --without-grass --with-mrsid=../Geo_DSDK-7.0.0.2167 --without-jp2mrsid
1421
+
1422
+
1423
+ at the end of the configuration process you should read something like
1424
+
1425
+
1426
+ ...
1427
+ GRASS support: no
1428
+ ...
1429
+ ...
1430
+ ...
1431
+ ECW support: yes
1432
+ MrSID support yes
1433
+ ...
1434
+
1435
+
1436
+ then compile normally
1437
+
1438
+
1439
+ make
1440
+
1441
+
1442
+ and
1443
+
1444
+
1445
+ sudo make install
1446
+
1447
+
1448
+ finish the process by creating the necessary links to the most recent shared libraries
1449
+
1450
+
1451
+ sudo ldconfig
1452
+
1453
+
1454
+ at this point you may want to check if gdal was compiled correctly with MrSID and ECW
1455
+ support by issuing one (or both) of the following commands
1456
+
1457
+
1458
+ gdalinfo --formats | grep 'ECW'
1459
+
1460
+
1461
+
1462
+ gdalinfo --formats | grep 'SID'
1463
+
1464
+
1465
+ leave the folder
1466
+
1467
+
1468
+ cd ..
1469
+
1470
+
1471
+
1472
+ 5.12.5. Step 5: compile and install GRASS
1473
+ =========================================
1474
+
1475
+ Before downloading and compile GRASS source code you need to install a few
1476
+ other libraries and programs. We can do this trough apt
1477
+
1478
+
1479
+ sudo apt-get install flex bison libreadline5-dev libncurses5-dev lesstif2-dev debhelper dpatch libtiff4-dev \
1480
+ tcl8.4-dev tk8.4-dev fftw-dev xlibmesa-gl-dev libfreetype6-dev autoconf2.13 autotools-dev \
1481
+ libgdal1-dev proj libjpeg62-dev libpng12-dev libpq-dev unixodbc-dev doxygen fakeroot cmake \
1482
+ python-dev python-qt4-common python-qt4-dev python-sip4 python2.5-dev sip4 libglew1.5-dev libxmu6 \
1483
+ libqt4-dev libgsl0-dev python-qt4 swig python-wxversion python-wxgtk2.8 libwxgtk2.8-0 libwxbase2.8-0 tcl8.4-dev \
1484
+ tk8.4-dev tk8.4 libfftw3-dev libfftw3-3
1485
+
1486
+
1487
+ At this point we can get the GRASS source code: you may want to download it
1488
+ trough svn or maybe you want just to download the latest available source code arquive.
1489
+ For example the GRASS 6.4rc4 is available at http://grass.itc.it/grass64/source/grass-6.4.0RC4.tar.gz
1490
+
1491
+ Uncompress the arquive, enter the newly created folder and run configure with a few specific parameters
1492
+
1493
+
1494
+ ./configure --with-tcltk-includes=/usr/include/tcl8.4 --with-proj-share=/usr/share/proj --with-gdal=/usr/local/bin/gdal-config --with-python=/usr/bin/python2.5-config
1495
+
1496
+
1497
+ then as usual (it will take a while)
1498
+
1499
+
1500
+ make
1501
+
1502
+
1503
+ and
1504
+
1505
+
1506
+ sudo make install
1507
+
1508
+
1509
+ leave the folder
1510
+
1511
+
1512
+ cd ..
1513
+
1514
+
1515
+ you have now compiled and installed GRASS (also with the new wxpyhton interface) so you
1516
+ may want to give it a try
1517
+
1518
+
1519
+ grass64 -wxpython
1520
+
1521
+
1522
+
1523
+ 5.12.6. Step 6: compile and install the GDAL-GRASS libraries
1524
+ ============================================================
1525
+
1526
+ Create a plain text file named "grass.conf" inside the folder "/etc/ld.so.conf.d"
1527
+
1528
+
1529
+ sudo gedit /etc/ld.so.conf.d/grass.conf
1530
+
1531
+
1532
+ and add the following line
1533
+
1534
+
1535
+ /usr/local/grass-6.4.0RC4/lib/
1536
+
1537
+
1538
+ save and exit.
1539
+
1540
+ Download the latest version of the gdal-grass library (gdal-grass-1.4.3.tar.gz) from
1541
+ http://download.osgeo.org/gdal/
1542
+
1543
+ uncompress the arquive and enter the newly created folder
1544
+
1545
+
1546
+ cd /gdal-grass-1.4.3
1547
+
1548
+
1549
+ run configure
1550
+
1551
+
1552
+ ./configure --with-grass=/usr/local/grass-6.4.0RC4
1553
+
1554
+
1555
+ then as usual
1556
+
1557
+
1558
+ make
1559
+
1560
+
1561
+ and
1562
+
1563
+
1564
+ sudo make install
1565
+
1566
+
1567
+ and finish the process by creating the necessary links to the most recent shared libraries
1568
+
1569
+
1570
+ sudo ldconfig
1571
+
1572
+
1573
+ leave the folder
1574
+
1575
+
1576
+ cd ..
1577
+
1578
+
1579
+
1580
+ 5.12.7. Step 6: compile and install QGIS
1581
+ ========================================
1582
+
1583
+ As for GRASS you can obtain the QGIS source code from different sources,
1584
+ for instance from svn or just by downloading one of the source code arquives available
1585
+ at http://www.qgis.org/download/sources.html
1586
+
1587
+ For example download the QGIS 1.1.0 source code here http://download.osgeo.org/qgis/src/qgis_1.1.0.tar.gz
1588
+
1589
+ uncompress the arquive and enter the newly created folder
1590
+
1591
+
1592
+ cd /qgis_1.1.0
1593
+
1594
+
1595
+ then run ccmake
1596
+
1597
+
1598
+ ccmake .
1599
+
1600
+
1601
+ press the "c" key, then when the option list will appear we need to manually
1602
+ configure the "GRASS_PREFIX" parameter. Scroll down until the "GRASS_PREFIX" will appear,
1603
+ press enter and manually set it to
1604
+
1605
+
1606
+ /usr/local/grass-6.4.0RC4
1607
+
1608
+
1609
+ then press enter again.
1610
+
1611
+ Press the "c" again and the option "Press [g] to generate and exit" will appear.
1612
+ Press the "g" key to generate and exit.
1613
+
1614
+ then as usual (it will take a while)
1615
+
1616
+
1617
+ make
1618
+
1619
+
1620
+ and
1621
+
1622
+
1623
+ sudo make install
1624
+
1625
+
1626
+ At the end of the process you should have QGIS and GRASS working with MrSID and ECW
1627
+ raster format support.
1628
+
1629
+ To run QGIS just use this command
1630
+
1631
+
1632
+ qgis
1633
+
1634
+
1635
+
1145
1636
6. Creation of MSYS environment for compilation of Quantum GIS
1146
1637
==============================================================
1147
1638
0 commit comments