This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix genmatch linking


On Thu, 23 Oct 2014, Richard Sandiford wrote:

> Richard Biener <rguenther@suse.de> writes:
> > This adds a libcpp host module without NLS and ICONV support
> > and properly links genmatch against the build libcpp instead of
> > the host one.
> >
> > Bootstrap running on x86_64-unknown-linux-gnu (stage1 all-gcc
> > finished fine).
> >
> > Ok for trunk?
> >
> > Thanks,
> > Richard.
> >
> > 2014-10-23  Richard Biener  <rguenther@suse.de>
> >
> > 	* Makefile.def: Add libcpp build module and dependencies.
> > 	* configure.ac: Add libcpp build module.
> > 	* Makefile.in: Regenerate.
> > 	* configure: Likewise.
> >
> > 	gcc/
> > 	* Makefile.in (BUILD_CPPLIB): Add.
> > 	(build/genmatch$(build_exeext)): Use BUILD_CPPLIB, not CPPLIB.
> > 	Drop LIBIBERTY.
> 
> This breaks a -j1 (!) build on x86_64-linux-gnu for me with:
> 
> g++  -I/blah/libcpp -I. -I/blah/libcpp/../include -I/blah/libcpp/include  -g -O2 -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic -Wno-long-long  -fno-exceptions -fno-rtti -I/blah/libcpp -I. -I/blah/libcpp/../include -I/blah/libcpp/include   -c -o charset.o -MT charset.o -MMD -MP -MF .deps/charset.Tpo /blah/libcpp/charset.c
> In file included from /blah/libcpp/../include/hashtab.h:40:0,
>                  from /blah/libcpp/../include/filenames.h:29,
>                  from /blah/libcpp/system.h:367,
>                  from /blah/libcpp/charset.c:21:
> /blah/libcpp/../include/ansidecl.h:171:64: error: new declaration âchar* basename(const char*)â
>  #  define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
>                                                                 ^
> /blah/libcpp/../include/libiberty.h:113:64: note: in expansion of macro âATTRIBUTE_NONNULLâ
>  extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
>                                                                 ^
> In file included from /blah/libcpp/system.h:201:0,
>                  from /blah/libcpp/charset.c:21:
> /usr/include/string.h:597:26: error: ambiguates old declaration âconst char* basename(const char*)â
>  extern "C++" const char *basename (const char *__filename)
>                           ^
> make: *** [charset.o] Error 1
> 
> The build libiberty and libcpp share a config.cache file and both check

Ugh - why do they do this kind of thing?  Btw, I can't decipher
where or how it's doing that.

> for basename.  The problem is that libiberty is built without _GNU_SOURCE
> and doesn't see the declaration while libcpp is built with it and does
> see the declaration.  So if libiberty configures first we assume basename
> isn't available.  If they both configure at the same time we're OK.

Bah.  Where does the _GNU_SOURCE come from?  Is it libcpp being built
with C++ and libiberty build with C?

I think the solution is to force a separate config.cache for libcpp.
But as I didn't yet figure out how it ends up sharing config.cache
I didn't figure out how to disable that sharing...

Thanks,
Richard.

> Thanks,
> Richard
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]