Page 1 of 1

GCC tries building libcpp using linux compiler

Posted: Fri Oct 16, 2015 3:32 pm
by mariuszp
I am trying to build a native glidix gcc using my cross-compiler that runs on linux. The configuration line I use is:

Code: Select all

../glidix-gcc/configure --host=x86_64-glidix --target=x86_64-glidix --prefix=/usr --exec-prefix=/usr --enable-languages=c --disable-nls --disable-libstdcxx
The build fails at a very strange error:

Code: Select all

make[1]: Wejście do katalogu `/home/mariusz/Madd/build/glidix/build-native-gcc/libcpp'
g++  -I../../glidix-gcc/libcpp -I. -I../../glidix-gcc/libcpp/../include -I../../glidix-gcc/libcpp/include  -g -O2 -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic -Wno-long-long  -fno-exceptions -fno-rtti -I../../glidix-gcc/libcpp -I. -I../../glidix-gcc/libcpp/../include -I../../glidix-gcc/libcpp/include   -c -o charset.o -MT charset.o -MMD -MP -MF .deps/charset.Tpo ../../glidix-gcc/libcpp/charset.c
In file included from ../../glidix-gcc/libcpp/../include/hashtab.h:40:0,
                 from ../../glidix-gcc/libcpp/../include/filenames.h:29,
                 from ../../glidix-gcc/libcpp/system.h:367,
                 from ../../glidix-gcc/libcpp/charset.c:21:
../../glidix-gcc/libcpp/../include/ansidecl.h:171:64: error: new declaration ‘char* basename(const char*)’
 #  define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
                                                                ^
../../glidix-gcc/libcpp/../include/libiberty.h:110:64: note: in expansion of macro ‘ATTRIBUTE_NONNULL’
 extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
                                                                ^
In file included from ../../glidix-gcc/libcpp/system.h:201:0,
                 from ../../glidix-gcc/libcpp/charset.c:21:
/usr/include/string.h:601:26: error: ambiguates old declaration ‘const char* basename(const char*)’
 extern "C++" const char *basename (const char *__filename)
                          ^
make[1]: *** [charset.o] Błąd 1
make[1]: Opuszczenie katalogu `/home/mariusz/Madd/build/glidix/build-native-gcc/libcpp'
make: *** [all-libcpp] Błąd 2
As we can see from the command, while building libcpp, it tries using the linux compiler (g++). My OS has no C++ cross-compiler built as I do not yet intend to support C++. So I do not even see any reason why it would try to build libcpp in the first place.

Has anyone stumbled upon this issue?

Re: GCC tries building libcpp using linux compiler

Posted: Fri Oct 16, 2015 3:33 pm
by gerryg400
These days gcc is a c++ program.

Re: GCC tries building libcpp using linux compiler

Posted: Sat Oct 17, 2015 3:21 am
by mariuszp
So i have to first port the c++ library?

Re: GCC tries building libcpp using linux compiler

Posted: Sat Oct 17, 2015 4:02 am
by madanra
At least as much as GCC uses, yes.

The last version of GCC to use only C was 4.7.4, released on 2014-06-12. The first version of GCC to use C++ was 4.8.0, released on 2013-03-22.