Thursday, November 3, 2011

Haskell Plaform from source

The Haskell Platform source file
haskell-platform-2011.2.0.1.tar.gz
is downloaded to <username>/Software and extracted to
<username>/Software/haskell-platform-2011.2.0.1

I am going to install the Haskell Platform to
/opt/haskell-platform-2011.2.0.1

[prompt]:~/Software/haskell-platform-2011.2.0.1$ sudo ./configure --prefix=/opt/haskell-platform-2011.2.0.1
**************************************************
*
*     Haskell Platform Source Installer
*
*     For the Haskell Platform 2011.2.0.1 and GHC 7.0.3
*
**************************************************
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for ghc... notfound
configure: error:
  This installer for the Haskell Platform requires ghc to be installed first
  If ghc is installed not on the PATH then use --with-ghc= and --with-ghc-pkg=

[prompt]:~/Software/haskell-platform-2011.2.0.1$ sudo ./configure --prefix=/opt/haskell-platform-2011.2.0.1 --with-ghc=/opt/haskell-platform-2011.2.0.1/bin/ghc --with-ghc-pkg=/opt/haskell-platform-2011.2.0.1/bin/ghc-pkg

*** *** ***
checking for hsc2hs... notfound
configure: error: The hsc2hs program could not be found.
  It is usually installed along with ghc. You may need to specify --with-hsc2hs=

[prompt]:~/Software/haskell-platform-2011.2.0.1$ sudo ./configure --prefix=/opt/haskell-platform-2011.2.0.1 --with-ghc=/opt/haskell-platform-2011.2.0.1/bin/ghc --with-ghc-pkg=/opt/haskell-platform-2011.2.0.1/bin/ghc-pkg --with-hsc2hs=/opt/haskell-platform-2011.2.0.1/bin/hsc2hs

*** *** ***
configure: error: Your installation of ghc does not appear to work.
  It cannot compile a simple program (see config.log for the details).
  If you installed ghc from a generic binary tarball then it is worth
  checking that you have the 'gmp' C library and header files installed.
  (On Debian-based systems this package is called libgmp3-dev.)

*** libgmp3-dev is installed ***

[prompt]:~/Software/haskell-platform-2011.2.0.1$ sudo ./configure --prefix=/opt/haskell-platform-2011.2.0.1 --with-ghc=/opt/haskell-platform-2011.2.0.1/bin/ghc --with-ghc-pkg=/opt/haskell-platform-2011.2.0.1/bin/ghc-pkg --with-hsc2hs=/opt/haskell-platform-2011.2.0.1/bin/hsc2hs

*** *** ***
checking for zlib.h... noconfigure: error: The zlib C library is required

What is zlib C?

The answer is in
http://trac.haskell.org/haskell-platform/ticket/179
You need to install the developer headers for zlib.
On Ubuntu these are: zlib1g-dev

*** zlib1g-dev is installed ***

[prompt]:~/Software/haskell-platform-2011.2.0.1$ sudo ./configure --prefix=/opt/haskell-platform-2011.2.0.1 --with-ghc=/opt/haskell-platform-2011.2.0.1/bin/ghc --with-ghc-pkg=/opt/haskell-platform-2011.2.0.1/bin/ghc-pkg --with-hsc2hs=/opt/haskell-platform-2011.2.0.1/bin/hsc2hs
**************************************************
checking GL/gl.h usability... nochecking GL/gl.h presence... no
checking for GL/gl.h... no
configure: error: The OpenGL C library is required

What is The OpenGL library?

The answer is, for example, in
http://nathanwiegand.com/blog/2009/07/haskell-platform-on-ubuntu.html
The packages
libgl1-mesa-dev
libglc-dev
freeglut3-dev
libedit-dev
libglw1-mesa libglw1-mesa-dev
are to be installed.

A number of accompanying packages is installed, too.

The following message was displayed on terminal, but I missed it:

The following packages were automatically installed and are no longer required:
  libffi-dev libbsd-dev ghc6
Use 'apt-get autoremove' to remove them.

The final try (successful):

