July 3, 2012

Installing Haskell ThreadScope on Ubuntu 12.04 precise

ThreadScope is a tool for performance profiling of parallel Haskell programs.

When I tried to install ThreadScope on Ubuntu 12.04 I ran into some problems. The following are the steps that allowed me to complete the installation.

Note that the haskell-platform package is already installed on the system.

First install the required GTK libraries.

sudo apt-get install libgtk2.0-dev libpango1.0-dev
sudo apt-get install libglib2.0-dev libcairo2-dev

Next install the gtk2hs-buildtools Haskell package.

sudo cabal update
sudo cabal install gtk2hs-buildtools

The following steps require running the gtk2hs tools. Although the ~/.cabal/bin directory is specified in my PATH variable, the setup process fails with the following message:

Cannot find gtk2hsC2hs Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin).

You can fix this error by creating links to the gtk2hs tools in the /usr/bin directory.

sudo ln ~/.cabal/bin/gtk2hsC2hs /usr/bin/gtk2hsC2hs
sudo ln ~/.cabal/bin/gtk2hsHookGenerator /usr/bin/gtk2hsHookGenerator
sudo ln ~/.cabal/bin/gtk2hsTypeGen /usr/bin/gtk2hsTypeGen

Once the links are created you can install the other required packages.

sudo cabal install gtk
sudo cabal install cairo

Finally you can install the threadscope package.

sudo cabal install threadscope

June 30, 2012

Installing the Boost Libraries 1.50 on Ubuntu 12.04 precise

The version 1.50 of the Boost Libraries has been released . Following are the instructions to install a private copy of the Boost Libraries, including ICU support, on Ubuntu 12.04 (precise).

Setup

I have chosen to download the source packages in ~/Software, and to install in ~/usr but you can also use any other directories.

Make the required directories.

mkdir ~/Software
mkdir ~/Software/Boost
mkdir ~/Software/ICU
mkdir ~/usr

Requirements

Check the required packages.

sudo apt-get install build-essential
sudo apt-get install g++
sudo apt-get install python-dev
sudo apt-get install libzip-dev
sudo apt-get install libbz2-dev

Download and install the ICU Libraries

We will install a private version of the ICU Libraries, I have chosen the ~/usr directory for the installation but can be any other.

Download and decompress the ICU Libraries source package.

cd ~/Software/ICU
wget http://download.icu-project.org/files/icu4c/49.1.2/icu4c-49_1_2-src.tgz

tar -xvf icu4c-49_1_2-src.tgz

Configure, build and install the ICU Libraries.

cd icu/source
./runConfigureICU Linux --prefix=${HOME}/usr --enable-static
make
make install

Download the Boost Libraries

Download and decompress the Boost Libraries source package.

cd ~/Software/Boost
wget -O boost_1_50_0.tar.bz2 http://sourceforge.net/projects/boost/files/boost/1.50.0/boost_1_50_0.tar.bz2/download

tar -xvf boost_1_50_0.tar.bz2

Configure the Boost Libraries

Declare the ICU_PATH environment variable.

export ICU_PATH=${HOME}/usr

Configure the Boost Libraries build system.

cd boost_1_50_0
./bootstrap.sh

Edit the generated project-config.jam file.

gedit project-config.jam

Make the required changes to the project-config.jam file. I have highlighted the required changes, note that you have to substitute the directory /home/your-user-name with your real home directory path.

# Boost.Build Configuration
# Automatically generated by bootstrap.sh

import option ;
import feature ;

# Compiler configuration. This definition will be used unless
# you already have defined some toolsets in your user-config.jam
# file.
if ! gcc in [ feature.values <toolset> ]
{
using gcc ;
}

project : default-build <toolset> gcc ;

# Python configuration
using python : 2.7 : /usr ;

path-constant ICU_PATH : /home/your-user-name/usr ;

