Opened 21 years ago

Last modified 20 years ago

#408 closed defect (fixed)

Build with gcc 3.2.3 fails

Reported by: candrsn@… Owned by: warmerdam
Priority: high Milestone:
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords:
Cc: Markus Neteler

Description

build fails with


/bin/sh ../../libtool --mode=compile g++ -Wall  -O2   -I../../port -I../../gcore
-I../../ogr  -c -o grassdataset.o grassdataset.cpp
 g++ -Wall -O2 -I../../port -I../../gcore -I../../ogr -c grassdataset.cpp  -fPIC
-DPIC -o .libs/grassdataset.o
grassdataset.cpp: In static member function `static GDALDataset* 
   GRASSDataset::Open(GDALOpenInfo*)':
grassdataset.cpp:509: invalid conversion from `int (*)()' to `int (*)(...)'
make: *** [grassdataset.o] Error 1



the following patch allows this to compile

diff -u grassdataset.cpp  grassdataset.cpp.n
--- grassdataset.cpp.old    2002-12-03 09:05:36.000000000 -0500
+++ grassdataset.cpp  2003-10-06 01:54:27.000000000 -0400
@@ -494,7 +494,7 @@
 /*                                Open()                                */
 /************************************************************************/
  
-typedef int (*GrassErrorHandler)();
+typedef int (*GrassErrorHandler)(...);
  
 GDALDataset *GRASSDataset::Open( GDALOpenInfo * poOpenInfo )

Change History (6)

comment:1 by warmerdam, 21 years ago

Patch applied.

Thanks Carl!

comment:2 by warmerdam, 21 years ago

Frank,

currently the GDAL CVS does not compile with GRASS support:

make[2]: Entering directory `/hardmnt/thuille1/ssi/soft/gdal/frmts/grass'
/bin/sh ../../libtool --mode=compile gcc -I../../port -I../../gcore -I../../ogr
-Wall  -O2  -DHAVE_JASPER_UUID  -I/usr/local/lib -I/usr/local/lib/include   -c
-o ../o/grassdataset.o grassdataset.cpp
 gcc -I../../port -I../../gcore -I../../ogr -Wall -O2 -DHAVE_JASPER_UUID
-I/usr/local/lib -I/usr/local/lib/include -c grassdataset.cpp  -fPIC -DPIC -o
../o/.libs/grassdataset.o
grassdataset.cpp: In static member function `static GDALDataset*
   GRASSDataset::Open(GDALOpenInfo*)':
grassdataset.cpp:513: invalid conversion from `int (*)(...)' to `int (*)()'
make[2]: *** [../o/grassdataset.o] Error 1
make[2]: Leaving directory `/hardmnt/thuille1/ssi/soft/gdal/frmts/grass'
make[1]: *** [grass-install-obj] Error 2
make[1]: Leaving directory `/hardmnt/thuille1/ssi/soft/gdal/frmts'
make: *** [frmts-target] Error 2

It seems to be related to:
 * Revision 1.15  2003/10/06 13:35:27  warmerda
 * Fixed GrassErrorHandler typedef as per:
 * http://bugzilla.remotesensing.org/show_bug.cgi?id=408

I am using
gcc version 3.2.2 20030313 (Red Hat Linux 3.2.2-10)

Last week it was ok, so I thought to notify you. Maybe Carl was using
a different compiler? I have used 'make distclean' before starting
compilation.

Best regards

 Markus

comment:3 by warmerdam, 20 years ago

This should be fixed before GDAL 1.2.0 release.

comment:4 by neteler@…, 20 years ago

Frank,

if you revert the "fix" it works fine.
Maybe there is another trick to make all of us happy?

Markus

comment:5 by neteler@…, 20 years ago

Frank,

just FYI: It does not compile even with gcc 2.9x (today's CVS):

make[2]: Entering directory `/hardmnt/grass0/neteler/gdal/frmts/grass'
/bin/sh ../../libtool --mode=compile g++ -Wall  -O2  -I/usr/local/lib
-I/usr/local/lib/include   -I../../port -I../../gcore -I../../ogr
-I/grass0/neteler/libgrass/gis  -I../../port -c -o ../o/grassdataset.o
grassdataset.cpp
 g++ -Wall -O2 -I/usr/local/lib -I/usr/local/lib/include -I../../port
-I../../gcore -I../../ogr -I/grass0/neteler/libgrass/gis -I../../port -c
grassdataset.cpp  -fPIC -DPIC -o ../o/.libs/grassdataset.o
grassdataset.cpp: In function `GDALDataset *GRASSDataset::Open
(GDALOpenInfo *)':
grassdataset.cpp:513: cannot convert `int (*) (...)' to `int (*) ()'
for argument `1' to `G_set_error_routine (int (*) ())'
grassdataset.cpp: At top level:
/grass0/neteler/libgrass/gis/gis.h:35: warning: `const char *GRASS_copyright'
defined but not used
make[2]: *** [../o/grassdataset.o] Error 1
make[2]: Leaving directory `/hardmnt/grass0/neteler/gdal/frmts/grass'
make[1]: *** [grass-install-obj] Error 2
make[1]: Leaving directory `/hardmnt/grass0/neteler/gdal/frmts'
make: *** [frmts-target] Error 2

bash-2.04$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.1)

Markus


comment:6 by warmerdam, 20 years ago

I have checked the latest libgrass code out of CVS and built against it. 
I found I had to revert the change suggested by Carl to get things to 
build.  Is it possible that int G_set_error_routine() has different prototypes
in libgrass and GRASS itself?  Or perhaps between libgrass (current) and some
previous release?  In libgrass CVS it looks like this:

G_set_error_routine(int (*)());

I have committed the reversion of grassdataset.cpp typedef. 


Note: See TracTickets for help on using tickets.