Howto Build GEM5 from scratch
Suppose that you have a very powerful server machine some where, on which you like to run GEM5. The problem is you don’t have the “root” access to that machine and so, you can not update that system and you can not install new packages.
So, you should download and compile every thing yourself at your home folder. And then you should set environment variables so that, GEM5 can see the libraries and header files.
In this post, I put my own procedure to do this action:
(In following I have supposed that /sadri/ is your home folder)
mercurial
This one is easy. So I suppose you have installed the latest hg , you have performed the build and installation in your own local home folder and then you have updated the PATH environment variable to also point to the location of hg. e.g. /bin/hg
GCC
I use gcc.4.5.0 :
link to download gcc
ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.5.0/
And then here is a web page, nicely describing the compilation procedure for gcc. (note that you need to also download and install all of the intermediate packages, and their location should be added to your PATH and LD_LIBRARY_PATH environment variables)
http://my.opera.com/wavefancy/blog/2013/03/23/install-gcc-locally-without-root-permission
Python
We need the 2.7 version of python:
http://www.python.org/download/releases/2.7.4/
Don’t forget that when you are configuring the python you need to also tell it to create the shared libraries for you. ( ./configure –enable-shared –prefix …. )
ZLIB
I downloaded the latest , http://www.zlib.net/
Then I compiled it and I added all of the produced library files and header files to the GCC.
The point is I did this action constantly. When ever I compiled a new -dev package (like this some, which contains some header files and some compiled shared or statis libraries) I first update the PATH and LD_LIBRARY_PATH and I also copy all of the header files and libraries to the GCC folder. (the include folder and lib64 folder of GCC). I want just to make sure that the GCC sees all of these files when it is compiling GEM5.
SWIG 2.0.7
Important point : DO NOT USE SWIG 2.0.9 , it does not work at the end. (You compile GEM5 nicely, you think every thing is Ok but GEM5 will produce strange errors when you try to run it)
http://sourceforge.net/projects/swig/files/swig/swig-2.0.7/swig-2.0.7.tar.gz/download
for SWIG you need PCRE. Here is the procedure you should follow:
then copy latest pcre into root of swig source
cp ../swig-2.0.9/pcre-8.32.tar.bz2 .
then run
Tools/pcre-build.sh
then go for configure and build
./configure –prefix=/sadri/swig-2.0.7/
make
make install
PROTOBUF
This is the version of google protocol buffers I downloaded and used for GEM5
http://code.google.com/p/protobuf/downloads/detail?name=protobuf-2.4.1.tar.gz&can=2&q=
configuration and installation
./configure –prefix=/sadri/protobuf-2.4.1/
make install
Again the same as before, you should make sure that GCC sees all of the header files. so I copied the files into GCC and also I created a kind of symbolic link:
inside : /sadri/gcc-4.5.0/include/c++/4.5.0
we see this symbolic link : google -> /sadri/protobuf-2.4.1/include/google
you should make it if it is not there.
copy all of the produced library files into GCC
cp ~/protobuf-2.4.1/lib/* /sadri/gcc-4.5.0/lib64
update LD_LIBRARY_PATH
GEM5
Download it, make a backup copy for your self, and compile.
hg clone http://repo.gem5.org/gem5
cp -r gem5 gem5_backup
scons build/ARM/gem5.opt
and if you want to re-build , you can make it clean using :
scons -c build/ARM/gem5.opt
VNC Viewer
I used Real VNC
http://www.realvnc.com/download/get/1283/details/
and for example, when you want to make it connected to GEM5, you issue this command
./vncviewer -FullColour 127.0.0.1:5900
Libunwind
This is is not necessary , but while you are compiling the GEM5 it claims that if you have this guy available (gperftools) you can get 12% improvement in performance.
Since it is optional for now I skip it.
Leave a Reply