[GRASS-dev] compilation issues with lex

Markus Neteler neteler at itc.it
Thu Aug 17 10:08:21 EDT 2006


On Thu, Aug 17, 2006 at 02:09:04PM +0100, Glynn Clements wrote:
> 
> Markus Neteler wrote:
> 
> > > OTOH, I'm a bit confused by:
> > > 
> > > lex.l:76: warning: incompatible implicit declaration of built-in function 'strdup'
> > > 
> > > which suggests that strdup() is a built-in function. strdup() isn't a
> > > particularly obvious choice for a built-in function; most built-in
> > > functions tend to be something which can be implemented in a handful
> > > of CPU instructions, e.g. memset, memcpy, etc.
> > > 
> > > I suggest looking at the logic surrounding the declaration of strdup()
> > > in string.h, in case that provides any clues.
> > 
> > Here we are:
> > 
> > /usr/include/string.h:
> > #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
> > /* Duplicate S, returning an identical malloc'd string.  */
> > extern char *strdup (__const char *__s)
> >      __THROW __attribute_malloc__ __nonnull ((1));
> > #endif
> 
> That's essentially what's in mine. Check that there isn't a private gcc
> verion in /usr/lib/gcc[-lib]/<arch>/<version>/include.

Here is what I found:

[neteler at xblade11-2 ~]$ l /usr/lib/gc
gcc/       gcc-lib/   gcj/       gcj-4.0.0/ gcj-4.0.2/ gconv/     gcrt1.o

-> looks ok

[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

[neteler at xblade11-2 ~]$ l /usr/lib/gcc-lib/i386-redhat-linux/
2.96/  3.2.3/ 3.3.4/

#######
[neteler at xblade11-2 ~]$ ls /usr/lib/gcc-lib/i386-redhat-linux/2.96/
crtbegin.o  crtbeginS.o  crtend.o  crtendS.o  libgcc.a  libgcc_eh.a

[neteler at xblade11-2 ~]$ rpm -qf /usr/lib/gcc-lib/i386-redhat-linux/2.96/libgcc.a
compat-libgcc-296-2.96-132.fc4

#######
[neteler at xblade11-2 ~]$ ls /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/
cc1       cpp0         crtbeginT.o  f771           libg2c.a   libgcc_eh.a  libstdc++.so  tradcpp0
cc1plus   crtbegin.o   crtend.o     include/       libg2c.so  libgcc_s.so  libsupc++.a
collect2  crtbeginS.o  crtendS.o    libfrtbegin.a  libgcc.a   libstdc++.a  specs

[neteler at xblade11-2 ~]$ rpm -qf /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/crtbegin.o
compat-gcc-32-3.2.3-47.fc4

#######
[neteler at xblade11-2 ~]$ ls /usr/lib/gcc-lib/i386-redhat-linux/3.3.4/
libstdc++.a  libstdc++.so  libsupc++.a

[neteler at xblade11-2 ~]$ rpm -qf /usr/lib/gcc-lib/i386-redhat-linux/3.3.4/libstdc++.so
compat-gcc-32-c++-3.2.3-47.fc4


> If there isn't,
> I have no idea why it's saying "implicit declaration".
> 
> It might be worth checking lex.yy.c, to ensure that the
> "#include <string.h>" is getting copied there.

[neteler at xblade11-2 sqlp]$ pwd
/home/neteler/software/grass6_cvs/lib/db/sqlp

[neteler at xblade11-2 sqlp]$ grep string lex.yy.c | grep inclu
#include <string.h>

The code piece in lex.yy.c is:

[...]
*               This program is free software under the GNU General Public
*               License (>=v2). Read the file COPYING that comes with GRASS
*               for details.
*
*****************************************************************************/
/****************     C-CODE   *****************/
#line 24 "lex.l"
#include <grass/sqlp.h>
#include "y.tab.h"
#include <string.h>

#undef YY_INPUT
#define YY_INPUT(b, r, ms) (r = my_yyinput(b, ms))
[...]


Thanks for your patience. Maybe it's a gcc mystery.

Markus




More information about the grass-dev mailing list