[prompt]:~/Software/haskell-platform-2011.2.0.1$ sudo ./configure --prefix=/opt/haskell-platform-2011.2.0.1 --with-ghc=/opt/haskell-platform-2011.2.0.1/bin/ghc --with-ghc-pkg=/opt/haskell-platform-2011.2.0.1/bin/ghc-pkg --with-hsc2hs=/opt/haskell-platform-2011.2.0.1/bin/hsc2hs

*** *** ***
...
configure: creating ./config.status
config.status: creating scripts/config
**************************************************
* Configuration completed successfully.         
*                                               
*   Install prefix: /opt/haskell-platform-2011.2.0.1
*     Haskell packages will be registered into  
*     the global ghc package database           
*                                               
*   If you wish to change these settings then   
*   use --prefix= and/or --enable-user-install  
*                                               
* Now do "make" followed by "sudo make install" 
**************************************************

[prompt]:~/Software/haskell-platform-2011.2.0.1$ sudo make install
scripts/build.sh
**************************************************
Scanning system for any installed Haskell Platform components...

Found:None.

New packages to install: None! All done.

**************************************************
Building ... ... ...

The following message appeared several times:
Setup: Haddock's internal GHC version must match the configured GHC version.
The GHC version is 7.0.3 but haddock is using GHC version 6.12.1
Generating the transformers-0.2.2.0 package documentation failed

Preprocessing library haskell-platform-2011.2.0.1...
Building haskell-platform-2011.2.0.1...
Registering haskell-platform-2011.2.0.1...
"./Setup" "register" "--inplace"
Registering haskell-platform-2011.2.0.1...

**************************************************
* Building Haskell Platform completed successfully.
*                                               
* Now do "sudo make install"                    
**************************************************
scripts/install.sh
Installing transformers-0.2.2.0...
Installing library in
/opt/haskell-platform-2011.2.0.1/lib/transformers-0.2.2.0/ghc-7.0.3
Creating package registration file: transformers-0.2.2.0.conf

...

*******************************************************
* Installation completed successfully.          
*
* Programs installed into:                      
*   /opt/haskell-platform-2011.2.0.1/bin
*
* Now do "cabal update" to initialize the package list                        
*
* Additional packages may be found at http://hackage.haskell.org
* or via "cabal list <pattern>"
*
* Use "cabal install <foo>" to install additional packages
*
*******************************************************

[prompt]:~/Software/haskell-platform-2011.2.0.1$ cabal update
Config file path source is default config file.
Config file /home/zigmas/.cabal/config not found.
Writing default configuration to /home/zigmas/.cabal/config
Downloading the latest package list from hackage.haskell.org

Testing if it works:

[prompt]:~/Software/haskell-platform-2011.2.0.1$ ghc --helpUsage:

    ghc [command-line-options-and-input-files]

... ... ...

------------------------------------------------------------------------
[prompt]:~/Software/haskell-platform-2011.2.0.1$ ghci
GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> 5+7
12
Prelude> :quit
Leaving GHCi.

[prompt]:~/Software/haskell-platform-2011.2.0.1$ ghci-7.0.3
GHCi, version 7.0.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :quit
Leaving GHCi.

[prompt]:~/Software/haskell-platform-2011.2.0.1$ cabal install hoogle
Resolving dependencies...
Downloading binary-0.5.0.2...
Configuring binary-0.5.0.2...
Preprocessing library binary-0.5.0.2...
Building binary-0.5.0.2...
Linking dist/build/hoogle/hoogle ...

Installing library in /home/zigmas/.cabal/lib/hoogle-4.2.7/ghc-6.12.1
Installing executable(s) in /home/zigmas/.cabal/bin
Registering hoogle-4.2.7...

[prompt]:~/Software/haskell-platform-2011.2.0.1$ cabal --versioncabal-install version 0.10.2
using version 1.10.1.0 of the Cabal library

[prompt]:~/Software/haskell-platform-2011.2.0.1$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.1

I remembered that apt-get autoremove should be done, and did it.
After that:

[prompt]:~$ ghci
GHCi, version 7.0.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude>

No comments:

Post a Comment