Monday, December 14, 2009

Haskell platform and FreeBSD 8

Alright - I bit the bullet and installed FreeBSD 8 on my Vaio. I have been learning Haskell for a while and decided to install it on the laptop. ghc comes in the ports and that part was easy. Then I downloaded the haskell-platform and tried to compile it. A simple gmake will not do since there is an issue with one of the packages in the platform - namely the editline-0.2.1.0 - it apparently depends on libreadline. I tried the one in ports and I tried this libedit but none of the worked. I fiddled with copying include files between /usr/local/include and /usr/include, making symbolic links beween /usr/local/lib and /usr/lib but to no avail. At the end, I deleted the editline subdirrectory out of the whole platform and I also removed it from the platform.packages file that comes in the .tar.gz. With this out of the way and with a bunch of OpenGL libraries installed out of the /usr/ports, the Haskell platform compiled happily.

Next was cabal. It compiled with no issues and installed itself in ~/.cabal/bin. I proceeded with cabal update and then cabal install cabal-install. My final goal was to do cabal install GLFW (a Haskell binding for glfw which I installed from /usr/ports). This failed with a complaint of a missing platform.h which was included from internal.h included from enable.c. The solution was to do the following: go into .cabal/packages/hackage.haskell.org/GLFW and do tar -xzf on the .tar.gz in there. This produced a subdirectory named GLFW-0.4.1, I went in there and then to its subdir glfw/lib. In there was the enable.c and internal.h. A change needs to be made to internal.h where #include "platform.h" is changed to #include . I then copied x11/platform.h to /usr/include (as root) and suddenly cabal install GLFW worked. Voila!

2 comments:

Ognen Duzlevski said...

Install works (in terms of being error free) but it don't really work.

Ognen Duzlevski said...

I was not able to get GLFW to work - it complains with a bunch of various error when programs compiled to use it are run (it installs fine as in the original post). Better option is to install SOE.Gtk.