Archive for the ‘Eclipse’ Category
Installing Haskell plugin for Eclipse
I use Eclipse for all sorts of development in C, Java and Haskell. It gives me uniform look and feel on every project. This is updated post with instructions for installing Haskell plugin for Eclipse.
This time I am installing on Windows XP (and Ubuntu 9.10 after) machine.
Windows XP
We need the following software installed (and versions i am installing):
- Eclipse (3.5.1) +Java (1.6)
- GHC (6.10)+Cabal
- EclipseFP plugin (1.108.0)
- Scion IDE library
Ubuntu 9.10
I have no success to run Wink on Ubuntu 9.10 (it seems to work on 8.10) so no screencast just instructions for now.
GHC
- First if you don’t have GHC installed install it “sudo apt-get install ghc”. There is still no GHC 6.10 version for Ubuntu so i am installing it manually.
- go to “http://haskell.org/ghc/” Binary Packages->Linux (x86)
- get “ghc-6.10.4-i386-unknown-linux-n.tar.bz2″
- “tar jxvf ghc-6.10.4-i386-unknown-linux-n.tar.bz2″
- “cd ghc-6.10.4/”
- “./configure –prefix=/home/ross/ghc” – here i put installation in custom location in my HOME directory. If you want this to be installed on standard location skip “–prefix” and run as “sudo”. Also skip next steps.
- make install
- Now extend PATH environment variable to this custom location. “vi ~/.bashrc” add “PATH=$PATH:/home/ross/ghc/bin” and “export PATH”
- If you want GHC 6.8 just skip previous steps and “sudo apt-get install ghc”
Cabal
- get Cabal “http://www.haskell.org/cabal/download.html” “cabal-install-0.6.2.tar.gz”
- “tar zxvf cabal-install-0.6.2.tar.gz” – extract archive
- “cd cabal-install-0.6.2/”
- “./bootstrap.sh” – here installation stops with some missing library like “/usr/bin/ld: cannot find -lgmp”. The reason is that you need not only library (in this case Multiprecision Arithmetic Library) but also development version of it. Install development version “sudo apt-get install libgmp3-dev” and run “./bootstrap.sh” again. If all dependencies are resolved “cabal” is installed in you HOME directory for example “/home/ross/.cabal/config”.
- Run cabal to update and to install Scion “~/.cabal/bin/cabal update” “~/.cabal/bin/cabal install scion”. There are some warnings during the installation. Lets hope they aren’t important ones.
Eclipse
- Install eclipse if not already installed “sudo apt-get install eclipse”
- Run and choose “workspace” location.
- Go to “Help->install new software”
- “add” and enter name “GHC 6.10″ and location “http://eclipsefp.sf.net/updates”
- Expand list of plugins and select new version of the plugin “1.108.0″ (this version uses Scion). Install it.
- go to “Window->Preferences->Haskell->Haskell Implementations”. Add name “GHC 6.10″ and executable folder “/home/ross/ghc/bin”. In this case my custom installation location.
- Go to Scion section “autodetect”. It detects the scion server at “/home/ross/.cabal/bin/scion-server”. “apply” options.
- Change default Java to “Haskell” perspective at the right top corner of Eclipse. “click->other..->Haskell”
Haskell programming
Now lets create simple Haskell project to test the installation.
- “file->new->Project->Haskell Project”
- project name “Hello”
- Expand created project and right click on “src” directory “new->haskell module”. Source folder is set to “/Hello/src”. Enter module name “Main”.
- in “Main.hs” file enter “module Main where” next “mian = putStrLn “Hello World!”. Save and click on green button “Run As->Run GHCi session”. Next time you run it there should be “Main” item in “Run” button list.
- Type “main” in console tab. Now you should see “Hello World!” written to console.

Enjoy happy programming.
How to set CUDA in Eclipse
Here I describe steps to get Eclipse working with CUDA. I am working on Ubuntu 8.04 and Eclipse: 3.2.2.
- Install latest CUDA – www.nvidia.com/cuda
- Install Eclipse if not already installed - www.eclipse.org
- set all necessary paths in /etc/ld.conf and execute ldconfig as root (sudo) during the CUDA installation.
- In Eclipse to enable code highlighting: Window -> Preferences -> in C/C++ -> File Types -> New -> enter “*.cu” and select “C++ Source File”
- Make a copy of NVidia’s template project and set this project in eclipse
- cd NVIDIA_CUDA_SDK/projects/
- cp -r template/ my project/
- New -> C++ Project ->
- uncheck “Use default location” and set project name
- next, on Make builder tab removed “all” target.
- after the project creation right click on project and open properties menu and in “Include paths and symbols” add external include path /usr/local/cuda/bin
- To set up Eclipse to run it:
Run -> Run Configurations -> select “C/C++ Local Application” -> “New launch configuration” (click the leftmost icon on the top)- set name
- set project
- set path to binary e.g /…./bin/linux/release/name
- Edit Makefile to reflect the name of executable and other names.
