Wednesday, January 6, 2010

Install eclipse-cdt on Debian

I first tried the obvious approach of "apt-get install eclipse-cdt", that installed a whole lot of packages, but the version of eclipse that I ended up with wouldn't run properly so I tried installing it using the download from www.eclipse.org. That version seems to need Sun's Java 6 runtime, so you also need to install that.
Here is how I got eclipse-cdt going in Debian:
(Note: Much of this needs to be done as root...)

1. Install Sun java 6.
- Edit /etc/apt/sources.list and add 'non-free' to the end of each line, e.g.
deb http://ftp.nz.debian.org/debian lenny main non-free
- apt-get update
- apt-get install sun-java6-jre
- update-java-alternatives -s java-6-sun

2. Download eclipse from http://www.eclipse.org/downloads/ (Eclipse IDE for C/C++ Developers)

3. Install eclipse (thanks to http://flurdy.com/docs/eclipse/install.html )

- Copy the eclipse tar.gz file to /opt
e.g. cp eclipse-cpp-galileo-SR1-linux-gtk.tar.gz /opt/
- Untar it
cd /opt
tar xzvf eclipse-cpp-galileo-SR1-linux-gtk.tar.gz
- Set up permissions
chown -R root:root eclipse
chmod -R +r eclipse
chmod +x `find eclipse -type d`
-
Create an eclipse executable in your path
touch /usr/bin/eclipse
chmod 755 /usr/bin/eclipse
nano /usr/bin/eclipse
Type this into /usr/bin/eclipse -
#!/bin/sh
export ECLIPSE_HOME="/opt/eclipse"
$ECLIPSE_HOME/eclipse $*

4. Run eclipse.
Change to your work directory and run
eclipse -clean