http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59217

            Bug ID: 59217
           Summary: GCC fails to cross-build: conflicting declarations of
                    'basename', 'sbrk', etc.
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ludo at gnu dot org

Cross-building GCC for GNU/Linux, with host & build glibc 2.18, fails while
building genconstants, genhooks, & co:

#v+
In file included from ../../gcc-4.8.2/gcc/genenums.c:21:0:
../../gcc-4.8.2/gcc/system.h:444:23: error: declaration of C function 'void*
sbrk(int)' conflicts with
 extern void *sbrk (int);
                       ^
In file included from ../../gcc-4.8.2/gcc/system.h:254:0,
                 from ../../gcc-4.8.2/gcc/genenums.c:21:
/nix/store/jwd1hc3i3pmnsxf2347r4k2c77nbr9vw-glibc-2.18/include/unistd.h:1065:14:
error: previous declaration 'void* sbrk(intptr_t)' here
 extern void *sbrk (intptr_t __delta) __THROW;
[...]
In file included from ../../gcc-4.8.2/gcc/system.h:645:0,
                 from ../../gcc-4.8.2/gcc/genenums.c:21:
../../gcc-4.8.2/gcc/../include/libiberty.h:110:36: error: new declaration
'char* basename(const char*)'
 extern char *basename (const char *);
#v-

The configure flags are:

#v+
("CONFIG_SHELL=/nix/store/0r0r5wlg1mzf57haxfkalk62px93gch3-bash-4.2/bin/bash"
"SHELL=/nix/store/0r0r5wlg1mzf57haxfkalk62px93gch3-bash-4.2/bin/bash"
"--prefix=/nix/store/cjl2h4j31v03k13npnyb8v5q51qylp57-gcc-static-4.8.2"
"--enable-fast-install" "--host=mips64el-linux-gnuabi64" "--disable-shared"
"--disable-plugin" "--enable-languages=c" "--disable-libmudflap"
"--disable-libatomic" "--disable-libsanitizer" "--disable-libitm"
"--disable-libgomp" "--disable-libssp" "--disable-libquadmath"
"--disable-decimal-float" "--disable-multilib" "--disable-libstdcxx-pch"
"--with-local-prefix=/no-gcc-local-prefix"
"--with-native-system-header-dir=/nix/store/jwd1hc3i3pmnsxf2347r4k2c77nbr9vw-glibc-2.18/include"
"--with-abi=64" "CC_FOR_TARGET=mips64el-linux-gnuabi64-gcc"
"CXX_FOR_TARGET=mips64el-linux-gnuabi64-g++"
"LD_FOR_TARGET=mips64el-linux-gnuabi64-ld"
"AR_FOR_TARGET=mips64el-linux-gnuabi64-ar"
"NM_FOR_TARGET=mips64el-linux-gnuabi64-nm"
"RANLIB_FOR_TARGET=mips64el-linux-gnuabi64-ranlib"
"STRIP_FOR_TARGET=mips64el-linux-gnuabi64-strip")
#v-

(See <http://hydra.gnu.org/build/26604/nixlog/1/raw> for a complete log.)

One problem may be that all the configure tests are run with gcc (or
mips*-gcc), whereas gen{enums,hooks,checksum}.c get built with g++.  G++
automatically defines _GNU_SOURCE.  That leads to <string.h> emitting a
'basename' declaration, for instance; likewise the sbrk declaration in
<unistd.h> is conditioned by various __USE flags, which are prerequisites of
__USE_GNU.

Suggestions?

Thanks,
Ludo'.

Reply via email to