This is the mail archive of the 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]

[PATCH] Fix target/11096: i686-linux to sh-linux cross compiler failsto compile C++ files is the same as,
but for SH instead of arm.
Compiling a 'hello, world' c++ program spews errors of the sort

$ sh4-linux/gcc-3.3-glibc-2.2.5/bin/sh4-linux-g++ -o sh4-linux-hello2
In file included from /home3/dank/crosstool-0.3/result/sh4-linux/gcc-3.3-glibc-2.2.5/include/c++/3.3/sh4-linux/bits/c++io.h:35,
                 from /home3/dank/crosstool-0.3/result/sh4-linux/gcc-3.3-glibc-2.2.5/include/c++/3.3/bits/fpos.h:44,
                 from /home3/dank/crosstool-0.3/result/sh4-linux/gcc-3.3-glibc-2.2.5/include/c++/3.3/iosfwd:49,
                 from /home3/dank/crosstool-0.3/result/sh4-linux/gcc-3.3-glibc-2.2.5/include/c++/3.3/ios:44,
                 from /home3/dank/crosstool-0.3/result/sh4-linux/gcc-3.3-glibc-2.2.5/include/c++/3.3/ostream:45,
                 from /home3/dank/crosstool-0.3/result/sh4-linux/gcc-3.3-glibc-2.2.5/include/c++/3.3/iostream:45,
/home3/dank/crosstool-0.3/result/sh4-linux/gcc-3.3-glibc-2.2.5/include/c++/3.3/cstdio:168: error: `
   vfscanf' not declared
/home3/dank/crosstool-0.3/result/sh4-linux/gcc-3.3-glibc-2.2.5/include/c++/3.3/cstdio:169: error: `
   vscanf' not declared

unless -D_ISOC9X_SOURCE is passed to the compiler.
The fix for arm appears to have been
which predefines _GNU_SOURCE, with the comment
/* The GNU C++ standard library currently requires _GNU_SOURCE *

Looks like other architectures might need this, too.  I'm attaching a patch
for sh4.  No idea if it's the best fix, but it seems logical,
and it seems to resolve the problem for me.
- Dan

--- gcc-3.3/gcc/config/sh/linux.h.old Wed Jun 4 17:37:40 2003 +++ gcc-3.3/gcc/config/sh/linux.h Wed Jun 4 17:38:16 2003 @@ -52,6 +52,10 @@ %{!rpath:-rpath /lib}} \ %{static:-static}"

+/* The GNU C++ standard library requires that these macros be defined.  */
 #undef LIB_SPEC
 #define LIB_SPEC \
   "%{shared: -lc} \

Dan Kegel

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