[GRASS-user] Finally got working GDAL stable v 1.9.2 GRASS v7.0 and their Plugin!

Pankaj Kr Sharma pkscwc at gmail.com
Thu Nov 22 01:26:53 PST 2012


Installing GDAL and GRASS was the easier part.
Just followed all the instructions posted on the wiki.

Building the plugin required some effort.
I resolved the errors cropping up during installation through crude methods.

The plugin worked finally and got it tested also.

The Long messages received during installation and the plugin files are
also attached.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20121122/962ed30a/attachment-0001.html>
-------------- next part --------------
---------------gdal-grass plugin begins ---------------------


./configure \
--prefix=/usr/local \
--with-gdal=/usr/local/bin/gdal-config \
--with-grass=/usr/local/grass-7.0.svn/ \
--with-autoload="/usr/local/lib/gdalplugins/" \
--with-ld-shared="g++ -shared"

Here, I have used installation folder path instead of source path for GRASS.


rdcgis2 at rdcgis2-nswdc:/usr/gis/gdal-grass-plugin$ make
g++ -Wall -fPIC  -DUSE_CPL -DGRASS_GISBASE=\"/usr/local/grass-7.0.svn/\" -I/usr/local/include -I/usr/local/grass-7.0.svn//include   -c -o grass57dataset.o grass57dataset.cpp
grass57dataset.cpp:50:38: error: declaration of C function ?char* GPJ_grass_to_wkt(Key_Value*, Key_Value*, int, int)? conflicts with
In file included from /usr/local/grass-7.0.svn//include/grass/gprojects.h:91:0,
                 from grass57dataset.cpp:45:
/usr/local/grass-7.0.svn//include/grass/defs/gprojects.h:17:7: error: previous declaration ?char* GPJ_grass_to_wkt(const Key_Value*, const Key_Value*, int, int)? here
make: *** [grass57dataset.o] Error 1


Done the correction 

char *GPJ_grass_to_wkt(const struct Key_Value *proj_info,
		       const struct Key_Value *proj_units,
		       int esri_style, int prettify);
}

Again , error

rdcgis2 at rdcgis2-nswdc:/usr/gis/gdal-grass-plugin$ make
g++ -Wall -fPIC  -DUSE_CPL -DGRASS_GISBASE=\"/usr/local/grass-7.0.svn/\" -I/usr/local/include -I/usr/local/grass-7.0.svn//include   -c -o grass57dataset.o grass57dataset.cpp
g++ -shared grass57dataset.o -L/usr/local/grass-7.0.svn//lib -lgrass_raster.7.0.svn -lgrass_gmath.7.0.svn -lgrass_gis.7.0.svn -lgrass_datetime.7.0.svn -lgrass_gproj.7.0.svn -lgrass_vector.7.0.svn -lgrass_dbmibase.7.0.svn -lgrass_dbmiclient.7.0.svn -lgrass_dgl.7.0.svn -lgrass_dig2.7.0.svn -lgrass_rtree.7.0.svn -lgrass_linkm.7.0.svn -lgrass_btree2.7.0.svn -lgrass_ccmath.7.0.svn -L/usr/local/lib -lgdal  -o gdal_GRASS.so
g++ -Wall -fPIC  -DUSE_CPL -DGRASS_GISBASE=\"/usr/local/grass-7.0.svn/\" -I/usr/local/include -I/usr/local/grass-7.0.svn//include   -c -o ogrgrassdriver.o ogrgrassdriver.cpp
In file included from /usr/local/grass-7.0.svn//include/grass/vect/digit.h:3:0,
                 from /usr/local/grass-7.0.svn//include/grass/vector.h:4,
                 from ogrgrass.h:41,
                 from ogrgrassdriver.cpp:30:
/usr/local/grass-7.0.svn//include/grass/vect/dig_structs.h:34:22: fatal error: libpq-fe.h: No such file or directory
compilation terminated.
make: *** [ogrgrassdriver.o] Error 1


corrected it with

#ifdef HAVE_POSTGRES
#include </usr/include/postgresql/libpq-fe.h>
#endif


Again , error

