Personal tools

WxHaskell/Install

From HaskellWiki

< WxHaskell(Difference between revisions)
Jump to: navigation, search
(redirect)
 
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Overview ==
+
#REDIRECT [[WxHaskell/Building]]
 
This page describes how to get a working wxHaskell installation on various platforms. The wxHaskell team have prepared a candidate for their latest official release (of March 2008) [please test it out].
 
 
The installation process has become increasingly stable and simple, but some of the information on this page could become outdated. Current development on wxHaskell takes place in the darcs repository at http://darcs.haskell.org/wxhaskell .
 
 
== Getting wxWidgets ==
 
 
wxHaskell 0.10.x does not yet support wxWidgets 2.8. Generally, the recommended version to use is 2.6.4 (it's what the binaries are compiled against).
 
 
* Windows:
 
* MacOS X
 
** Tiger - do not use the wxMac 2.5 that comes pre-installed (we don't know if it works or not, but you are welcome to try and let us know(
 
** Leopard - sorry, wxWidgets 2.6 has been reported not to compile on Leopard. We're working on 2.8 compatibility as fast as we can! In the meantime, let us know if you succeed in getting 2.6 running on Leopard
 
* Linux - the wxWidgets that ships with your system (as long as it's the 2.6 one and not the 2.8 one) should work.
 
 
See [http://wxwidgets.org the wxWidgets site] for more details
 
 
== 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 ===
 
 
==== GHC 6.8.2, wxWidgets 2.6.4, wxHaskell 0.10.3rc1 (binary) ====
 
 
# Download the 0.10.3 release candidate from [http://sourceforge.net/project/showfiles.php?group_id=73133&package_id=73173&release_id=582361 sourceforge]
 
# Unpack wxhaskell-*.zip. And double-click wxhaskell-*\bin\wxhaskell-register.bat.
 
# wxhaskell-register.bat install wxHaskell to your system.
 
#* Note: wxhaskell-register.bat doesn't work when your wxHaskell directory in the Desktop. So, you must move wxHaskell directory if it's in the Desktop.
 
 
==== 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.
 
 
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 ===
 
 
==== Mac (Intel and PowerPC), Tiger (10.4.11), GHC 6.8.2, wxWidgets 2.6.4, wxHaskell 0.10.3rc1 (binary) ====
 
 
# Download and install wxWidgets for mac ([http://prdownloads.sourceforge.net/wxwindows/wxMac-2.6.4.tar.gz wxMac 2.6.4]) from http://www.wxwidgets.org/ (make sure you configure with <code>--enable-unicode</code>)
 
# Download the wxhaskell binary from [http://sourceforge.net/project/showfiles.php?group_id=73133&package_id=73173&release_id=582361 sourceforge]
 
# Open the dmg, double-click the .pkg file
 
 
==== MacIntel, Tiger (10.4.11, XCode 2.5), GHC 6.8.2, wxWidgets 2.6.4, wxHaskell 0.10.2 (hackage) ====
 
 
built on 2008-02-16
 
# Download and install wxWidgets for mac ([http://prdownloads.sourceforge.net/wxwindows/wxMac-2.6.4.tar.gz wxMac 2.6.4]) from http://www.wxwidgets.org/
 
#* I changed into the wxMac topdirectory and used: <code>./configure --disable-monolithic --enable-display --enable-unicode --with-opengl --with-mac --without-odbc --enable-mediactrl && make && sudo make install</code>
 
#* <code>sudo mkdir -p /usr/local/wxhaskell/bin</code>
 
#* <code>sudo ln -s /usr/local/bin/wx-config /usr/local/wxhaskell/bin</code>
 
# <code>sudo cabal install wx-core</code>
 
# <code>cabal install wx</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>
 
 
* Does wxWidgets 2.8.0 work at all? [as of 2008-02-16, no]
 
 
=== Linux ===
 
 
==== Sources ====
 
 
Built wxGTK-2.6.4 from sources with the configuration:
 
 
<code>/usr/local/src/wxGTK-2.6.4/mybuild$ ../configure --enable-sound --enable-unicode</code>
 
 
Add <code>/usr/local/lib</code> to your <code>/etc/ld.so.conf</code> before running <code>sudo ldconfig</code> after installing wxGTK.
 
 
Build wxHaskell from the darcs repository, configured with <code>./configure --enable-split-objs -hcprof</code>, and follow the usual installation documentation from here on. The --enable-split-objs and -hcprof options are not mandatory, but they are nice to have
 
 
:''Note 2008-02-20: there was a bug that made --with-opengl necessary on some systems (depending on how wxWidgets was built), but it has been fixed''
 
 
==== Debian and Ubuntu ====
 
 
===== Ghc 6.6 version =====
 
For Debian Linux systems:
 
 
# get wxWidgets 2.6
 
#* <code>aptitude install libwxgtk2.6-dev</code>
 
# obtain the wxhaskell-bin-debian-gtk2.6.3-ghc6.6-0.10.3-rc1.deb package from [http://sourceforge.net/project/showfiles.php?group_id=73133 sourceforge]
 
#* Install it with <code>dpkg -i</code>
 
 
===== Ghc 6.8 version =====
 
# get wxWidgets 2.6
 
#* <code>aptitude install libwxgtk2.6-dev</code>
 
# get ghc
 
#* <code>apt-get --target-release=unstable install ghc6</code>
 
# obtain the wxhaskell-bin-gtk2.6.3-ghc6.8.2-0.10.3-rc1.deb package from [http://sourceforge.net/project/showfiles.php?group_id=73133 sourceforge]
 
#* Install it with <code>dpkg -i</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 && make && make install && make wx && make wx-install</code>
 
 
== Troubleshooting ==
 
 
=== Compilation issues ===
 
 
* Trouble building wxWidgets (MacOS X Tiger)
 
** <code>ld: /System/Library/Frameworks/WebKit.framework/WebKit load command 20 unknown cmd field</code>
 
** <code>/usr/bin/libtool: internal link edit command failed</code>
 
** <code>make: *** [lib/libwx_macu_core-2.6.0.4.0.dylib]</code>
 
** <b>Likely Solution</b>: Upgrade to XCode >= 2.5
 
* Can't build wxWidgets 2.6 (MacOS X Leopard)
 
** <b>Possible solution</b>: [unverified 2008-03-06] install wxWidgets 2.6 by Macports.
 
*** <code>sudo port install wxwidgets26</code>
 
** <b>Possible solution</b>: [unverified 2007-03-06] try <code>--with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk</code> or same things to use 10.4 SDK in wxWidgets config.
 
*** http://www.wxwidgets.org/wiki/index.php/Mac_OS_X_And_Xcode_For_Beginners#Configure
 
*** Note: Online resources say that this is the solution to build wxWidgets 2.6.* on Leopard. But we haven't tested this out yet. If you succeed in use wxHaskell on Leopard this way, please report wxhaskell-users mailing-list!
 
* Configure Succeeded (and nothing more)
 
** <b>Solution</b>: Upgrade to the latest version of Cabal and cabal-install (darcs)
 
* error build wxcore
 
** <code>/usr/libexec/gcc/i686-apple-darwin8/4.0.1/libtool: can't locate file for: -lwx_macu_media-2.6</code>
 
** <code>/usr/libexec/gcc/i686-apple-darwin8/4.0.1/libtool: file: -lwx_macu_media-2.6 is not an object file (not allowed in a library)</code>
 
** <b>Solution</b>: try --enable-mediactrl in the wxWidgets configure
 
* <code>Too many levels of symbolic links</code> (Linux)
 
** UNKNOWN!
 
 
=== App-compilation issues ===
 
 
* <code>Could not find module `Graphics.UI.WX':</code>
 
** <b>Solution</b> Make sure you build and install the wx package too (wxhaskell comes in two parts, <code>wxcore</code>, which is what you get if you do ./configure; make; make install; and <code>wx</code>, which you can install by cd'ing into its directory and doing the standard Cabal stuff)
 
* sample application dies with something like (Linux)
 
** <code>/usr/lib/libwxc-gtk2.6.3-0.10.2.so: undefined reference to `wxGLCanvas::SwapBuffers()'</code>
 
** <code>/usr/lib/libwxc-gtk2.6.3-0.10.2.so: undefined reference to `wxGLCanvas::SetCurrent()'</code>
 
** <code>/usr/lib/libwxc-gtk2.6.3-0.10.2.so: undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)'</code>
 
** <code>/usr/lib/libwxc-gtk2.6.3-0.10.2.so: undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, wxGLCanvas const*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)'</code>
 
** <code>/usr/lib/libwxc-gtk2.6.3-0.10.2.so: undefined reference to `wxGLCanvas::SetColour(wchar_t const*)'</code>
 
** <code>collect2: ld returned 1 exit status</code>
 
** <b>Solution</b> Update to the latest wxhaskell (the darcs version on 2008-02-20) (before, --with-opengl was required, now it is not)
 
* Unknown...
 
** <code></code>
 
** <code>/usr/lib/libwxc-gtk2.6.3-0.10.1.so: undefined reference to `wxWindowBase::Hide()'</code>
 
** ...
 
** <code>`wxLog::AddTraceMask(wxString const&)' /usr/lib/libwxc-gtk2.6.3-0.10.1.so: undefined reference to `wxHtmlHelpController::GetFrame()'</code>
 
** <code>/usr/lib/libwxc-gtk2.6.3-0.10.1.so: undefined reference to `wxPrintData::SetQuality(int)'</code>
 
** <code>collect2: ld returned 1 exit status</code>
 
=== Runtime issues ===
 
 
* sample applications just sit there doing nothing (MacOS X)
 
** <b>Solution</b>: <code>macosx-app</code> the application
 
* sample applications segfault!
 
** <b>Solution</b>: downgrade from wxWidgets 2.8 to wxWidgets 2.6 (2008-02-16: wxhaskell doesn't work yet with the latest version)
 
** But I can't build wxWidgets 2.6 on Mac OS X Leopard (10.5.x).
 
*** <b>Solution</b>: see [[#Compilation issues|above]]
 
* wxhaskell builds fine, but sample applications do this:
 
** <code>dyld: Symbol not found: __ZN8wxThread11TestDestroyEv</code>
 
** <code>Referenced from: /usr/local/wxhaskell/lib/libwxc-mac2.8.7-0.10.1.dylib</code>
 
** <code>Expected in: flat namespace</code>
 
** <code></code>
 
** <code>trace trap ./BouncingBalls</code>
 
** <b>Solution</b>: try <code>--enable-shared</code> in wxWidgets config
 
* Certain buttons and widgets (particularly, those inside of "boxed" environments) are not active (still a problem, 2008-02-20)
 
** <b>Solution</b>: upgrade to latest version (probably 0.10.3 as of 2008-03-30, or darcs repository until then). It was a wxHaskell bug that is now fixed.
 
* I only see the first letter of every word
 
** <b>Solution</b> build wxWidgets with <code>--enable-unicode</code>. (We now use wchar* to store strings; but if wxWidgets is compiled without unicode, it thinks it's using char* and that null bytes are string terminators)
 
 
=== Old issues ===
 
 
''WARNING: potentially obsolete''
 
 
* Problems compiling wxHaskell (something like the below) (MacOS X)
 
**<code>/tmp/ghc29861.s:4379: Unknown pseudo-op:</code>
 
**<code>.subsections_via_symbol</code>
 
**<b>Solution</b>: 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 (MacOS X):
 
** <code>ld: out/wxc/master.o undefined symbol 36311 (__ZdaPv) can't be a weak definition</code>
 
** <code>/usr/bin/libtool: internal link edit command failed</code>
 
** <code>make: *** [out/wxc/libwxc-mac2.6.2-0.9.4.dylib] Error 1</code>
 
** <b>Solution?</b>: Add the gcc 3.3 version of libstdc++ to your dylib: http://page.freett.com/shelarcy/log/2006/diary_02.html
 
** <b>Solution?</b>If you use gcc 4, try to add the following linker flags <code>"-lSystemStubs -shared-libgcc -lstdc++-static"</code>. (libstdc++-static.a is part of XCode 2.3)
 
* [OBSOLETE?] If you get linker errors like it not being able to find _TextziParserCombinatorsziParsecziChar_alphaNum_closure
 
** <b>Solution:</b>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)
 
* [OBSOLETE?] When compiling your Haskell program (MacOS X):
 
**<code>ld: /usr/lib/crt1.o illegal reference to symbol: __objcInit defined in indirectly referenced dynamic library /usr/lib/libobjc.A.dylib</code>
 
**<b>Solution:</b>Adding -framework AppKit to the compiler switches for your Haskell program seems to help
 

Latest revision as of 09:05, 6 August 2008

  1. REDIRECT WxHaskell/Building