- Home
- Learn Linux
- Learn Electronics
- Raspberry Pi
- Programming
- Projects
- LPI certification
- News & Reviews
16 June 2006
Compiling a program from source is something that causes problems for new Linux users. Here is a run through of installing an application that I have put on the Linux Questions Forum. The question was from someone having problems trying to install ktranslator, an application that sits in the taskbar, and allows you to enter a word in one language and have it translated to another. It also works as a general dictionary tool.
The first question is do you need to compile this program? Many programs will be available as easy installable packages. If you have an rpm based distribution, such as: RedHat; Fedora; Mandriva or SuSe, then you can download and install rpm files from: RPM Find. If you have a Debian Package Management distribution, such as: Debian or Ubuntu, then you can often find the program you want using the Synaptic Package Manager, or apt-get.
In this case this is an early version of the software, and so is not yet available in the package formats. So we need to compile from source.
These are the steps to install the program.
Download the source code from: http://ktranslator.sourceforge.net/download.html
The file is compressed with bzip2, so we need to uncompress the file
bzip2 -d ktranslator-0.4.tar.bz2
This will remove the .bz2 extension and result in an uncompressed file.
The files are still contained in a tar file, which puts all the individual files into a single file to make it eaiser to manage.
Extract the files from the single tar file
tar -xvf ktranslator-0.4.tar
The above two steps are the equivelant of unzipping a file in Windows.
The tar file extracts to a directory called ktranslator-0.4 so go into that directory
cd ktranslator-0.4
Configure - gets info about your system ready to compile
./configure
If the above step failed then it may be that you don't have either the compiler or the required libraries. It worked fine on my system, but you may need to install the QT development libraries first.
Now compile it
make
Now install it into the system. So far the commands can be run using a normal user. To install into the system directories the next step needs to be run with root privileges. I have used sudo to run this with root permissions, alternatively run the make install as root
sudo make install
The program is now compiled and installed.
Now it's installed - run the program
The & runs it in the background so that it frees up your terminal
ktranslator &
You will need to add a dictionary from http://ktranslator.sourceforge.net/dictionaries.html. These will need to be uncompressed and unzipped first
If the file ends in .gz then
gunzip filename
tar -xvf filename (without the .gz bit)
or bz2
bzip2 -d filename
tar -xvf filename (without the .bz2 bit)
During some of the steps you may get a lot of information shown on the screen. Normally this can be ignored, but it can give a useful insight into what is going wrong if there are any problems. Normally the last few lines show where the problem is.
We've now gone through all the steps of compiling and installing a program from source code. Perhaps not so scary as it first sounds!