rdcgis2 at rdcgis2-nswdc:/usr/gis/gdal-grass-plugin$ make
g++ -Wall -fPIC  -DUSE_CPL -DGRASS_GISBASE=\"/usr/local/grass-7.0.svn/\" -I/usr/local/include -I/usr/local/grass-7.0.svn//include   -c -o ogrgrassdriver.o ogrgrassdriver.cpp
g++ -Wall -fPIC  -DUSE_CPL -DGRASS_GISBASE=\"/usr/local/grass-7.0.svn/\" -I/usr/local/include -I/usr/local/grass-7.0.svn//include   -c -o ogrgrassdatasource.o ogrgrassdatasource.cpp
ogrgrassdatasource.cpp: In member function ?int OGRGRASSDataSource::Open(const char*, int, int, int)?:
ogrgrassdatasource.cpp:191:28: error: ?GV_FATAL_PRINT? was not declared in this scope
ogrgrassdatasource.cpp:191:43: error: ?Vect_set_fatal_error? was not declared in this scope
make: *** [ogrgrassdatasource.o] Error 1
rdcgis2 at rdcgis2-nswdc:/usr/gis/gdal-grass-plugin$ 

corrected it with
/*   Vect_set_fatal_error ( GV_FATAL_PRINT ); // Print error and continue */


And, my plugin completed the make stage successfully.

Now, the sudo checkinstall time:


Again , error

