[GRASSLIST:1831] Re: grass build error: compilation error in r.in.gdal

Glynn Clements glynn.clements at virgin.net
Wed Nov 19 15:41:01 EST 2003


Kirk R. Wythers wrote:

> > OK. I believe that this is because you need some additional switches
> > when linking against C++ code (most of GDAL is C++).
> >
> > It may suffice to replace "gcc" with "g++" in the link command. Either
> > by running the above command manually, but substituting "g++" for
> > "gcc", or by editing src/raster/r.in.gdal/Gmakefile, changing $(CC) to
> > "g++".
> >
> > Typically, there would be a standard library (or even a simple object
> > file) which defines the above symbols, and using g++ as the linker
> > will use that library (or object file) automatically.
> >
> > E.g. on Linux, C++ programs use libstdc++. Linking with "g++"
> > automatically implies "-lstdc++"; if you link with "gcc", you have to
> > explicitly add "-lstdc++" to the link command.
> >
> > Note: this issue doesn't normally arise for shared libraries, as they
> > typically include dependency information, so the linker will add any
> > dependent libraries automatically.
> 
> I'll be damned... that did it Glynn. I have not used it yet but the 
> compile finished without any errors. Just for the sake of the continued 
> pursuit of knowledge, why was this an issue on my machine and not for 
> others (who appeared... superficially at least, to be building on the 
> same/similar hardware and os (OSX 10.3.1, gcc 3.3 from xtools)?

I don't know, for sure; people who don't have any problems don't
generally post "make" output for me to see, so I don't know exactly
what was happening on such systems.

It may be that the others had a shared GDAL library; shared libraries
include dependency information, so the linker will automatically add
the necessary libraries. Or it may be that their gdal-config script
includes the additional switches in the "gdal-config --libs" output.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list