Sven Bartscher | 23 Aug 00:38 2014

Unable to build a mingw cross compiler.


I'm trying to build GHC to cross compile to windows.
GCC and friends are in /usr/bin/x86_64-w64-mingw32-*, libraries and
headers are in /usr/x86_64-w64-mingw32/{include,lib}.

I configured with:
./configure --target=x86_64-w64-mingw32 \
  --with-gcc=/usr/bin/x86_64-w64-mingw32-gcc # Needed because
  					     # otherwise /usr/bin/gcc
  					     # would be used

Building fails with the following error:
utils/hsc2hs/dist/build/Main.o: In function `s2nI_info':
(.text+0x5c5): undefined reference to `GetModuleFileNameW'
collect2: error: ld returned 1 exit status

(The GHC invocation line is included in the attached file)

So it seems that GHC either uses the wrong linker or invokes it with
the wrong search path.
However, the configure script detects the right linker

Is this a bug, or a feature?

System data:
OS: Debian jessie Linux/GNU i386
Installed GHC (for bootstrapping): version 7.6.3
GHC I'm trying to build: version 7.8.3
(Continue reading)