[Haskell-cafe] wxHaskell on Windows compilation problems

Michael Jones mike at proclivis.com
Fri Oct 23 15:29:03 UTC 2015


I’m trying to compile an established wxHaskell application (Ubuntu) on Windows 7 and after a day of frustration, I wanted to see if anyone had some clues.

The problem is getting wxc to compile against wxWidgets, where wxWidgets was compiled with MinGHC (GHC 7.8.4). Following are my steps up to trouble:

- On 64 bit Win 7, install MinGHC, which ends up in the AppData path.
- Grab wxWidgets with git and using MSYS shell compile like:
          mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release clean
          mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release
  with the goal of compiler compatibility.
- Setup some environment variables like:
         C_INCLUDE_PATH == C:\PCRE\include
         CPLUS_INCLUDE_PATH == C:\Libs\wxWidgets\3.0.2\include
         LIBRARY_PATH == C:\PCRE\lib;C:\Libs\wxHaskell\3.0.2\\lib\gcc_lib
         MSYSTEM == MINGW64
         WXCFG == gcc_dll\mswu
         WXWIN == C:\Libs\wxWidgets\3.0.2
         PATH = C:\Users\michaeljones\AppData\Local\Programs\minghc-7.8.4-x86_64\git-2.4.5.1\cmd;C:\Users\michaeljones\AppData\Local\Programs\minghc-7.8.4-x86_64\git-2.4.5.1\usr\bin;C:\Users\michaeljones\AppData\Local\Programs\minghc-7.8.4-x86_64\ghc-7.8.4\mingw\bin;C:\Users\michaeljones\AppData\Local\Programs\minghc-7.8.4-x86_64\ghc-7.8.4\bin;C:\Users\michaeljones\AppData\Local\Programs\minghc-7.8.4-x86_64\bin;C:\Users\michaeljones\AppData\Roaming\cabal\bin;

- Tweak wxUSE_GRAPHICS_CONTEXT
- Create sandbox for my project with pointer to a local copy of wxHaskell
- Apply a few patches to enable some new table support (stable stuff)
- Configure with cabal and compile

The first problem is it can’t run wx-config because it looks for a script, so I tweaked the Setup.hs to use the exe and it continues to compile.

It gets this error:

Building wxc
C:\Users\michaeljones\AppData\Local\Programs\minghc-7.8.4-x86_64\ghc-7.8.4\mingw\bin\gcc.exe -Isrc/include -IC:/Users/michaeljones
/Documents/linti/libs/wxHaskell/wxc -IC:/Users/michaeljones/Documents/linti/libs/wxHaskell/wxc -DWXUSINGDLL -D_UNICODE -D__WXDEBUG
__ -D__WXMSW__ -DHAVE_W32API_H -DwxcREFUSE_MEDIACTRL -DBUILD_DLL -c src\cpp\apppath.cpp -o dist\dist-sandbox-95204306\build\src/cp
p/apppath.o
In file included from C:\Libs\wxWidgets\3.0.2\include/wx/defs.h:20:0,
                 from C:\Libs\wxWidgets\3.0.2\include/wx/wx.h:14,
                 from src/include/wrapper.h:20,
                 from src\cpp\apppath.cpp:1:
C:\Libs\wxWidgets\3.0.2\include/wx/platform.h:136:22: fatal error: wx/setup.h: No such file or directory
compilation terminated.

So, I copy the wxWidgets setup.h file from include/msvc/wx to include/wx and compile to a new error:

Build log ( C:\Users\michaeljones\Documents\linti\linti-beagle\.cabal-sandbox\logs\wxc-0.92.0.0.log ):
Building wxc
C:\Users\michaeljones\AppData\Local\Programs\minghc-7.8.4-x86_64\ghc-7.8.4\mingw\bin\gcc.exe -Isrc/include -IC:/Users/michaeljones
/Documents/linti/libs/wxHaskell/wxc -IC:/Users/michaeljones/Documents/linti/libs/wxHaskell/wxc -DWXUSINGDLL -D_UNICODE -D__WXDEBUG
__ -D__WXMSW__ -DHAVE_W32API_H -DwxcREFUSE_MEDIACTRL -DBUILD_DLL -c src\cpp\apppath.cpp -o dist\dist-sandbox-95204306\build\src/cp
p/apppath.o
In file included from C:\Libs\wxWidgets\3.0.2\include/wx/platform.h:136:0,
                 from C:\Libs\wxWidgets\3.0.2\include/wx/defs.h:20,
                 from C:\Libs\wxWidgets\3.0.2\include/wx/wx.h:14,
                 from src/include/wrapper.h:20,
                 from src\cpp\apppath.cpp:1:
C:\Libs\wxWidgets\3.0.2\include/wx/setup.h:12:6: error: #error "This file should only be included when using Microsoft Visual C++"

In file included from C:\Libs\wxWidgets\3.0.2\include/wx/platform.h:136:0,
                 from C:\Libs\wxWidgets\3.0.2\include/wx/defs.h:20,
                 from C:\Libs\wxWidgets\3.0.2\include/wx/wx.h:14,
                 from src/include/wrapper.h:20,
                 from src\cpp\apppath.cpp:1:
C:\Libs\wxWidgets\3.0.2\include/wx/setup.h:121:1: error: pasting "/" and "vc_x64_dll" does not give a valid preprocessing token
C:\Libs\wxWidgets\3.0.2\include/wx/setup.h:121:1: error: pasting "vc_x64_dll" and "/" does not give a valid preprocessing token
C:\Libs\wxWidgets\3.0.2\include/wx/setup.h:121:1: error: pasting "/" and "msw" does not give a valid preprocessing token
C:\Libs\wxWidgets\3.0.2\include/wx/setup.h:121:1: error: pasting "mswu" and "/" does not give a valid preprocessing token
C:\Libs\wxWidgets\3.0.2\include/wx/setup.h:121:27: fatal error: ../../../lib/vc_x64_dll /mswu /wx/setup.h: No such file or directo

I assume the problem is that the wxWidget compilation that comes with makefile.gcc is somehow bypassing some linux based compilation method and not leaving the tree in the proper state for wxHaskell. The Wiki page is based on platform, not MinGHC.

I used MinGHC because it got me over problems compiling regex-pcre against libpcre where I failed with cygwin. From reading is appeared MinGHC was a good general path.

Note, I had the TDM compiler on the machine, but it was taken out, so there is no accidentally use of the wrong compiler or anything going on.

Does anyone have any clues how to make wxHaskell and MinGHC work together?

Mike












More information about the Haskell-Cafe mailing list