========================= Installation results ===========================
install -d /usr/local/lib/gdalplugins/
cp gdal_GRASS.so /usr/local/lib/gdalplugins/
cp ogr_GRASS.so /usr/local/lib/gdalplugins/
test -d /usr/local/share/gdal/grass || mkdir /usr/local/share/gdal/grass
test -d /usr/local/share/gdal/grass/etc || mkdir /usr/local/share/gdal/grass/etc
cp /usr/local/grass-7.0.svn//etc/ellipse.table /usr/local/share/gdal/grass/etc
cp: cannot stat `/usr/local/grass-7.0.svn//etc/ellipse.table': No such file or directory
make: *** [install] Error 1

****  Installation failed. Aborting package creation.

Cleaning up...OK

Bye.

corrected it with

sudo cp /usr/gis/grass_trunk/lib/gis/ellipse.table /usr/local/grass-7.0.svn/etc/ellipse.table

Sudo Checkinstall again

========================= Installation results ===========================
install -d /usr/local/lib/gdalplugins/
cp gdal_GRASS.so /usr/local/lib/gdalplugins/
cp ogr_GRASS.so /usr/local/lib/gdalplugins/
test -d /usr/local/share/gdal/grass || mkdir /usr/local/share/gdal/grass
test -d /usr/local/share/gdal/grass/etc || mkdir /usr/local/share/gdal/grass/etc
cp /usr/local/grass-7.0.svn//etc/ellipse.table /usr/local/share/gdal/grass/etc
cp /usr/local/grass-7.0.svn//etc/datum.table /usr/local/grass-7.0.svn//etc/datumtransform.table /usr/local/share/gdal/grass/etc
cp: cannot stat `/usr/local/grass-7.0.svn//etc/datum.table': No such file or directory
cp: cannot stat `/usr/local/grass-7.0.svn//etc/datumtransform.table': No such file or directory
make: *** [install] Error 1

****  Installation failed. Aborting package creation.

Restoring overwritten files from backup...OK

Cleaning up...OK

Bye.

rdcgis2 at rdcgis2-nswdc:/usr/gis/gdal-grass-plugin$ 


corrected it with
sudo cp /usr/gis/grass_trunk/lib/gis/datumtransform.table /usr/local/grass-7.0.svn/etc/datumtransform.table
sudo cp /usr/gis/grass_trunk/lib/gis/datum.table /usr/local/grass-7.0.svn/etc/datum.table


And it worked.

Done. The new package has been installed and saved to

 /usr/gis/gdal-grass-plugin/gdal-grass_5-1_amd64.deb

 You can remove it from your system anytime using: 

      dpkg -r gdal-grass


Now , it is time to test:

test 1

rdcgis2 at rdcgis2-nswdc:~$ gdal_translate --formats | grep -i grass
  GRASS (ro): GRASS Database Rasters (5.7+)
  GRASSASCIIGrid (rov): GRASS ASCII Grid
rdcgis2 at rdcgis2-nswdc:~$ 

test 2

ldd /usr/local/lib/gdalplugins/gdal_GRASS.so
	linux-vdso.so.1 =>  (0x00007fff30fee000)
	libgrass_raster.7.0.svn.so => /usr/local/grass-7.0.svn/lib/libgrass_raster.7.0.svn.so (0x00007f3443314000)
	.......................................................................
	.......................................................................
	libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f3438371000)
rdcgis2 at rdcgis2-nswdc:~$ 


test 3

rdcgis2 at rdcgis2-nswdc:~$ ldd /usr/local/lib/gdalplugins/ogr_GRASS.so
	linux-vdso.so.1 =>  (0x00007fffb2fbb000)
	libgrass_gis.7.0.svn.so => /usr/local/grass-7.0.svn/lib/libgrass_gis.7.0.svn.so (0x00007f858d980000)
	.......................................................................
	.......................................................................
	libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f858784a000)
	libcrypto.so.1.0.0 => /lib/x86_6

test 4

rdcgis2 at rdcgis2-nswdc:~$ gdalinfo /media/rdcgis2/disk2part3/rdcgis2/gisdata90m/no_nulls/cellhd/i90
Warning 1: GRASS warning: GISBASE enviroment variable was not set, using:
/usr/local/grass-7.0.svn/
Driver: GRASS/GRASS Database Rasters (5.7+)
Files: /media/rdcgis2/disk2part3/rdcgis2/gisdata90m/no_nulls/cellhd/i90
Size is 42001, 42001
Coordinate System is:
GEOGCS["everest",
    DATUM["unknown",
        SPHEROID["Everest_1830_India",6377276.345,300.8017]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]
Origin = (64.999583454444448,40.000416763611113)
Pixel Size = (0.000833333333333,-0.000833333333333)
Corner Coordinates:
Upper Left  (  64.9995835,  40.0004168) ( 64d59'58.50"E, 40d 0' 1.50"N)
Lower Left  (  64.9995835,   4.9995834) ( 64d59'58.50"E,  4d59'58.50"N)
Upper Right ( 100.0004168,  40.0004168) (100d 0' 1.50"E, 40d 0' 1.50"N)
Lower Right ( 100.0004168,   4.9995834) (100d 0' 1.50"E,  4d59'58.50"N)
Center      (  82.5000001,  22.5000001) ( 82d30' 0.00"E, 22d30' 0.00"N)
Band 1 Block=42001x1 Type=Int32, ColorInterp=Gray
  Min=-160.000 Max=8806.000 
  NoData Value=-2147483648
  Metadata:
    COLOR_TABLE_RULES_COUNT=0
rdcgis2 at rdcgis2-nswdc:~$ 

test 5 

rdcgis2 at rdcgis2-nswdc:~$ ogrinfo -summary /media/rdcgis2/disk2part3/rdcgis2/find_sites/find_sites_vector/PERMANENT/vector/new1917_online/head
Warning 1: GRASS warning: GISBASE enviroment variable was not set, using:
/usr/local/grass-7.0.svn/
DBMI-PostgreSQL driver error:
Connection failed.
fe_sendauth: no password supplied


Warning 1: GRASS warning: Unable to open database <host=localhost,dbname=nswdc_gis> by driver <pg>
ERROR 1: Cannot open database pg by driver host=localhost,dbname=nswdc_gis, check if GISBASE enviroment variable is set, the driver is available  and the database is accessible.
INFO: Open of `/media/rdcgis2/disk2part3/rdcgis2/find_sites/find_sites_vector/PERMANENT/vector/new1917_online/head'
      using driver `GRASS' successful.
1: new1917_online (Point)
rdcgis2 at rdcgis2-nswdc:~$ 



-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdal-grass-plugin.tar.gz
Type: application/x-gzip
Size: 245760 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20121122/962ed30a/attachment-0001.bin>


More information about the grass-user mailing list