Skip to main content

Installing GHC 6.12.2 on Red Hat Entrprise Linux 5.4 (i386)

Haskell, a general-purpose, purely functional programming language, has become more and more interesting for me, it allows me to write maintainable code, with acceptable performance even for tasks like analyzing large log files. I recently discovered how easy it is to write programs interacting with a unix like environment. It also very easy to write networking code. Haskell offers great opportunities for TDD and SDD through HUnit and QuickCheck, which - together with the pure and strong static type system of the language itself - enable trust in program correctness, which is vital for many commercial applications, or applications exposed to increased security requirements.

In order to leverage the outstandingly great features of Haskell, one has to have that beast running on a stable, proven and hence archaic and outdated operating system. Even if one is not a firm believer in magical awesomeness of Enterprise labels on top of ridiculously obsolete tools(like gcc 4.1 and glibc 2.5), the server landscape might require to use a specific Linux distribution, because of proprietary drivers for specialized hardware components, in this post I will assume that this Linux distro is Red Hat Entrprise Linux 5.4 and explain the cumbersome installation of the latest and greatest Haskell compiler.

Step 0: Preparing the build environment


As a non-commercial 100% binary compatible replacement for RHEL with only the proprietary art work replaced Cent OS should be used. I installed Cent OS 5.4 i386 without any GNOME or KDE and with bridge networking in a Virtual Box with on an Arch Linux host.

Step 1: Installing GHC 6.8.3


Because the generic binary linux distribution of GHC 6.12.2 depends on at least the 2.7 version of glibc, and RHEL 5.4 only provides glibc 2.5, it is necessary to build it from the sources. Strangely the GHC source distribution needs an existing GHC to compile it: in order to compile GHC 6.12.2 from source we need to have a GHC already installed. The latest GHC version with a generic linux binray distribution compatible with glibc 2.5 is GHC 6.8.3.

These are the required commands(execute as root) to install GHC 6.8.3 into /usr/local:

[root@noname ~]# wget http://haskell.org/ghc/dist/6.8.3/ghc-6.8.3-i386-unknown-linux.tar.bz2
[root@noname ~]# tar xvfj ghc-6.8.3-i386-unknown-linux.tar.bz2
[root@noname ~]# cd ghc-6.8.3
[root@noname ghc-6.8.3]# ./configure
[root@noname ghc-6.8.3]# make install

Try running ghci, the interactive Haskell REPL, it should start and welcome its user with a warm...

[root@noname ~]# ghci
GHCi, version 6.8.3: http://www.haskell.org/ghc/ :? for help
Loading package base ... linking ... done.
Prelude>


Step 2: Building GHC-6.12.2


GHC 6.12.2 can now be built from source using the GHC 6.8.3 from the previous build...

wget http://haskell.org/ghc/dist/6.12.2/ghc-6.12.2-src.tar.bz2
tar xfvj ghc-6.12.2-src.tar.bz2
cd ghc-6.12.2
./configure
make

STOP do not make install just yet. Before, move your /usr/local/ to /usr/local.ghc683 in order to get a clean
install of GHC 6.12 in /usr/local with make install.

Harvest the result of your hard work


Now would be an excellent moment to save a snapshot of your /usr/local directory.
If I knew where I would even upload an archived version of mine.

Comments

Popular posts from this blog

Lazy Evaluation(there be dragons and basement cats)

Lazy Evaluation and "undefined" I am on the road to being a haskell programmer, and it still is a long way to go. Yesterday I had some nice guys from #haskell explain to me lazy evaluation. Take a look at this code: Prelude> let x = undefined in "hello world" "hello world" Prelude> Because of Haskells lazyness, x will not be evaluated because it is not used, hence undefined will not be evaluated and no exception will occur. The evaluation of "undefined" will result in a runtime exception: Prelude> undefined *** Exception: Prelude.undefined Prelude> Strictness Strictness means that the result of a function is undefined, if one of the arguments, the function is applied to, is undefined. Classical programming languages are strict. The following example in Java will demonstrate this. When the programm is run, it will throw a RuntimeException, although the variable "evilX" is never actually used, strictness requires that all argu

Learning Haskell, functional music

As you might have realized, I started to learn Haskell. One of the most fun things to do in any programming language is creating some kind of audible side effects with a program. Already back in the days when I started programming, I always played around with audio when toying around with a new language. I have found a wonderful set of lecture slides about haskell and multimedia programming, called school of expression. Inspired by the slides about functional music I implemented a little song. Ahh ... and yes it is intended to sound slightly strange . I used the synthesis toolkit to transform the music to real noise, simply by piping skini message to std-out. I used this command line to achieve the results audible in the table: sven@hhi1214a:~/Mukke$ ghc -o test1 test1.hs && ./test1 | stk-demo Plucked -n 16 -or -ip Sound samples: Plucked play Clarinet play Whistle(attention very crazy!) play As always the source... stueck = anfang :+: mitte :+: ende anfang = groovy :+: (Trans

Erlang mock - erlymock

NOTE THIS POST IS OUTDATED! The project has evolved and can be found here: ErlyMock Some features Easy to use Design based on easymock Works together with otp: can be used even if the clut is called from another process, by invoking mock:verify_after_last_call(Mock,optional: timeout) custom return functions predefined return functions for returning values, receiving message, throwing exceptions, etc.. erlymock automatically purges all modules that were mocked, after verify() Custom argument matchers: %% Orderchecking types: in_order, out_of_order, stub; %% Answering: {return, ...}|{error, ...}|{throw, ...}|{exit, ...}|{rec_msg, Pid}|{function, Fun(Args) -> RetVal} expect(Mock, Type, Module, Function, Arguments, Answer = {AT, _}) when AT==return;AT==error;AT==throw;AT==exit;AT==rec_msg;AT==function -> call(Mock, {expect, Type, Module, Function, length(Arguments), {Arguments, Answer}}). %% this version of expect is suited for useing custom argument matchers expect(Mock, Type,