# List of --with-<library> and --without-<library>
# options. If left empty, all libraries will be built.
# Options specified on the command line completely
# override this variable.
libraries = /home/your-user-name/usr ;

# These settings are equivivalent to corresponding command-line
# options.
option.set prefix : /home/your-user-name/usr ;
option.set exec-prefix : /home/your-user-name/usr ;
option.set libdir : /home/your-user-name/usr/lib ;
option.set includedir : /home/your-user-name/usr/include ;

# Stop on first error
option.set keep-going : false ;

Save the file and exit the editor.

Build and install Boost Libraries

Build the Boost Libraries.

./b2

Alternatively you can build the Boost Libraries enabling the C++11 compiler support.

./b2 toolset=gcc cxxflags=-std=c++0x

The build process takes a while, once it is complete you can install the private version of the Boost Libraries.

./b2 install

Installing Subversion 1.7 on Ubuntu 12.04 precise

Subversion 1.7 comes with many new features and improvements over earlier versions. A key feature introduced in Subversion 1.7 is the centralization of the working copy metadata storage into a single location. Instead of a .svn directory in every directory in the working copy, Subversion 1.7 working copies have just one .svn directory in the root.

If you are working with Ubuntu 12.04, the default Subversion package contains Subversion 1.6. Fortunately Dominik Stadler has published a Subversion 1.7 package for Ubuntu 12.04 (precise).

Following are the instructions to install Subversion 1.7 on Ubuntu 12.04 (precise).

Requirements

First install some required dependencies:

sudo apt-get install python-software-properties

Install Subversion 1.7

Install Subversion 1.7 from Dominik Stadler PPA.

sudo apt-add-repository ppa:dominik-stadler/subversion-1.7
sudo apt-get update
sudo apt-get install subversion

Fix the SSL handshake error

The libneon27 library, that Subversion 1.7 uses, needs to be updated, otherwise you will receive the following error when accessing a server via https:

SSL handshake failed: SSL error: Key usage violation in certificate has been detected

Following are the instructions to install the updated libneon27 library on Ubuntu 12.04 (precise).

Remove the libneon27 library from your system (if it is installed):

sudo apt-get remove libneon27

Install libssl 0.9.8:

sudo apt-get install libssl0.9.8

Download and install an updated version of the libneon27 library (0.29.3-3).

If you are running Ubuntu 64 bits:

cd ~/Downloads
wget http://ftp.debian.org/debian/pool/main/n/neon27/libneon27_0.29.3-3_amd64.deb
sudo dpkg -i libneon27_0.29.3-3_amd64.deb

If you are running Ubuntu 32 bits:

cd ~/Downloads
wget http://ftp.debian.org/debian/pool/main/n/neon27/libneon27_0.29.3-3_i386.deb
sudo dpkg -i libneon27_0.29.3-3_i386.deb

Now we will create a bash alias to preload the right libneon version when invoking the svn command. Edit your .bashrc file:

nano ~/.bashrc

Add the following alias at the end of the file:

alias svn='LD_PRELOAD=/usr/lib/libneon.so.27 svn'

Save the .bashrc file and finally reload the .bashrc file:

source ~/.bashrc

Now you can test and use Subversion 1.7.

February 13, 2012

Building the text-icu Haskell package on MacOSX

Following are the instructions to compile the text-icu Haskell package on MacOSX (tested on MacOSX 10.7).

In order to compile the text-icu Haskell package we need to have the ICU libraries installed on the system.

We will use the MacPorts package manager to install the ICU libraries and header files.

If you don't have the MacPorts package manager installed on your system you should download and install it.

We update the port packages database and then we install the icu package. This step will install the required libraries and header files.

sudo port selfupdate

sudo port install icu

Finally, we update the cabal packages databases and we install the text-icu package specifying the locations of the include and lib directories.

sudo cabal update

sudo cabal install text-icu --extra-include-dirs=/opt/local/include --extra-lib-dirs=/opt/local/lib