SSE3044: Operating Systems (Fall 2012)
Building GCC 4.1.2 on Ubuntu 12.04.1 LTS
September 1, 2012
Computer Systems Laboratory
Our projects based on the Pintos operating system require gcc version 4.1.2. Unfortunately, only gcc versions from 4.4 to 4.6 are available on the latest Ubuntu platform (12.04.1 LTS as of this writing), with the default C compiler being gcc version 4.6.3. This document shows how to build gcc version 4.1.2 on Ubuntu 12.04.1 LTS for use with Pintos. This works for both 32-bit and 64-bit versions of Ubuntu 12.04.1 LTS.
1. Get the source code of gcc version 4.1.2
The source code of gcc can be obtained from any of mirror sites listed in http://gcc.gnu.org/mirrors.html. For example, the complete release of gcc version 4.1.2 can be downloaded and untar'ed as follows:
$ cd ~/src
2. Install prerequisites
Once you untar the source code, the GCC installation manual is available in
~/src/gcc-4.1.2/INSTALL/index.html. Refer to the Prerequisites section in the manual and install any required tools.
3. Add symbolic links to header files/libraries
Add the following symbolic links. This is due to the multiarch systems support adopted in Ubuntu. Use
x86_64-linux-gnu instead of
i386-linux-gnu for 64-bit Ubuntu system.
$ cd /usr/include
4. Build gcc
$ cd ~/src/gcc-4.1.2/
The following error message may be displayed due to the incorrect version check for
It is known that this error occurs when you are using binutils version 2.18 and makeinfo version 4.10 or higher.
WARNING: `makeinfo' is missing on your system. You should only need it
If you encounter this error while building gcc, use the following command instead of
$ make bootstrap.
$ make bootstrap MAKEINFO=makeinfo
5. Install gcc
"make install" will install files in /usr/local/*. Make sure the /usr/local/bin directory is included in the PATH.
$ sudo make install$ ls -l /usr/local/bin
i686-pc-linux-gnu-gcc-4.1.2 i686-pc-linux-gnu-sse-gcc sse-g++ sse-gcov i686-pc-linux-gnu-sse-c++ sse-c++ sse-gcc i686-pc-linux-gnu-sse-g++ sse-cpp sse-gccbug