Opened 15 years ago

Last modified 6 years ago

#2953 closed enhancement

Patch for GDAL-GRASS plugin for GRASS 7 — at Version 22

Reported by: Markus Neteler Owned by: Even Rouault
Priority: normal Milestone: 2.1.3
Component: default Version: svn-trunk
Severity: normal Keywords: grass
Cc: wolf+grass@…, martinl, sbl

Description (last modified by sbl)

I have patched GDAL to compile against GRASS 7 (attached). However, the removal of the no longer existing libraries should be conditionalized to still permit the compilation against GRASS 6. I just dunno how to implement that (no autoconf guru).

Change History (24)

by Markus Neteler, 15 years ago

Attachment: gdal_grass7_plugin.diff added

patch to compile GDAL-GRASS plugin against GRASS 7

comment:1 by Even Rouault, 15 years ago

Owner: changed from warmerdam to Even Rouault

comment:2 by Even Rouault, 15 years ago

Resolution: fixed
Status: newclosed

In r16813 I've commited a version that enables building against GRASS 7 and older versions as well.

Grass enhancement request : it would be cool if GRASS had a grass-config script.

in reply to:  2 comment:3 by hamish, 15 years ago

Replying to rouault:

In r16813 I've commited a version that enables building against GRASS 7 and older versions as well.

is this still functional? ISTR we recently got a report that changes in grass trunk (7) had broken it.

Grass enhancement request : it would be cool if GRASS had a grass-config script.

here's the ticket for that wish:

https://trac.osgeo.org/grass/ticket/596

Hamish

comment:4 by Even Rouault, 14 years ago

r20157 /trunk/gdal/ (6 files in 3 dirs): Update GDAL and OGR GRASS drivers to compile against GRASS 7.0SVN (it compiles, but autotest gdrivers/grass.py and ogr/ogr_grass.py fail). Backward compatibility with GRASS 6.X preserved (#2953)

by wolf, 13 years ago

Patch to use grass-config from https://trac.osgeo.org/grass/ticket/596

comment:5 by wolf, 13 years ago

Cc: wolf+grass@… added

Added a patch to use grass-config from https://trac.osgeo.org/grass/ticket/596. Works on trunk.

comment:6 by dylan, 13 years ago

I have tried both patches to GDAL trunk (as of r23215) and neither can be applied cleanly (failed hunks). Is the strategy for getting GRASS7 support in GDAL enabled with the "--with-grass" flag when compiling GDAL, or with the grass-gdal plugin? I cannot get the grass-gdal plugin to compile after removing all grass6 files, and installing grass7. I have updated my ld.so.conf to reflect these changes, but still get:

./configure --with-grass=/usr/local/grass-7.0.svn/
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for ranlib... ranlib
checking for g++ -shared ... yes
checking for gdal-config... /usr/local/bin/gdal-config
using /usr/local/lib/gdalplugins as GDAL shared library autoload directory
checking for G_asprintf in -lgrass_gis... no
configure: error: --with-grass=/usr/local/grass-7.0.svn/ requested, but libraries not found!

comment:7 by Even Rouault, 13 years ago

Cc: martinl added

I think the grass-gdal plugin is the way to go, but there hasn't been any activity recently, so it might not work either as grass7 must be still a moving target I imagine. CC'ing Martin Landa who has declared the GRASS driver as area of interest ;-)

comment:8 by kalxas, 12 years ago

Hi all,

Any progress on this issue? Has anyone had success building against current grass7 trunk?

Regards, Angelos

comment:9 by Even Rouault, 12 years ago

Milestone: 1.7.0
Resolution: fixed
Status: closedreopened

Reopening the ticket. Any volunteer ?

comment:10 by pvanbosgeo, 12 years ago

Hi, any development in this regard? GRASS 7.0 seems fairly stable for most work, so it would be great if the grass-gdal plugin could be made compatible with grass 7.0. I can't program, but I would be happy to test.

comment:11 by Markus Neteler, 12 years ago

I just tried with GRASS 7.svn and this part went through properly:

[neteler@north gdal-1.9]$ ./configure --with-grass=/home/neteler/grass70/dist.x86_64-unknown-linux-gnu/
...
checking for PostgreSQL... no
checking for G_asprintf in -lgrass_gis... yes
checking for ffopen in -lcfitsio... no
...
GDAL is now configured for x86_64-unknown-linux-gnu
...
  GRASS support:             grass57+
...

Essential (in fact small) updates are:

  • /usr/bin/ld: cannot find -lgrass_vect --> the GRASS7 name is 'grass_vector'
  • /usr/bin/ld: cannot find -lgrass_I --> the GRASS7 name is 'grass_imagery'
  • /usr/bin/ld: cannot find -lgrass_vask --> no longer exists in GRASS7

This would require to be conditionalized in the Makefile upon the GRASS version.

