Skip to content

Cross compiling from Linux to Windows fails

Building from git HEAD (daed18c3) and configuring with:

./configure --target=i686-w64-mingw32

The build then fails with:

utils/hsc2hs/dist/build/Main.o: In function `c4tf_info':
(.text+0x80a): undefined reference to `GetModuleFileNameW'

but earlier on there was other suspicious output like:

utils/hsc2hs/Main.hs:234:1: Warning:
    the 'stdcall' calling convention is unsupported on this platform,
    treating as ccall
    When checking declaration:
      foreign import stdcall unsafe "static windows.h
        GetModuleFileNameW" c_GetModuleFileName
        :: Ptr () -> CWString -> Word32 -> IO Word32

which suggests that the cross tool chain is not being used. However, the configure process did indeed find the right cross compilers and linkers. From the configure output:

{{{

Building GHC version : 7.11.20150204

Git commit id : daed18c3

Build platform : x86_64-unknown-linux Host platform : x86_64-unknown-linux Target platform : i386-unknown-mingw32

Bootstrapping using : /usr/bin/ghc

which is version : 7.8.3

Using gcc : /usr/bin/i686-w64-mingw32-gcc

which is version : 4.9.2 Building a cross compiler : YES cpp : /usr/bin/i686-w64-mingw32-gcc cpp-flags : -E -undef -traditional ld : /usr/bin/i686-w64-mingw32-ld

Trac metadata
Trac field Value
Version 7.10.1-rc2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information