[GRASS-dev] compilation issues with lex

Glynn Clements glynn at gclements.plus.com
Fri Aug 18 01:02:24 EDT 2006


Markus Neteler wrote:

> > > [neteler at xblade11-2 ~]$ l /usr/lib/gcc/i386-redhat-linux/4.0.2/
> > > adainclude/                   libgcc_s.so                   libmudflap.a
> > > adalib/                       libgcjawt.so                  libmudflap.so
> > > crtbegin.o                    libgcj.so                     libmudflapth.a
> > > crtbeginS.o                   libgcj.spec                   libmudflapth.so
> > > crtbeginT.o                   libgcov.a                     libobjc.a
> > > crtend.o                      libgfortran.a                 libobjc.so
> > > crtendS.o                     libgfortranbegin.a            libstdc++.a
> > > include/                      libgfortran.so                libstdc++.so
> > > libgcc.a                      libgij.so                     libsupc++.a
> > > libgcc_eh.a                   lib-gnu-java-awt-peer-gtk.so
> > > 
> > > -> looks ok
> > 
> > It's what's in the "include" directory that is relevant. gcc may
> > override some system headers by placing an alternate version in that
> > directory.
> 
> Is this the beast?
> 
> [neteler at xblade11-2 scripts]$ grep strdup /usr/lib/gcc/i386-redhat-linux/4.0.2/include/*
> /usr/lib/gcc/i386-redhat-linux/4.0.2/include/mf-runtime.h:#pragma redefine_extname strdup __mfwrap_strdup

That wasn't what I was actually thinking of, but it certainly looks
relevant. I would guess that it's causing the compiler to ignore the
strdup() declaration from <string.h> due to the name change, although
the compiler still uses the original name in the error message.

The one thing I'm still not entirely sure about is why the problem
only affects the lex.yy.c files; other files use strdup():

	grass=> select * from obj_imp where symbol = 'strdup' ;
	                       object                        | symbol 
	-----------------------------------------------------+--------
	 general/g.parser/OBJ.i686-pc-linux-gnu/main.o       | strdup
	 lib/db/sqlp/OBJ.i686-pc-linux-gnu/sql.o             | strdup
	 lib/db/sqlp/OBJ.i686-pc-linux-gnu/lex.yy.o          | strdup
	 raster/r.mapcalc/OBJ.i686-pc-linux-gnu/lex.yy.o     | strdup
	 raster/r.mapcalc/OBJ.i686-pc-linux-gnu/expression.o | strdup
	 vector/v.in.ogr/OBJ.i686-pc-linux-gnu/main.o        | strdup
	(6 rows)

It may be related to the fact that lex.yy.c doesn't include the
headers until quite far down. My copies include various standard
headers (including <string.h>) of their own accord, right at the top
of the file, although that could vary between lex implementations.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list