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


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
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.

Thanks,
Richard


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