in reply to:  7 comment:12 by martinl, 12 years ago

Replying to rouault:

I think the grass-gdal plugin is the way to go, but there hasn't been any activity recently, so it might not work either as grass7 must be still a moving target I imagine. CC'ing Martin Landa who has declared the GRASS driver as area of interest ;-)

that's right, sorry I am super-busy with other important stuff. I will do my best to look at this issue too.

in reply to:  11 comment:13 by hamish, 12 years ago

Replying to neteler:

This would require to be conditionalized in the Makefile upon the GRASS version.

i.e. in include/grass/version.h test against GRASS_VERSION_MAJOR == 6 (or 7).

Hamish

comment:14 by kalxas, 12 years ago

FYI, I am getting requests for gdal support for grass7 in openSUSE.

https://bugzilla.novell.com/show_bug.cgi?id=723890

comment:15 by martinl, 11 years ago

Compilation issues fixed in r26318 + r26320. Martin

in reply to:  15 ; comment:16 by sbl, 10 years ago

Cc: sbl added

Replying to martinl:

Compilation issues fixed in r26318 + r26320. Martin

I just tried to compile GDAL (rev 26701) against GRASS 7 (rev 58438) on Ubunut Server 12.04 with unfortunately various results. It seems that the gdal-grass-plugin did not receive any updates since 2007 (latest version on http://download.osgeo.org/gdal/ is 1.4.3, last modified 05-Aug-2007). So I rebuild GDAL after compiling GRASS 7 (instead of using the plugin). After that, gdalinfo --formats gave:

Supported Formats:
  GRASS (ro):

No vesion information was given.

gdal_translate with GRASS raster datasets as input worked, but gave warning:

 Warning 1: GRASS warning: GISBASE enviroment variable was not set, using:
  /usr/local/grass-7.0.svn

However, raster2pgsql from PostGIS 2.1.2 gave error messages when I try to feed GRASS raster:

Segmentation fault (core dumped)" 

After I removed "/usr/local/grass-6.4.4svn/lib" from /etc/ld.so.conf error messages changed to:

ERROR 1: libgrass_I.so: cannot open shared object file: No such file or directory
*** glibc detected *** raster2pgsql: corrupted double-linked list: 
0x00000000012e59f0 ***

To me it looks like GDAL is using a mixture of GRASS 6 and GRASS 7, becaus it said it was using GRASS 7 GISBASE but was looking for libgrass_I.so (wich is GRASS 6 specific I think?). See also: http://lists.osgeo.org/pipermail/grass-dev/2013-December/066608.html for discussion on grass-dev mailinglist.

comment:17 by larrysh, 10 years ago

Hi,

I would be interested in helping on getting this functioning, now that the GRASS 7 beta1 is out.

The patches attached here are outdated, but it looks like there is GRASS support in 1.10 already, just not in the plugin, yet.

comment:18 by Even Rouault, 10 years ago

The potential changes are to be done in frmts/grass/grassdataset.cpp, GDAL's configure.in (root of source tree) and plugin configure.in in frmts/grass/pkg

in reply to:  18 comment:19 by martinl, 10 years ago

Replying to rouault:

The potential changes are to be done in frmts/grass/grassdataset.cpp, GDAL's configure.in (root of source tree) and plugin configure.in in frmts/grass/pkg

The configure script should detect GRASS 7 already correctly

 GRASS support:             grass70+

On the rest I will try take a look ASAP.

in reply to:  16 ; comment:20 by martinl, 10 years ago

Replying to sbl:

gdal_translate with GRASS raster datasets as input worked, but gave warning:

 Warning 1: GRASS warning: GISBASE enviroment variable was not set, using:
  /usr/local/grass-7.0.svn

that's absolutely OK, it's just a warning that GDAL will use the version of GRASS which was used when building GDAL. If you want to use different version of GRASS, you can define it by GISBASE variable. Anyway this warning is probably misleading. The driver should probably check if GRASS_GISBASE exists on local machine and if not found than fail with error message: "Default GISBASE (%s) not found, you need to define GISBASE environmental variable which points to your GRASS installation". What do you think?

in reply to:  20 comment:21 by sbl, 10 years ago

Description: modified (diff)

Replying to martinl:

Replying to sbl:

gdal_translate with GRASS raster datasets as input worked, but gave warning:

 Warning 1: GRASS warning: GISBASE enviroment variable was not set, using:
  /usr/local/grass-7.0.svn

that's absolutely OK, it's just a warning that GDAL will use the version of GRASS which was used when building GDAL. If you want to use different version of GRASS, you can define it by GISBASE variable. Anyway this warning is probably misleading. The driver should probably check if GRASS_GISBASE exists on local machine and if not found than fail with error message: "Default GISBASE (%s) not found, you need to define GISBASE environmental variable which points to your GRASS installation". What do you think?

comment:22 by sbl, 10 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.