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

2.95,2 bug; can not create cross compiler



When trying to create a cross-compiler for the PPC target using
the 2.95.2 release, the build step falls on its own sword with
the following messages:

-----------------------------------------------------------------
.../gcc-2.95.2/gcc/xgcc -B.../gcc-2.95.2/gcc/ \
-B.../tools/powerpc-unknown-linux-gnu/bin/ \
-I.../gnu.tools/powerpc-unknown-linux-gnu/include \
-O2  -DCROSS_COMPILE -DIN_GCC -DHAIFA    -g -O2 -I./include  -fPIC -g1  \
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED    -I. -I. -I./config -I./../include \
-c -DL${name} \
       ./libgcc2.c -o ${name}.o; \
  if [ $? -eq 0 ] ; then true; else exit 1; fi; \
  powerpc-unknown-linux-gnu-ar rc tmplibgcc2.a ${name}.o; \
  rm -f ${name}.o; \
done
_muldi3
./libgcc2.c:41: stdlib.h: No such file or directory
./libgcc2.c:42: unistd.h: No such file or directory
make[3]: *** [libgcc2.a] Error 1
make[3]: Leaving directory `.../gcc-2.95.2/gcc'
make[2]: *** [stmp-multilib-sub] Error 2
make[2]: Leaving directory `.../gcc-2.95.2/gcc'
make[1]: *** [stmp-multilib] Error 1
make[1]: Leaving directory `.../gcc-2.95.2/gcc'
make: *** [all-gcc] Error 2
-----------------------------------------------------------------

This appears to be a bug in gcc/libgcc2.c, etc.  The following patch
cures the problem by recognizing that we are doing a CROSS_COMPILE
before we attempt to include missing headers:

-----------------------------------------------------------------
--- gcc/libgcc2.c~      Thu Jun 10 23:11:43 1999
+++ gcc/libgcc2.c       Wed Nov 17 15:27:06 1999
@@ -36,6 +36,14 @@
    needing header files first.  */
 /* ??? This is not a good solution, since prototypes may be required in
    some cases for correct code.  See also frame.c.  */
+
+/* In a cross-compilation situation, default to inhibiting compilation
+   of routines that use libc.  */
+
+#if defined(CROSS_COMPILE) && !defined(inhibit_libc)
+#define inhibit_libc
+#endif
+
 #ifndef inhibit_libc
 /* fixproto guarantees these system headers exist. */
 #include <stdlib.h>
@@ -55,13 +63,6 @@
 
 #if (SUPPORTS_WEAK == 1) && (defined (ASM_OUTPUT_DEF) || defined (ASM_OUTPUT_WEAK_ALIAS))
 #define WEAK_ALIAS
-#endif
-
-/* In a cross-compilation situation, default to inhibiting compilation
-   of routines that use libc.  */
-
-#if defined(CROSS_COMPILE) && !defined(inhibit_libc)
-#define inhibit_libc
 #endif
 
 /* Permit the tm.h file to select the endianness to use just for this
--- gcc/frame.c~        Wed Dec 16 15:55:48 1998
+++ gcc/frame.c Wed Nov 17 16:23:09 1999
@@ -37,6 +37,11 @@
    needing header files first.  */
 /* ??? This is not a good solution, since prototypes may be required in
    some cases for correct code.  See also libgcc2.c.  */
+
+#if defined(CROSS_COMPILE) && !defined(inhibit_libc)
+#define inhibit_libc
+#endif
+
 #ifndef inhibit_libc
 /* fixproto guarantees these system headers exist. */
-----------------------------------------------------------------

This patch lets things progress nicely, although the build rolled over
dead compiling in libio...

-----------------------------------------------------------------
.../gcc-2.95.2/gcc/xgcc -B.../gcc-2.95.2/gcc/ -B.../tools/powerpc-unknown-linux-gnu/bin/ -c -g -O2 -I. -I. -D_IO_MTSAFE_IO iogetline.c
In file included from iogetline.c:26:
libioP.h:30: errno.h: No such file or directory
In file included from iolibio.h:1,
                 from libioP.h:47,
                 from iogetline.c:26:
libio.h:30: _G_config.h: No such file or directory
iogetline.c:27: string.h: No such file or directory
make[1]: *** [iogetline.o] Error 1
make[1]: Leaving directory `.../gcc-2.95.2/powerpc-unknown-linux-gnu/libio'
make: *** [all-target-libio] Error 2
-----------------------------------------------------------------

BTW, why does the documentation for building a cross-compiler refer
to a page that hasn't been updated in over a year (the FAQ discusses
making cross-compilers with GCC 2.8.1)?  Doesn't anyone build/use
cross-compilers with the newer sources? :-)

-- 
Eric


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