Difference between revisions of "WxHaskell/Install"

From HaskellWiki
Jump to navigation Jump to search
(redirect)
(74 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  +
#REDIRECT [[WxHaskell/Building]]
== Overview ==
 
 
This page describes how to get a working wxHaskell installation on various platforms. This is not as easy as it might be, as the wxHaskell project has not received much attention since around May 2005 (at time of writing). This means that the available binary packages are unlikely to meet your needs, and you will probably have to build from source.
 
 
Note further that much of this is getting outdated fast. Current development on wxHaskell takes
 
place in the darcs repository at http://darcs.haskell.org/wxhaskell .
 
 
== Getting wxWidgets ==
 
 
wxHaskell would not build cleanly for me with the most recent variants of wxWidgets. Under Windows, I was successful in compiling against wxWidgets 2.4.2. Mac OSX (Tiger) has a pre-installed version of wxWidgets 2.5, and it is possible to compile against this provided that a patch is applied - see the section on Mac OSX for details.
 
 
* '''For PC running Windows''': I recommend wxWidgets 2.4.2. Newer versions are alleged to build, but I (and others) have had problems. If you want to use ghci, you definitely want 2.4.2. Download from [http://sourceforge.net/project/showfiles.php?group_id=9863&package_id=14078 Sourceforge]. Unless you particularly wish to build from source, the wxMSW-2.4.2-setup.zip download is fine (it provides a Windows installer for most of what you need. Documentation is a separate (and useful) download. '''You will make your life easier if you install to a path which does not contain spaces''' - my recollection is that this is not the default provided by the installer.
 
 
* '''For Mac running OSX (Tiger)''': Either download it from wxWidgets.org or install it via MacPorts.
 
 
* '''For Linux''': Recommendations welcome...
 
 
* '''wxWidgets 2.6.3''': Jinwoo Lee, in a mail to wxhaskell-users and haskell-cafe mailing list, claims success in compiling wxHaskell against wxWidgets 2.6.3.
 
** Jinwoo writes: "I had problems when compiling wxhaskell 0.9.4 using wxWidgets 2.6.3. And I found out that in wxWidgets 2.6.3, some DB-related field names have changed:
 
*** columnSize --> columnLength
 
*** bufferLength --> bufferSize
 
** So I modified the file "db.cpp" (wxc/src/db.cpp), and succeeded to compile.
 
I'm attaching the modified file." (Editor's note: see http://www.haskell.org//pipermail/haskell-cafe/2006-July/thread.html#17042 to obtain the modified db.cpp)
 
 
== Getting wxHaskell ==
 
 
Obtain wxHaskell sources from [http://wxhaskell.sourceforge.net/download.html Sourceforge].
 
 
'''OSX caveats''':
 
 
* The installation of wxWidgets provided with OSX Tiger will not work, as it does not have the wxThread symbols that wxHaskell does want to link against.
 
 
* Programs compiled with wxHaskell do not work by default: you need to run macosx-app on them to let Mac OS X understand that the binary needs Carbon to do its UI.
 
 
== Building and installing ==
 
 
=== Windows ===
 
 
==== Assumptions (a.k.a. what I have tested) ====
 
 
* GHC 6.4.2 (Jason Dagit reports success with GHC 6.5 as well).
 
 
* Cygwin installation. See [http://wxhaskell.sourceforge.net/building-cygwin.html | wxHaskell cygwin page] for detail, but broadly, you need Cygwin bash and install binaries.
 
 
* 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/>
 
The two important things here are: 1) You must use the forward slash
 
and 2) you cannot use spaces.
 
 
After wxHaskell installed I started getting panics from 'ghc -package wx':<br/>
 
http://www.haskell.org/pipermail/glasgow-haskell-bugs/2005-October/005632.html<br/>
 
And I found a solution here:<br/>
 
http://www.haskell.org/pipermail/glasgow-haskell-bugs/2005-October/005639.html
 
 
Next I found that I needed to add <tt>C:\Program Files\Visual Haskell</tt> to
 
my path so that the wxHaskell dlls could be located by windows.
 
 
* Environment variables:
 
** 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.
 
 
=== Mac OSX ===
 
 
 
==== MacIntel or PPC, Tiger (10.4.8), GHC 6.6, wxWidgets 2.6.3, wxHaskell 0.10.1-pre ====
 
 
* Download and install wxWidgets for mac ([http://prdownloads.sourceforge.net/wxwindows/wxMac-2.6.3.tar.gz wxMac 2.6.3]) from http://www.wxwidgets.org/
 
** I changed into the wxMac topdirectory and used: <code>./configure --enable-monolithic --enable-display --enable-unicode --with-opengl --with-mac --without-odbc && make && sudo make install</code>
 
* Download the sources to wxhaskell 0.10.1-pre
 
** I used: <code>darcs get http://darcs.haskell.org/wxhaskell</code>
 
* Configure wxhaskell and install it
 
** I changed into the wxhaskell directory and used: <code>sh ./configure --wx-config=/usr/local/bin/wx-config --with-opengl && make && sudo make install && make wx && sudo make wx-install </code>
 
* Enjoy. The TimeFlows and BoucingBalls examples still suffer from not having a correct default background color. This should not affect you too much: just explicitly set the background color.
 
** Note that you need to run <code>macosx-app</code> on the programs you have built before you can manipulate the windows that program puts up. This installation process puts it in <code>/usr/local/wxhaskell/bin/macosx-app</code>
 
 
==== MacIntel, Tiger (10.4.8), GHC 6.6, wxWidgets 2.6.3 (MacPorts), wxHaskell 0.10.1-pre ====
 
 
Note: This does not necessarily work well at all. The instructions above are known to work as long as you have a recent enough XCode.
 
 
Note: I used the 6.6 binaries from the GHC site, but maybe the MacPorts version will work too.
 
 
* Download and install MacPorts
 
* <code>sudo port install wxWidgets</code>
 
* <code>darcs get http://darcs.haskell.org/wxhaskell</code>
 
* <code>./configure --wx-config=/opt/local/bin/wx-config</code>
 
* Do the standard installation from that point on
 
 
==== PPC, Tiger (10.4.7), GHC 6.4.1, wxWidgets 2.6.3, wxHaskell 0.9.4 ====
 
 
Getting wxHaskell 0.9.4 to work with Wolfgang Thaller's installer for GHC 6.4.1 and wxWidgets 2.6.3 on Tiger (10.4.7 in my case):
 
* Download and compile wxWidgets for mac (wxMac 2.6.3) from http://www.wxwidgets.org/
 
** I used: <code>./configure --disable-shared --enable-unicode --with-opengl --with-mac --without-odbc</code>
 
* Download and unzip the sources to wxhaskell 0.9.4
 
* Download and apply the unicode patch to wxhaskell 0.9.4 from http://www.loria.fr/~kow/download/patch-wxhaskell-unicode-08
 
** I used: <code> cd wxhaskell-0.9.4; patch -p1 < ../wxhaskell-unicode.patch; cd ..</code>
 
* Change makefile so that line 718 reads: <code> $(CXX) -r -keep_private_externs -nostdlib -o $(WXC-OUTDIR)/master.o $^ $(WXC-LIBS) -lSystemStubs -shared-libgcc -lstdc++-static</code> (don't forget the tab starting the line!)
 
* Check to see if you have XCode 2.3 or newer installed; with the above line, compilation will fail with lower versions, due to a lacking libstdc++-static.a
 
* Configure wxhaskell and build it
 
** I used: <code>./configure --wx-config=/usr/local/src/wxMac-2.6.3/osx-build/wx-config --with-opengl; make; make install</code>
 
* Enjoy, but beware: not everything works cleanly. I'm looking into what causes the BouncingBalls and TimeFlows examples to fail. (20060908)
 
 
==== Panther (10.3), GHC 6.4 (?), wxWidgets 2.6.*, wxHaskell 0.9.4 ====
 
 
* install wxWidgets for mac, wxmac http://www.wxwidgets.org
 
** use the --disable-shared option for configure (this isn't needed in all cases?)<br><code>./configure --disable-shared</code>
 
* Make sure you have readline installed. The simplest way is to use fink or darwinports. http://wxhaskell.sourceforge.net/building-macosx.html
 
* grab and install [[wxHaskell]]
 
* (unique to macosx!)<br><code>sudo ln -s /usr/local/wxhaskell/bin/macosx-app /usr/local/bin/</code>
 
* See below if you have any trouble
 
 
==== Unknowns ====
 
 
* Does Fink have a wxWidgets which works with this?
 
* Does wxWidgets 2.8.0 work at all?
 
 
=== Linux ===
 
 
==== Sources ====
 
 
I (Roconnor) managed to build wxHaskell from sources. I built wxGTK-2.6.4 from sources with the configuration:
 
 
<code>/usr/local/src/wxGTK-2.6.4/mybuild$ ../configure --disable-shared --with-opengl --enable-sound --enable-unicode</code>
 
 
Notice the <code>--enable-unicode</code>, which is the exact opposite of the what the current (2007-10-16) documentation says to do. To get <code>--with-opengl</code> to work I have the ubuntu/debian virtual package <code>libglu-dev</code> installed. The <code>--with-opengl</code> is probably not necessary.
 
 
For some reason my system wasn't looking for shared libraries in <code>/usr/local/lib</code>. This caused problems later for me. I had to add
 
 
<code>/usr/local/lib</code>
 
 
to my <code>/etc/ld.so.conf</code> before running <code>sudo ldconfig</code> after installing wxGTK.
 
 
After I build wxHaskell from the darcs repository, configured with <code>./configure --with-opengl</code>, and followed the usual installation documentation from here on.
 
 
==== Debian ====
 
 
For Debian Linux systems (as long as there's no .deb package):
 
 
* Fetch the rpm package from http://wxhaskell.sourceforge.net/download.html
 
* make sure you have wxWidgets installed (libraries and developer files)
 
* if you haven't done this already, install the debian package "alien": apt-get install alien
 
* use alien to install the rpm package: alien -i wxhaskell....rpm
 
* use ghc-pkg to add the packages wxcore and wx to ghc's package configuration file: <br /><code>cd /usr/lib/ghc-6.2.1/wxhaskell-0.7<br />ghc-pkg -D wxhlibdir=/usr/lib/ghc-6.2.1/wxhaskell-0.7 -ai wxcore.pkg<br />ghc-pkg -D wxhlibdir=/usr/lib/ghc-6.2.1/wxhaskell-0.7 -ai wx.pkg<br /></code>
 
 
Another way for Debian systems:<br /> use the repository "deb http://haskell-unsafe.alioth.debian.org/archive/i386 unstable ."
 
 
A way that surely works:
 
* Fetch the two deb packages on http://haskell-unsafe.alioth.debian.org/archive/i386/unstable/w/wxhaskell/
 
* apt-get install libwxgtk2.5-dev
 
* dpkg -i [name], where name is the name of the two packages, you should first install the normal package and then the dev-package
 
** <code>wxhlibdir=/usr/lib ghc-pkg -ai /usr/lib/wxcore.pkg</code>
 
** <code>wxhlibdir=/usr/lib ghc-pkg -ai /usr/lib/wx.pkg</code>
 
 
==== [[Gentoo]] ====
 
 
wxHaskell is available in portage for x86, amd64, sparc and ppc
 
 
<code>ACCEPT_KEYWORDS="~x86" emerge wxhaskell</code>
 
 
(users of other arches should use their arch keywrods as appropriate)
 
 
==== Fedora Core 6 ====
 
 
There is no wxHaskell package to go with the ghc-6.6 packages. You
 
will have to compile it yourself. This a simple matter of:
 
 
* Installing wxGTK:
 
** <code>yum install wxGTK-devel</code>
 
* Getting the sources:
 
** <code>darcs get http://darcs.haskell.org/wxhaskell</code>
 
* Configuring, building and installing:
 
** <code>configure --with-opengl && make && make install && make wx && make wx-install</code>
 
 
== Old tips ==
 
 
''WARNING: potentially obsolete''
 
 
=== Debian ===
 
 
# For Debian Linux systems (as long as there's no .deb package):
 
#* Fetch the rpm package from http://wxhaskell.sourceforge.net/download.html
 
#* make sure you have wxWidgets installed (libraries and developer files)
 
#* if you haven't done this already, install the debian package "alien": apt-get install alien
 
#* use alien to install the rpm package: alien -i wxhaskell....rpm
 
#* use ghc-pkg to add the packages wxcore and wx to ghc's package configuration file: <br /><code>cd /usr/lib/ghc-6.2.1/wxhaskell-0.7<br />ghc-pkg -D wxhlibdir=/usr/lib/ghc-6.2.1/wxhaskell-0.7 -ai wxcore.pkg<br />ghc-pkg -D wxhlibdir=/usr/lib/ghc-6.2.1/wxhaskell-0.7 -ai wx.pkg<br /></code>
 
# Another way for Debian systems:<br /> use the repository "deb http://haskell-unsafe.alioth.debian.org/archive/i386 unstable ."
 
# A way that surely works:
 
#* Fetch the two deb packages on http://haskell-unsafe.alioth.debian.org/archive/i386/unstable/w/wxhaskell/
 
#* apt-get install libwxgtk2.5-dev
 
#* dpkg -i [name], where name is the name of the two packages, you should first install the normal package and then the dev-package
 
#** <code>wxhlibdir=/usr/lib ghc-pkg -ai /usr/lib/wxcore.pkg</code>
 
#** <code>wxhlibdir=/usr/lib ghc-pkg -ai /usr/lib/wx.pkg</code>
 
 
=== [[Gentoo]] ===
 
 
wxHaskell is available in portage for x86, amd64, sparc and ppc
 
 
<code>ACCEPT_KEYWORDS="~x86" emerge wxhaskell</code>
 
 
(users of other arches should use their arch keywrods as appropriate)
 
 
=== [[Mac OS X]] ===
 
 
Getting wxHaskell 0.9.4 to work with wxWidgets 2.6 on Panther (10.3).
 
 
* install wxWidgets for mac, wxmac http://www.wxwidgets.com
 
** use the --disable-shared option for configure (this isn't needed in all cases?)<br><code>./configure --disable-shared</code>
 
* Make sure you have readline installed. The simplest way is to use fink or darwinports. http://wxhaskell.sourceforge.net/building-macosx.html
 
* grab and install [[wxHaskell]]
 
* (unique to macosx!)<br><code>sudo ln -s /usr/local/wxhaskell/bin/macosx-app /usr/local/bin/</code>
 
* See below if you have any trouble
 
 
Getting wxHaskell 0.9.4 to work with Wolfgang Thaller's installer for GHC 6.4.1 and wxWidgets 2.6.3 on Tiger (10.4.7 in my case):
 
* Download and compile wxWidgets for mac (wxMac 2.6.3) from http://www.wxwidgets.com/
 
** I used: <code>./configure --disable-shared --enable-unicode --with-opengl --with-mac --without-odbc</code>
 
* Download and unzip the sources to wxhaskell 0.9.4
 
* Download and apply the unicode patch to wxhaskell 0.9.4 from http://www.loria.fr/~kow/download/patch-wxhaskell-unicode-08
 
** I used: <code> cd wxhaskell-0.9.4; patch -p1 < ../wxhaskel-unicode.patch; cd ..</code>
 
* Change makefile so that line 718 reads: <code> $(CXX) -r -keep_private_externs -nostdlib -o $(WXC-OUTDIR)/master.o $^ $(WXC-LIBS) -lSystemStubs -shared-libgcc -lstdc++-static</code> (don't forget the tab starting the line!)
 
* Check to see if you have XCode 2.3 or newer installed; with the above line, compilation will fail with lower versions, due to a lacking libstdc++-static.a
 
* Configure wxhaskell and build it
 
** I used: <code>./configure --wx-config=/usr/local/src/wxMac-2.6.3/osx-build/wx-config --with-opengl; make; make install</code>
 
* Enjoy
 
 
Alternatively: download [http://www.cs.uu.nl/~arthurvl/wxhaskell-0.9.4-ghc-6.4.1.dmg the wxhaskell 0.9.4 installer] for GHC 6.4.1 for PPC.
 
 
Unknown:
 
 
* Does the darwinports version of wxWidgets work with wxHaskell? Would be nice if somebody made a portfile for it.
 
 
=== Errors ===
 
 
* Problems compiling wxHaskell (something like the below)<br /><code>/tmp/ghc29861.s:4379: Unknown pseudo-op:<br />.subsections_via_symbol</code><br />Make sure you have at least Xcode 1.5 (gcc 3.3 build 1671). Xcode 1.1 (gcc build 1495) is not enough
 
* More linker trouble:<code>ld: out/wxc/master.o undefined symbol 36311 (__ZdaPv) can't be a weak definition
 
/usr/bin/libtool: internal link edit command failed
 
make: *** [out/wxc/libwxc-mac2.6.2-0.9.4.dylib] Error 1</code>
 
** Fix seems to be to add the gcc 3.3 version of libstdc++ to your dylib: http://page.freett.com/shelarcy/log/2006/diary_02.html
 
** If you use gcc 4, try to add the following linker flags "-lSystemStubs -shared-libgcc -lstdc++-static". (libstdc++-static.a is part of XCode 2.3)
 
* If you get linker errors like it not being able to find _TextziParserCombinatorsziParsecziChar_alphaNum_closure, try editing config/config.mk and setting HC=ghc -lHSparsec. This is likely not a mac-specific problem but related to the use of GHC 6.2 over 6.0.1. (not sure if this is still valid)
 
* When compiling your Haskell program:<br /><code>ld: /usr/lib/crt1.o illegal reference to symbol: __objcInit defined in indirectly referenced dynamic library /usr/lib/libobjc.A.dylib</code>
 
* Adding -framework AppKit to the compiler switches for your Haskell program seems to help
 
* Certain buttons and widgets are not active
 
 
The last point is possibly a wxWidgets or a wxHaskell bug - basically, widgets in "boxed" environments do not react to user. Take out the box, and you're ok.
 
 
== [[Windows]] ==
 
 
Installing [[wxHaskell]] is easy once you realize that the batch file (wxhaskell-register.bat) only
 
works from folders with no spaces anywhere in the address, e.g. double clicking
 
C:\Cygwin\wxhaskell-0.9.4\bin\wxhaskell-register.bat works but if you put the files under C:\Documents and Settings\wxhaskell-0.9.4\... or C:\Program Files\wxhaskell-0.9.4\... it might not work. Just move the installer folder wxhaskell-0.9.4 to somewhere with no spaces in the address and double-click wxhaskell-register.bat. I hope this helps someone.
 
 
== [[BSD|FreeBSD]] ==
 
Anyone able to get wxHaskell working with FreeBSD? It's not in the ports unfortunately. I tried installing wxWidgets 2.4 and trying to install wxHaskell locally; it builds fine, but I try to build HelloWorld.hs I get some errors about pthreads. When I tried with wxWidgets 2.6, wxHaskell itself refuses to compile because it can't find GL/gl.h or something. Any tips? This is all on FreeBSD 5.5
 

Revision as of 09:05, 6 August 2008

Redirect to: