Personal tools

WxHaskell/Windows

From HaskellWiki

< WxHaskell(Difference between revisions)
Jump to: navigation, search
(Update building instruction for wxHaskell 0.11.0)
m (wxWidgets 2.8 and wxHaskell 0.13.x)
(41 intermediate revisions by 5 users not shown)
Line 1: Line 1:
=== Building wxWidgets and wxc with Microsoft Visual C++ ===
+
== wxWidgets 2.9 and wxHaskell 0.90.x ==
   
The advantage of using Visual C++ is that the resulting libraries are smaller and faster than the gnu compiled ones. Furthermore, the debug version provides for automatic detection of memory leaks in the wxWidgets libraries and you get a warning when forgetting to deallocate wxWidgets objects. The drawback is that the configure scripts are not used and you will need to set some options manually.
+
{|border=1 style="border-collapse: collapse;"
  +
! Windows
  +
! Haskell Platform
  +
! wxWidgets
  +
|-
  +
|| 7 || 2011.2.0.1 || 2.9.5
  +
|-
  +
|}
   
If you want to use [http://www.microsoft.com/express/download/ Visual C++ Express Edition], you must use Visual C++ 2008 Express Editions or higher. Because previous version requires [http://msdn2.microsoft.com/express/aa700755.aspx installing Microsoft Platform SDK] before building wxWidgets or wxHaskell.
 
   
We use the wxWidgets provided workspace directly:
+
Prerequisites:
  +
* [http://sourceforge.net/projects/mingw/files/OldFiles/MinGW%205.1.6/ MinGW 5.1.6] and [http://downloads.sourceforge.net/mingw/MSYS-1.0.11.exe MSYS] 1.0.11 (a recent version of MinGW will result in incompatible DLLs). You must select the C++ compiler option when installing MinGW.
   
* '''wxWidgets 2.8''': Open the <tt>$wxwin/build/msw/wx.dsw</tt> workspace. Select menu &quot;<tt>Build/Batch build</tt>&quot; and select all configurations by using the mouse and the <tt>shift</tt> key, when you click a marker, all configurations are deselected. Next you manually select the &quot;Unicode Release&quot; and &quot;Unicode Debug&quot; versions of all projects and press &quot;Build&quot;. Afterwards, press &quot;Save All&quot; to save all your mouse clicking work :-)
 
If you want to use [http://wxhaskell.sourceforge.net/doc/Graphics.UI.WXCore.Db.html database access], [http://wxhaskell.sourceforge.net/doc/Graphics.UI.WXCore.OpenGL.html openGL canvas] and Graphics Context, you must edit <tt>$wxwin/include/msw/setup.h</tt>'s <tt>#define wxUSE_*</tt>(* is target feature name) from 0 to 1.
 
   
After building wxWidgets, you need to run <tt>configure</tt> for the wxHaskell library.
+
Environment variables:
   
<pre>&gt; cd $wxhaskell
+
* GHC_VERSION: 7.6.3 (some recent version)
&gt; ./configure --with-msc</pre>
+
* WXC_VERSION: 0.90.0.2
If you want to use the debug version of the library, use the <tt>--wxc-libname</tt> option too.
+
* WXWIN: C:\wxWidgets-2.9.5
  +
* WXCFG: gcc_dll\mswu
  +
* PATH: (add these) %WXWIN%\lib\gcc_dll;%WXWIN%;%APPDATA%\cabal\wxc-%WXC_VERSION%\%GHC_VERSION%
   
<pre>&gt; ./configure --with-msc --wxc-libname=wxcd</pre>
+
If you are using cabal-dev, you must add the following to your search path:
After configuration, first run <tt>make</tt> command to generate stc_gen.* files.
+
* wxdirect\dist\build\wxdirect
  +
* wxc\dist\build
  +
to ensure that wxdirect.exe and wxc.dll can be found.
   
<pre>&gt; make</pre>
+
Steps:
Make will stop by following error.
 
   
<pre>&gt; make: *** No rule to make target `out/wxc/wxc-msw2.8.9-0.11.0.dll', needed by `wxc'. Stop.</pre>
+
<ol>
Then go <tt>$wxhaskell/wxc</tt> directory. Here, you need to adapt the <tt>wxc-&lt;em&gt;version&lt;/em&gt;.dsp</tt> project to reference the correct wxWidgets directory. Open the <tt>.dsp</tt> file in an editor and replace all occurrences of &quot;<tt>..\..\wxWindows-2.8.9</tt>&quot; or by the installed wxWidgets directory, i.e. <tt>$wxwin</tt>.
+
<li> Download [http://wxwidgets.org/downloads wxWidgets 2.9.5 source]
  +
<li> Extract to C:\wxWidgets-2.9.5
  +
<li> [http://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW Build wxWidgets-2.9.5]
  +
<br>Edit <tt>wxwidgets-src-dir\build\msw\config.gcc</tt> so that the following values are set:
  +
<pre>
  +
SHARED ?= 1
  +
BUILD ?= release
  +
</pre>
  +
Then (in cmd.exe, ''not'' bash):
  +
<pre>
  +
cd wxwidgets-src-dir\build\msw
  +
sh
  +
mingw32-make -f makefile.gcc
  +
</pre>
  +
<li> Download [https://sourceforge.net/projects/wxhaskell/files/wx-config-win/ wx-config.exe] (a new version for wxWidgets > 2.9) and copy it somewhere into your search path, for instance via
  +
<pre>
  +
cp wx-config.exe %CABAL_DIR%\bin
  +
</pre>
  +
<li> Install the wxHaskell libraries
  +
<pre>
  +
cabal update
  +
cabal install wx
  +
</pre>
  +
Or, if you want to install the dependencies separately for some reason:
  +
<pre>
  +
cabal update
  +
cabal install wxdirect
  +
cabal install wxc
  +
cabal install wxcore
  +
cabal install wx
  +
</pre>
  +
</ol>
   
After adapting the project file, you can open the workspace <tt>wxc/wxc-&lt;em&gt;version&lt;/em&gt;.dsw</tt> and build the &quot;Unicode Release&quot; and &quot;Unicode Debug&quot; versions of the C wrapper library.
 
   
And finally! – you can run <tt>make</tt> in the <tt>$wxhaskell</tt> directory to build the Haskell libraries.
+
=== DLLs ===
   
<pre>&gt; cd $wxhaskell
+
In order to run a wxHaskell application, Windows must be able to find the following wxWidgets DLLs (see [http://msdn.microsoft.com/en-us/library/7d83bc18(v=vs.71).aspx Search Path Used by Windows to Locate a DLL]):
&gt; make
 
&gt; make install
 
&gt; make wx
 
&gt; make wx-install</pre>
 
   
== User experiences ==
+
(If you built wxWidgets in directory wxWidgets-2.9.5,
==== GHC 6.10.1, wxWidgets 2.8.9, wxHaskell 0.11.0 (binary) ====
+
the following files can be found in wxWidgets-2.9.5\lib\gcc_dll\ (change revision as needed))
  +
* wxbase295u_gcc_custom.dll
  +
* wxbase295u_net_gcc_custom.dll
  +
* wxbase295u_xml_gcc_custom.dll
  +
* wxmsw295u_adv_gcc_custom.dll
  +
* wxmsw295u_aui_gcc_custom.dll
  +
* wxmsw295u_core_gcc_custom.dll
  +
* wxmsw295u_gl_gcc_custom.dll
  +
* wxmsw295u_html_gcc_custom.dll
  +
* wxmsw295u_propgrid_gcc_custom.dll
  +
* wxmsw295u_ribbon_gcc_custom.dll
  +
* wxmsw295u_richtext_gcc_custom.dll
  +
* wxmsw295u_stc_gcc_custom.dll
  +
* wxmsw295u_xrc_gcc_custom.dll
   
# Download the wxhaskell binary from [http://sourceforge.net/project/showfiles.php?group_id=73133&package_id=73173&release_id=649115 sourceforge]
+
The following file can be found in directory wxc\dist\build\, after building package wxc in directory wxc:
# Unpack wxhaskell-*.zip. And double-click wxhaskell-*\bin\wxhaskell-register.bat.
+
* wxc.dll (be sure to recompile and copy this one when you compile your application with a new compiler)
# wxhaskell-register.bat install wxHaskell to your system.
 
   
==== Assumptions (a.k.a. what I have tested) ====
+
Furthermore, the following DLLs need to be in the search path (these can be found in directory "Haskell Platform\2012.2.0.0\mingw\bin\", or in ghc-7.4.2\mingw\bin\ if you installed the compiler only (change revision as needed)):
  +
* libgcc_s_dw2-1.dll
  +
* libstdc++-6.dll
  +
* mingwm10.dll
   
* GHC 6.4.2 (Jason Dagit reports success with GHC 6.5 as well).
+
Some wxHaskell applications also require the following DLLs:
  +
* uuid.dll
  +
* perl510.dll
  +
* libapr-1.dll
  +
* libapriconv-1.dll
  +
* libaprutil-1.dll
   
* Cygwin installation. See [[WxHaskell/Cygwin]] for detail, but broadly, you need Cygwin bash and install binaries.
+
These DLLs can be obtained by installing [http://sourceforge.net/projects/xampp/files/XAMPP%20Windows/1.7.4/ XAMPP 1.7.4]; the DLLs are in the directories:
  +
* xampp\perl\site\lib\auto\APR\UUID
  +
* xampp\perl\bin
  +
* xampp\apache\bin
   
* wxWidgets built/installed in a path with no spaces in it. Actually you can use a path with spaces but there are a few rules. For example, I had ghc installed to this location:<br/><tt>C:\Program Files\Visual Haskell</tt><br/>So this required me to use the following configure command:<br/><tt>./configure --libdir=C:/Progra~1/Visual~1</tt><br/>
+
If there are still DLLs missing, you can find out which, using [http://cygwin.com/cygwin-ug-net/using-utils.html cygcheck] from the [http://www.cygwin.com/ Cygwin project]. Note, that you will get problems if you have both MinGW and Cygwin in your search path; it is best to specify the full path to cygcheck.exe, or copy cygcheck.exe to some location in the search path.
The two important things here are: 1) You must use the forward slash
+
Sample command:
and 2) you cannot use spaces.
+
C:\programs\cygwin\bin\cygcheck.exe .\h.exe
  +
(the .\ must be specified)
   
Next I found that I needed to add <tt>C:\Program Files\Visual Haskell</tt> to
+
== wxWidgets 2.8 and wxHaskell 0.13.x ==
my path so that the wxHaskell dlls could be located by windows.
 
   
* Environment variables:
+
Follow [http://www.scribd.com/doc/38034374/20100923-WxHaskell-Setup SkyTreeBird's guide]. It which walks you through the basic steps
** PATH should include MinGW and Cygwin binary directories. MinGW must come before Cygwin in PATH.
 
** WXHASKELL environment var points to wxHaskell install directory.
 
** WXWIN environment directory points to wxWidgets install directory.
 
   
For more detailed information, see [http://biolpc22.york.ac.uk/pub/2.6.4/install-msw-2.6.4.txt Installing wxWidgets 2.6.4 on Microsoft Windows 9x/ME, Windows NT, Windows 2000, Windows XP, and Windows CE].
+
* wx-config
  +
* wxPack
  +
* setting up environment variables
  +
* <code>cabal install wx</code>
  +
  +
Note that the best way to refer to WxWidgets in your PATH is probably to use the WXWIN variable that you set, eg. <code>%WXWIN%\lib\gcc_dll</code>
  +
  +
The guide has been tested with the following configurations. Others may work too:
  +
  +
{|border=1 style="border-collapse: collapse;"
  +
! Windows
  +
! Haskell Platform
  +
! wxWidgets
  +
|-
  +
|| XP || 2010.2.0.0 || 2.8.10
  +
|-
  +
|| 7 || 2011.2.0.1 || 2.8.12
  +
|}
  +
  +
  +
=== DLLs ===
  +
  +
In order to run a wxHaskell application, the following DLLs must be in the search path:
  +
  +
* mingwm10.dll; this can be found in directory "Haskell Platform\2012.2.0.0\mingw\bin\", or in ghc-7.4.2\mingw\bin\ if you installed just the compiler (change revision as needed)
  +
  +
* wxmsw28u_gcc_custom.dll
  +
  +
  +
  +
=== Troubleshooting installation with cabal ===
  +
  +
These remarks refer to wx-0.13.2 and Haskell Platform 2011.4.0.0 on Windows 7.
  +
  +
Cabal package wx depends on wxcore which depends on wxdirect. By default cabal installs on a per user base, thus wxdirect.exe will be installed to <code>c:\Users\<YOUR NAME>\AppData\Roaming\cabal\bin\</code>. This folder must be in your <code>PATH</code> for <code>cabal install wxcore</code> to succeed.
  +
  +
Package wxcore-0.13.2 does not work well with wx-config revision 21 2006-10-19 (downloaded from [http://sites.google.com/site/wxconfig/ here] on Feb 2<sup>nd</sup> 2012). If <code>cabal install wxcore</code> fails with an output containing "Usage: wx-config [options]" try this:
  +
  +
* <code>cabal unpack wxcore</code>
  +
* <code>cd wxcore-0.13.2</code>
  +
* edit <code>Setup.hs</code> and comment out/remove the line containing <code>"wx-config" ["--version"]</code>
  +
* <code>runhaskell.exe Setup.hs configure --user</code>
  +
* <code>runhaskell.exe Setup.hs build</code>
  +
* <code>runhaskell.exe Setup.hs install</code>
  +
  +
Finally call <code>cabal install wx</code>.
   
 
== See also ==
 
== See also ==

Revision as of 08:53, 31 August 2013

Contents

1 wxWidgets 2.9 and wxHaskell 0.90.x

Windows Haskell Platform wxWidgets
7 2011.2.0.1 2.9.5


Prerequisites:

  • MinGW 5.1.6 and MSYS 1.0.11 (a recent version of MinGW will result in incompatible DLLs). You must select the C++ compiler option when installing MinGW.


Environment variables:

  • GHC_VERSION: 7.6.3 (some recent version)
  • WXC_VERSION: 0.90.0.2
  • WXWIN: C:\wxWidgets-2.9.5
  • WXCFG: gcc_dll\mswu
  • PATH: (add these) %WXWIN%\lib\gcc_dll;%WXWIN%;%APPDATA%\cabal\wxc-%WXC_VERSION%\%GHC_VERSION%

If you are using cabal-dev, you must add the following to your search path:

  • wxdirect\dist\build\wxdirect
  • wxc\dist\build

to ensure that wxdirect.exe and wxc.dll can be found.

Steps:

  1. Download wxWidgets 2.9.5 source
  2. Extract to C:\wxWidgets-2.9.5
  3. Build wxWidgets-2.9.5
    Edit wxwidgets-src-dir\build\msw\config.gcc so that the following values are set:
     SHARED ?= 1
     BUILD ?= release
    

    Then (in cmd.exe, not bash):

     cd wxwidgets-src-dir\build\msw
     sh
     mingw32-make -f makefile.gcc
    
  4. Download wx-config.exe (a new version for wxWidgets > 2.9) and copy it somewhere into your search path, for instance via
    cp wx-config.exe %CABAL_DIR%\bin
    
  5. Install the wxHaskell libraries
    cabal update
    cabal install wx
    

    Or, if you want to install the dependencies separately for some reason:

    cabal update
    cabal install wxdirect
    cabal install wxc
    cabal install wxcore
    cabal install wx
    


1.1 DLLs

In order to run a wxHaskell application, Windows must be able to find the following wxWidgets DLLs (see Search Path Used by Windows to Locate a DLL):

(If you built wxWidgets in directory wxWidgets-2.9.5, the following files can be found in wxWidgets-2.9.5\lib\gcc_dll\ (change revision as needed))

  • wxbase295u_gcc_custom.dll
  • wxbase295u_net_gcc_custom.dll
  • wxbase295u_xml_gcc_custom.dll
  • wxmsw295u_adv_gcc_custom.dll
  • wxmsw295u_aui_gcc_custom.dll
  • wxmsw295u_core_gcc_custom.dll
  • wxmsw295u_gl_gcc_custom.dll
  • wxmsw295u_html_gcc_custom.dll
  • wxmsw295u_propgrid_gcc_custom.dll
  • wxmsw295u_ribbon_gcc_custom.dll
  • wxmsw295u_richtext_gcc_custom.dll
  • wxmsw295u_stc_gcc_custom.dll
  • wxmsw295u_xrc_gcc_custom.dll

The following file can be found in directory wxc\dist\build\, after building package wxc in directory wxc:

  • wxc.dll (be sure to recompile and copy this one when you compile your application with a new compiler)

Furthermore, the following DLLs need to be in the search path (these can be found in directory "Haskell Platform\2012.2.0.0\mingw\bin\", or in ghc-7.4.2\mingw\bin\ if you installed the compiler only (change revision as needed)):

  • libgcc_s_dw2-1.dll
  • libstdc++-6.dll
  • mingwm10.dll

Some wxHaskell applications also require the following DLLs:

  • uuid.dll
  • perl510.dll
  • libapr-1.dll
  • libapriconv-1.dll
  • libaprutil-1.dll

These DLLs can be obtained by installing XAMPP 1.7.4; the DLLs are in the directories:

  • xampp\perl\site\lib\auto\APR\UUID
  • xampp\perl\bin
  • xampp\apache\bin

If there are still DLLs missing, you can find out which, using cygcheck from the Cygwin project. Note, that you will get problems if you have both MinGW and Cygwin in your search path; it is best to specify the full path to cygcheck.exe, or copy cygcheck.exe to some location in the search path. Sample command:

 C:\programs\cygwin\bin\cygcheck.exe .\h.exe

(the .\ must be specified)

2 wxWidgets 2.8 and wxHaskell 0.13.x

Follow SkyTreeBird's guide. It which walks you through the basic steps

  • wx-config
  • wxPack
  • setting up environment variables
  • cabal install wx

Note that the best way to refer to WxWidgets in your PATH is probably to use the WXWIN variable that you set, eg. %WXWIN%\lib\gcc_dll

The guide has been tested with the following configurations. Others may work too:

Windows Haskell Platform wxWidgets
XP 2010.2.0.0 2.8.10
7 2011.2.0.1 2.8.12


2.1 DLLs

In order to run a wxHaskell application, the following DLLs must be in the search path:

  • mingwm10.dll; this can be found in directory "Haskell Platform\2012.2.0.0\mingw\bin\", or in ghc-7.4.2\mingw\bin\ if you installed just the compiler (change revision as needed)
  • wxmsw28u_gcc_custom.dll


2.2 Troubleshooting installation with cabal

These remarks refer to wx-0.13.2 and Haskell Platform 2011.4.0.0 on Windows 7.

Cabal package wx depends on wxcore which depends on wxdirect. By default cabal installs on a per user base, thus wxdirect.exe will be installed to c:\Users\<YOUR NAME>\AppData\Roaming\cabal\bin\. This folder must be in your PATH for cabal install wxcore to succeed.

Package wxcore-0.13.2 does not work well with wx-config revision 21 2006-10-19 (downloaded from here on Feb 2nd 2012). If cabal install wxcore fails with an output containing "Usage: wx-config [options]" try this:

  • cabal unpack wxcore
  • cd wxcore-0.13.2
  • edit Setup.hs and comment out/remove the line containing "wx-config" ["--version"]
  • runhaskell.exe Setup.hs configure --user
  • runhaskell.exe Setup.hs build
  • runhaskell.exe Setup.hs install

Finally call cabal install wx.

3 See also