In some cases, it may be necessary to compile additional software for your Linux automation system. This article will guide you through the steps to setup your “build environment”. No specific packages will be discussed in this article but I will use this article to link back to in my future guides. The guide requires a Linux environment of some sort that you can work from. This guide is written for Debian based distros (Ubuntu, Debian, Mepis, Knoppix, etc) but may include others in the future. Because compiling is done from the command-line, most everything in the text will be done there as well.
First thing we need to do is pull down a basic tool chain. This is a bunch of different programs/scripts that are in used in the compiling process. Open a terminal (Applications -> Accessories -> Terminal) and type the following commands.
sudo apt-get install build-essential
NOTE: Depending on when “sudo” was last run, it will ask you for your password. This is normal. “Sudo” allows us to run commands with root level privileges.
Unfortunately, this package pulls down a newer version of GCC (Gnu Compiler Collection) than what we need. (On my Ubuntu 8.04 system I get GCC version 4.2) In Deployment Solution 6.9, the Linux automation image uses GCC version 4.1 for the kernel and GCC version 3.4 for userspace applications (A.K.A everything else that’s not the kernel). To install our older version, run the following command.
sudo apt-get install gcc-3.4 g++-3.4
Changing between the multiple versions of GCC is simple. The actual file “gcc” is a symbolic link to another file like “gcc-4.2”. (Think of a symbolic link as a shortcut in Windows) In this case, our system is setup to use GCC version 4.2. If we would like to change it to version 3.4, we would run the following commands.
cd /usr/bin
sudo ln –sf gcc-3.4 gcc
sudo ln –sf g++-3.4 g++
Then to go back, we would run the same commands except we substitute “3.4” with “4.2”. At any time you can check which version you are running by running the command:
gcc -–version
And
g++ --version
Set the GCC version to 3.4 and you’re ready to start building software. As stated before, this article does not cover any specific packages and should only be used in preparation to build a package. As stated, I will be using this article as a reference for my future articles which will be package specific. Generally though, the method to compile a piece of software is this process.
- Download the source archive and extract it.
- Change your directory to that folder and run “./configure” without quotes.
- When that finishes successfully, run the command “make” to do the actual compile.
Most source code archives contain a file on how to build and install their package. This file is usually called “INSTALL”. Stay tuned for more articles on customizing the Linux Automation image. I’m expecting to write articles on reading/writing Dell asset and property tags, full read/write support for NTFS without the “firm” program, and various other customizations.