3

I'm trying to setup cross-mingw on a redhat cluster (x86_64 host). I don't have root access and available mingw binaries don't work (bad glibc ver, etc.). I'm going through this tutorial:

http://sourceforge.net/apps/trac/mingw-w64/wiki/Cross%20Win32%20and%20Win64%20compiler

I'm compiling from following source tarballs:

binutils-2.20.1.tar.bz2
gcc-4.7.0.tar.bz2
gmp-5.0.4.tar.bz2
mingw-w64-v2.0.2.tar.gz
mpc-0.9.tar.gz
mpfr-2.4.2.tar.bz2

Unfortunately after already managing with some problems I stuck at one during the mingw-crt compilation - step "Building the crt (Mingw-w64 itself)" from the tutorial. I'm using sysroot and have proper $PATH. Make exits with the following error after some time and some done make recipes:

x86_64-w64-mingw32-ranlib lib64/libws2_32.a
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I/home/zaluski/work/mingw-builds/mingw-w64-v2.0.2/mingw-w64-crt  -D_CRTBLD -I/var/fpwork/mingw/x86_64-w64-mingw32/include   -pipe -std=gnu99 -Wall -Wextra -Wformat -Wstrict-aliasing -Wshadow -Wpacked -Winline -Wimplicit-function-declaration -Wmissing-noreturn -Wmissing-prototypes -g -O2 -m64 -I/home/zaluski/work/mingw-builds/mingw-w64-v2.0.2/mingw-w64-crt/include -D_SYSCRT=1 -DCRTDLL=1 -c /home/zaluski/work/mingw-builds/mingw-w64-v2.0.2/mingw-w64-crt/crt/crtexe.c -o lib64/crt1.o -D__CRTDLL__ -U__MSVCRT__
{standard input}: Assembler messages:
{standard input}:713: Error: unknown pseudo-op: `.seh_handlerdata'
{standard input}:762: Error: unknown pseudo-op: `.seh_handlerdata'
make[3]: *** [lib64/crt1.o] Error 1

All I found in google was an suggestion about checking if proper compiler is being used. As I said, I have good $PATH (/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/opt/bin:/usr/atria/bin:/opt/UsageModel:/home/zaluski/bin:/var/fpwork/mingw/bin) and there is x86_64-w64-mingw32-gcc in the log.

Marcin Zaluski
  • 687
  • 5
  • 10
  • These problems are very difficult to solve, at least on my experience. I can suggest you to check which version of *gas* or *as* gcc ends up using, because it may be the native one. – dsign Apr 20 '12 at 19:10
  • GNU C (GCC) version 4.7.0 (x86_64-w64-mingw32) compiled by GNU C version 4.1.2 20080704 (Red Hat 4.1.2-46), GMP version 5.0.4, MPFR version 2.4.2, MPC version 0.9 – Marcin Zaluski Apr 23 '12 at 08:07

2 Answers2

1

The native assembler might be being used instead of the cross-compiling one. Check if *x86_64-w64-mingw32-as* is in the $PATH.

I would try running the failed command with the *x86_64-w64-mingw32-gcc -S* flag to emit assembly code myself and then compare if similar errors occur by using the emitted assembly with *x86_64-w64-mingw32-as* assembler.

panickal
  • 1,154
  • 9
  • 13
  • Also, passing `-v` to get verbose output might provide clues if the wrong `as` is being invoked. – Michael Burr Apr 23 '12 at 05:59
  • Thanks for reply. Unfortunately its not the clue (there is asm in the crt1.o right now): $ x86_64-w64-mingw32-as -v lib64/crt1.o GNU assembler version 2.20.1 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.20.1.20100303 lib64/crt1.o: Assembler messages: lib64/crt1.o:713: Error: unknown pseudo-op: `.seh_handlerdata' lib64/crt1.o:762: Error: unknown pseudo-op: `.seh_handlerdata' – Marcin Zaluski Apr 23 '12 at 08:04
0

Ok, I managed to proceed with the installation. I found out that there is SEH macro defined but it seems that it shouldn’t be, therefore conditional code fails. Quick hack solved the problem:

sed 's/#ifdef __SEH__/#ifdef __SEHWORKAROUND__/' -i mingw-builds/mingw-w64-v2.0.2/mingw-w64-crt/crt/crtexe.c

After this solution I was able to successful compile mingw-crt and go further to the next step - ‘Finishing GCC’.

Marcin Zaluski
  • 687
  • 5
  • 10