This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: multiple definition of fstat in stat.h when compiling a library
- From: Jack Stalnaker <jack dot stalnaker at gmail dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Mon, 9 Apr 2018 19:52:56 -0500
- Subject: Re: multiple definition of fstat in stat.h when compiling a library
- References: <CAOGUJ6Hy51pv175g3SCYsbxR=qvX_Ugpkv18fRQBAb1ZXXA8Aw@mail.gmail.com> <CAH6eHdTWUePXbTyZkLr1Cf2g8m43fW0phdXDcF2dC3=qXsR+8Q@mail.gmail.com>
Ha, yes, that was it. I added -std=gnu89 to my CFLAGS, and it worked.
Thanks.
On Mon, Apr 9, 2018 at 5:00 PM, Jonathan Wakely <jwakely.gcc@gmail.com>
wrote:
> On 9 April 2018 at 22:40, Jack Stalnaker wrote:
> > I am trying to compile a library I have successfully compiled in the past
> > using gcc-4.8.2. The library (graphviz) is no longer compiling under
> > gcc-7.3.0. I have contacted the library mailing list as well, but I'm not
> > sure which side the error originates from.
> >
> > One example error message looks like this:
> >
> > ../../lib/expr/.libs/libexpr_C.a(sfclose.o): In function `fstat':
> > /mygcc/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include-
> fixed/sys/stat.h:509:
> > multiple definition of `fstat'
> > ../../lib/expr/.libs/libexpr_C.a(strton.o):/mygcc/gcc-7.3.
> 0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include-fixed/sys/stat.h:509:
> > first defined here
> >
> > There are many of these for other object files, but all say that fstat is
> > multiply defined.
> >
> > Does this look familiar to anyone? Is there a workaround or something
> like
> > that?
>
> It could be caused by the change in GCC 5 to use -std=gnu99 by
> default, instead of -std=gnu89. That changes the meaning of 'inline'
> from the GNU extension to the standard C99 semantics.
>
> What is at line 509 of
> /mygcc/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include-
> fixed/sys/stat.h
> ?
>