Skip to content
Permalink
Browse files

GDAL-GRASS driver no more necessary, new requirement: exceptions supp…

…ort for GRASS

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13060 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek
rblazek committed Mar 15, 2010
1 parent 9d6fe10 commit f69e9c97d284328821c871e57d6c0cfab88e2d3c
Showing with 26 additions and 311 deletions.
  1. +20 −169 INSTALL
  2. +6 −142 doc/INSTALL.t2t
189 INSTALL
@@ -63,23 +63,20 @@ Building QGIS from source - step by step
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 the GDAL-GRASS libraries
5.12.7. Step 6: compile and install QGIS
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. GDAL level one
6.2.3. GRASS
6.2.4. GDAL level two
6.2.5. GEOS
6.2.6. SQLITE
6.2.7. GSL
6.2.8. EXPAT
6.2.9. POSTGRES
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
@@ -190,7 +187,7 @@ for the existence of cmake and provides some clues to build QGIS.
* GDAL/OGR >= 1.4.x

'''Optional dependencies:'''
* for GRASS plugin - GRASS >= 6.0.0
* 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
@@ -1185,11 +1182,9 @@ skip this section.
Now you can install grass from dapper:


sudo apt-get install grass libgrass-dev libgdal1-1.4.0-grass
sudo apt-get install grass libgrass-dev


/!\ You may need to explicitly state your grass version e.g. libgdal1-1.3.2-grass


5.6. Setup ccache (Optional)
============================
@@ -1524,10 +1519,12 @@ For example the GRASS 6.4rc4 is available at http://grass.itc.it/grass64/source/
Uncompress the arquive, enter the newly created folder and run configure with a few specific parameters


./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
CFLAGS="-fexceptions" ./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


then as usual (it will take a while)
The additional gcc option -fexceptions is necessary to enable exceptions support in GRASS libraries. It is currently the only way to avoid QGIS crashes if a fatal error happens in GRASS library. See also http://trac.osgeo.org/grass/ticket/869

Then as usual (it will take a while)


make
@@ -1553,64 +1550,7 @@ may want to give it a try



5.12.6. Step 6: compile and install the GDAL-GRASS libraries
============================================================

Create a plain text file named "grass.conf" inside the folder "/etc/ld.so.conf.d"


sudo gedit /etc/ld.so.conf.d/grass.conf


and add the following line


/usr/local/grass-6.4.0RC4/lib/


save and exit.

Download the latest version of the gdal-grass library (gdal-grass-1.4.3.tar.gz) from
http://download.osgeo.org/gdal/

uncompress the arquive and enter the newly created folder


cd /gdal-grass-1.4.3


run configure


./configure --with-grass=/usr/local/grass-6.4.0RC4


then as usual


make


and


sudo make install


and finish the process by creating the necessary links to the most recent shared libraries


sudo ldconfig


leave the folder


cd ..



5.12.7. Step 6: compile and install QGIS
5.12.6. Step 6: compile and install QGIS
========================================

As for GRASS you can obtain the QGIS source code from different sources,
@@ -1747,72 +1687,7 @@ Moreover he also left the notes how to compile it (for those interested):
Unpack the whole package to c:\msys\local


6.2.2. GDAL level one
=====================

Since Quantum GIS needs GDAL with GRASS support, we need to compile GDAL
from source - Paul Kelly's package doesn't include GRASS support in GDAL.
The idea is following:

1. compile GDAL without GRASS
2. compile GRASS
3. compile GDAL with GRASS

So, start with downloading GDAL sources:

http://download.osgeo.org/gdal/gdal141.zip

Unpack it to some directory, preferably c:\msys\local\src.

Start MSYS console, go to gdal-1.4.1 directory and run the commands below.
You can put them all to a script, e.g. build-gdal.sh and run them at once.
The recipe is taken from Paul Kelly's instructions - basically they
just make sure that the library will be created as DLL and the utility
programs will be dynamically linked to it...


CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" LDFLAGS=-s ./configure --without-libtool --prefix=/usr/local --enable-shared --disable-static --with-libz=/usr/local --with-png=/usr/local
make
make install
rm /usr/local/lib/libgdal.a
g++ -s -shared -o ./libgdal.dll -L/usr/local/lib -lz -lpng ./frmts/o/*.o ./gcore/*.o ./port/*.o ./alg/*.o ./ogr/ogrsf_frmts/o/*.o ./ogr/ogrgeometryfactory.o ./ogr/ogrpoint.o ./ogr/ogrcurve.o ./ogr/ogrlinestring.o ./ogr/ogrlinearring.o ./ogr/ogrpolygon.o ./ogr/ogrutils.o ./ogr/ogrgeometry.o ./ogr/ogrgeometrycollection.o ./ogr/ogrmultipolygon.o ./ogr/ogrsurface.o ./ogr/ogrmultipoint.o ./ogr/ogrmultilinestring.o ./ogr/ogr_api.o ./ogr/ogrfeature.o ./ogr/ogrfeaturedefn.o ./ogr/ogrfeaturequery.o ./ogr/ogrfeaturestyle.o ./ogr/ogrfielddefn.o ./ogr/ogrspatialreference.o ./ogr/ogr_srsnode.o ./ogr/ogr_srs_proj4.o ./ogr/ogr_fromepsg.o ./ogr/ogrct.o ./ogr/ogr_opt.o ./ogr/ogr_srs_esri.o ./ogr/ogr_srs_pci.o ./ogr/ogr_srs_usgs.o ./ogr/ogr_srs_dict.o ./ogr/ogr_srs_panorama.o ./ogr/swq.o ./ogr/ogr_srs_validate.o ./ogr/ogr_srs_xml.o ./ogr/ograssemblepolygon.o ./ogr/ogr2gmlgeometry.o ./ogr/gml2ogrgeometry.o
install libgdal.dll /usr/local/lib
cd ogr
g++ -s ogrinfo.o -o ogrinfo.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s ogr2ogr.o -o ogr2ogr.exe -lgdal -L/usr/local/lib -lpng -lz -lgdal
g++ -s ogrtindex.o -o ogrtindex.exe -lgdal -L/usr/local/lib -lpng -lz -lgdal
install ogrinfo.exe ogr2ogr.exe ogrtindex.exe /usr/local/bin
cd ../apps
g++ -s gdalinfo.o -o gdalinfo.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdal_translate.o -o gdal_translate.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdaladdo.o -o gdaladdo.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdalwarp.o -o gdalwarp.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdal_contour.o -o gdal_contour.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdaltindex.o -o gdaltindex.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdal_rasterize.o -o gdal_rasterize.exe -L/usr/local/lib -lpng -lz -lgdal
install gdalinfo.exe gdal_translate.exe gdaladdo.exe gdalwarp.exe gdal_contour.exe gdaltindex.exe gdal_rasterize.exe /usr/local/bin



Finally, manually edit gdal-config in c:\msys\local\bin to replace the static library reference with -lgdal:


CONFIG_LIBS="-L/usr/local/lib -lpng -lz -lgdal"

GDAL build procedure can be greatly simplified to use libtool with a libtool line patch:
configure gdal as below:
./configure --with-ngpython --with-xerces=/local/ --with-jasper=/local/ --with-grass=/local/grass-6.3.cvs/ --with-pg=/local/pgsql/bin/pg_config.exe

Then fix libtool with:
mv libtool libtool.orig
cat libtool.orig | sed 's/max_cmd_len=8192/max_cmd_len=32768/g' > libtool

Libtool on windows assumes a line length limit of 8192 for some reason and tries to page the linking and fails miserably. This is a work around.

Make and make install should be hassle free after this.


6.2.3. GRASS
6.2.2. GRASS
============

Grab sources from CVS or use a weekly snapshot, see:
@@ -1839,31 +1714,7 @@ By the way, these pages might be useful:
- http://geni.ath.cx/grass.html


6.2.4. GDAL level two
=====================

At this stage, we'll use GDAL sources we've used before, only the compilation will be a bit different.

But first in order to be able to compile GDAL sources with current GRASS CVS, you need to patch them, here's what you need to change:

http://trac.osgeo.org/gdal/attachment/ticket/1587/plugin_patch_grass63.diff
(you can patch it by hand or use patch.exe in c:\msys\bin)

Now in MSYS console go to the GDAL sources directory and run the same commands as in level one, only with these differences:

1. when running ./configure add this argument: --with-grass=/usr/local/grass-6.3.cvs
2. when calling g++ on line 5 (which creates libgdal.dll), add these arguments: -L/usr/local/grass-6.3.cvs/lib -lgrass_vect -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase -lgrass_I -lgrass_gproj -lgrass_vask -lgrass_gmath -lgrass_gis -lgrass_datetime

Then again, edit gdal-config and change line with CONFIG_LIBS


CONFIG_LIBS="-L/usr/local/lib -lpng -L/usr/local/grass-6.3.cvs/lib -lgrass_vect -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase -lgrass_I -lgrass_gproj -lgrass_vask -lgrass_gmath -lgrass_gis -lgrass_datetime -lz -L/usr/local/lib -lgdal"


Now, GDAL should be able to work also with GRASS raster layers.


6.2.5. GEOS
6.2.3. GEOS
===========

Download the sources:
@@ -1893,7 +1744,7 @@ Now, in MSYS console, go to the source directory and run:



6.2.6. SQLITE
6.2.4. SQLITE
=============

You can use precompiled DLL, no need to compile from source:
@@ -1911,7 +1762,7 @@ Then download this archive:
and copy sqlite3.h to c:\msys\local\include


6.2.7. GSL
6.2.5. GSL
==========

Download sources:
@@ -1929,7 +1780,7 @@ Run from MSYS console in the source directory:



6.2.8. EXPAT
6.2.6. EXPAT
============

Download sources:
@@ -1947,7 +1798,7 @@ Run from MSYS console in the source directory:



6.2.9. POSTGRES
6.2.7. POSTGRES
===============

We're going to use precompiled binaries. Use the link below for download:

0 comments on commit f69e9c9

Please sign in to comment.
You can’t perform that action at this time.