binaries produced by linux->mingw32 gcc 3.0 cross-compiler crash
Vaclav Slavik
v.slavik@volny.cz
Sun Jul 1 08:07:00 GMT 2001
Hello,
I have problems with getting gcc 3.0 to work as a cross-compiler for
i386-mingw32 target and hosted on i386-linux. I can compile binutils
and gcc w/o problems (well, almost), but binaries produced by the
compiler won't work, they crash immediately after startup.
Here's how I compiled it:
First I installed precompiled binaries of mingw-runtime-1.0-20010604
and w32api-1.0-20010606.
binutils 2.9.5.0.31:
./configure --prefix=~/mingw32 --target=i386-mingw32
make && make install
gcc 3.0:
I had to apply these patches first to get it compile:
------------------------------------
--- gcc/gthr-win32.h.orig Mon Jan 22 22:29:53 2001
+++ gcc/gthr-win32.h Sun Jun 24 20:57:28 2001
@@ -339,7 +339,7 @@
#if __MINGW32_MAJOR_VERSION >= 1 || \
(__MINGW32_MAJOR_VERSION == 0 && __MINGW32_MINOR_VERSION > 2)
#define MINGW32_SUPPORTS_MT_EH 1
-extern int __mingwthr_key_dtor PARAMS ((DWORD, void (*) (void *)));
+extern int __mingwthr_key_dtor (DWORD, void (*) (void *));
/* Mingw runtime >= v0.3 provides a magic variable that is set to
non-zero
if -mthreads option was specified, or 0 otherwise. This is to get
around
the lack of weak symbols in PE-COFF. */
------------------------------------
--- libstdc++-v3/configure.orig Thu Jun 14 10:47:36 2001
+++ libstdc++-v3/configure Sun Jun 24 22:37:32 2001
@@ -4798,32 +4798,6 @@
;;
*)
- # We assume newlib. This lets us hard-code the functions we know
- # we'll have.
- cat >> confdefs.h <<\EOF
-#define HAVE_FINITE 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define HAVE_ISNAN 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define HAVE_ISNANF 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define HAVE_ISINF 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define HAVE_ISINFF 1
-EOF
-
-
- os_include_dir="config/os/newlib"
-
- # need to check for faster f versions of math functions, ie sinf?
;;
esac
else
------------------------------------
(configure script of libstdc++ wrongly assumes newlib, if I remove
this, then it correctly uses generic code, not newlib-specific in a
couple of places)
Then:
export PATH=~/mingw32/bin:$PATH
../configure --target=i386-mingw32 --prefix=~/mingw32 \
--disable-shared --enable-languages=c++ --disable-threads
make && make install
When I try to run executable compiled with this gcc, Windows pops up
standard error dialog about illegal operation. It seems the binary is
not in correct format, since Dependency Walker (from MSVC) says
"Could not find the section that owns the Import Directory". gdb
won't launch it, either, it says "Error creating process
/cygdrive/e/x.exe, (error -1)" -- i.e. no backtrace available. When
running i386-mingw32-gcc with -v option, it shows that it uses the
correct linker and assember..
Am I missing something obvious? Any idea what's going on?
Thanks,
Vaclav Slavik
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list