Installing Hugs98 (Haskell) on Mac 10.6 Snow Leopard

i have to use a program called hugs as part of one of my university modules, getting it installed on my mac proved to be a challenge, but i got it working. here is a brief guide on getting it working on 10.6. NOTE: if you are a 10.5 user the default macports install should be fine for you.

Lets Begin

hugs98 is the package available in macports to install the hugs program, so to get it you need to install macports, i wont go into the detail of that but point you to the instructions available here

to install hugs98 it should be as simple as running this command in terminal.app:

[bash]sudo port install hugs98[/bash]

but it should error out pretty quickly with a build error similar to:

[bash]
—> Building hugs98
Error: Target org.macports.build returned: shell command ” cd “/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_hugs98/work/hugs98-plus-Sep2006″ && /usr/bin/make -j2 all ” returned error 2
Command output: cd src; /usr/bin/make all
make[1]: Nothing to be done for `all’.
cd libraries; /usr/bin/make all
cd ../cpphs; HUGSFLAGS=-P../libraries/bootlib HUGSDIR=../hugsdir ../src/runhugs -98 ../packages/Cabal/examples/hapax.hs configure –verbose –hugs –prefix=’/opt/local’ –scratchdir=’../hugsdir/packages/cpphs’ –with-compiler=../src/ffihugs
runhugs: Error occurred
ERROR “../libraries/bootlib/Foreign/Ptr.hs” – Error while importing DLL “../libraries/bootlib/Foreign/Ptr.so”:
dlopen(../libraries/bootlib/Foreign/Ptr.so, 9): image not found

make[1]: *** [../hugsdir/programs/cpphs/Main.hs] Error 1
make: *** [all] Error 2

Error: Status 1 encountered during processing.
[/bash]

all is not lost however the macports bug reporter has some patches that fix the issue below are the instructions and files if you dont want to browse to the issue page and manually go and get the files, so you get hugs 98 working on your 10.6 machine:

download the 2 patch files from the issue tracker or here: patch-hugs98-Portfile, patch-libraries-tools-make-bootlib

make sure to download them to your ~/Downloads folder or amend the following instructions with the different path to the files, now run the following commands in terminal.app

[bash]
cd $(port dir hugs98)
sudo cp ~/Downloads/patch-libraries-tools-make-bootlib.diff files
sudo patch < ~/Downloads/patch-hugs98-Portfile.diff
sudo port clean hugs98
sudo port install hugs98
[/bash]

this should take a while and your terminal window should look like this:
[bash]anthonysomerset@Anthony-Somersets-MacBook:~$ cd $(port dir hugs98)
ant@ASMB:/opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/hugs98$ sudo cp ~/Downloads/patch-libraries-tools-make-bootlib.diff files
ant@ASMB:/opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/hugs98$ sudo patch < ~/Downloads/patch-hugs98-Portfile.diff patching file Portfile ant@ASMB:/opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/hugs98$ sudo port clean hugs98 —> Cleaning hugs98
ant@ASMB:/opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/hugs98$ sudo port install hugs98
—> Computing dependencies for hugs98
—> Fetching hugs98
—> Verifying checksum(s) for hugs98
—> Extracting hugs98
—> Applying patches to hugs98
—> Configuring hugs98
—> Building hugs98
—> Staging hugs98 into destroot
—> Installing hugs98 @plus-Sep2006_0
—> Activating hugs98 @plus-Sep2006_0
—> Cleaning hugs98
ant@ASMB:/opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/hugs98$ [/bash]

to launch hugs just type the following in the terminal πŸ™‚

[bash]hugs[/bash]

now go and enjoy your hugs98 geekery πŸ™‚

Posted in Tech
Tags: , , , ,
2 comments on “Installing Hugs98 (Haskell) on Mac 10.6 Snow Leopard
  1. shiny says:

    Very Very Thanks!!

  2. adil blanco says:

    thank you πŸ™‚

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.