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

Problems with building a mingw cross-compiler


Hi,

I'm trying to compile a cross-compiler that will generate Windows binaries 
from a Linux host.  I'm hitting two (probably related) problems.

The first problem is that gcc/crtstuff.c includes
gcc/config/i386/cygming.h, which tries to #include <stdio.h>, but fails.  
This leads to FILE not being defined, causing prototypes to fail:

  [path]/build/gcc/xgcc -B[path]/build/gcc/ -nostdinc 
       -B[path]/build/i386-mingw32/newlib/ -isystem 
       [path]/build/i386-mingw32/newlib/targ-include 
       -isystem [path]/newlib/libc/include -B/usr/local/i386-mingw32/bin/ 
       -B/usr/local/i386-mingw32/lib/ -isystem 
       /usr/local/i386-mingw32/include -O2 -DIN_GCC -DCROSS_COMPILE   -W 
       -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
       -isystem ./include  -I. -I. -I../../gcc -I../../gcc/.
       -I../../gcc/config -I../../gcc/../include  -g0 
       -finhibit-size-directive -fno-inline-functions -fno-exceptions  \
       -Dinhibit_libc -c ../../gcc/crtstuff.c -DCRT_BEGIN \
       -o crtbegin.o
  In file included from tconfig.h:16,
       from ../../gcc/crtstuff.c:61:
       ../../gcc/config/i386/cygming.h:31:19: stdio.h: No such file or 
       directory
  In file included from tconfig.h:16,
       from ../../gcc/crtstuff.c:61:
       ../../gcc/config/i386/cygming.h:364: parse error before '*' token
       ../../gcc/config/i386/cygming.h:364: warning: function declaration 
       isn't a prototype
       ../../gcc/config/i386/cygming.h:366: parse error before '*' token
       ../../gcc/config/i386/cygming.h:366: warning: function 
       declaration isn't a prototype
  make[1]: *** [crtbegin.o] Error 1
  make[1]: Leaving directory 
        `/usr/src/redhat/BUILD/gcc-3..2.1-20021201-2/build/gcc'

Changing gcc/config/i386/cygming.h via:

--- cygming.h-old	Tue Jan 14 12:56:06 2003
+++ cygming.h	Tue Jan 14 12:56:17 2003
@@ -28,7 +28,7 @@
 
 #define TARGET_EXECUTABLE_SUFFIX ".exe"
 
-#include <stdio.h>
+#include "system.h"
 #include "i386/gas.h"
 #include "dbxcoff.h"
 
allows the compilation to continue.

However, later the compilation fails again.  This time, gcc complains
about missing header files, and that malloc is poisoned (whatever *that*
means).

  [path]/build/gcc/xgcc -B[path]/build/gcc/ -nostdinc 
  -B[path]/build/i386-mingw32/newlib/ -isystem 
  [path]/build/i386-mingw32/newlib/targ-include 
  -isystem [path]/newlib/libc/include 
  -B/usr/local/i386-mingw32/bin/ -B/usr/local/i386-mingw32/lib/ 
  -isystem /usr/local/i386-mingw32/include -O2 -DIN_GCC -DCROSS_COMPILE   
  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
  -isystem ./include  -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/config 
  -I../../gcc/../include  -g0 -finhibit-size-directive 
  -fno-inline-functions -fno-exceptions  \
  -Dinhibit_libc -c ../../gcc/crtstuff.c -DCRT_BEGIN \
  -o crtbegin.o
  In file included from ../../gcc/config/i386/cygming.h:31,
                   from tconfig.h:16,
                   from ../../gcc/crtstuff.c:61:
[...]
  ../../gcc/system.h:200:23: sys/time.h: No such file or directory
  ../../gcc/system.h:201:19: time.h: No such file or directory
  ../../gcc/system.h:213:20: fcntl.h: No such file or directory
  ../../gcc/system.h:251:22: sys/wait.h: No such file or directory
  ../../gcc/system.h:312:20: malloc.h: No such file or directory
  ../../gcc/system.h:381:23: sys/stat.h: No such file or directory
  In file included from tconfig.h:16,
                 from ../../gcc/crtstuff.c:61:
  ../../gcc/config/i386/cygming.h:364: parse error before '*' token
  ../../gcc/config/i386/cygming.h:364: warning: function declaration isn't 
      a prototype
  ../../gcc/config/i386/cygming.h:366: parse error before '*' token
  ../../gcc/config/i386/cygming.h:366: warning: function declaration isn't 
      a prototype
  In file included from ../../gcc/crtstuff.c:62:
  ../../gcc/tsystem.h:41:9: attempt to use poisoned "malloc"
  make[1]: *** [crtbegin.o] Error 1

I'm using gcc-3.2.1 (from http://www.trilithium.com/software/misc/) to
compile gcc-3.2.1 for the target i386-mingw32.  I've tried various
configurations (and variations on the target), none have worked.  For the
above compilation, I used:

  ../configure --target=i386-mingw32 --prefix=/usr/local 
  --with-local-prefix=/usr/local/i386-mingw32 --with-newlib 
  --enable-threads --disable-nls --enable-languages=c,c++,f77,objc 
  --disable-win32-registry --disable-shared --enable-sjlj-exceptions


This looks like some kind of path problem (cause by configure?). If so,
I'm not sure what's gone wrong.  The directory /usr/local/i386-mingw32
doesn't exist yet.

I've placed the config.cache file at:
   http://www.astro.gla.ac.uk/users/paulm/config.cache
in case its of any use.

I've also tried gcc-3.2 as well, with (more or less) identical results.

Any ideas?

Cheers,

Paul.

PS.
[path] above is /usr/src/redhat/BUILD/gcc-3..2.1-20021201-2 btw.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Particle Physics (Theory & Experimental) Groups                Dr Paul Millar 
Department of Physics and Astronomy                     paulm@astro.gla.ac.uk
University of Glasgow                                 paulm@physics.gla.ac.uk
Glasgow, G12 8QQ, Scotland             http://www.astro.gla.ac.uk/users/paulm 
+44 (0)141 330 4717        A54C A9FC 6A77 1664 2E4E  90E3 FFD2 704B BF0F 03E9
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 







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