转自:http://blog.sina.com.cn/s/blog_548b0a230101cagk.html
GEM5在ubuntu13.10下安装过程,首先下载gem5_stable最新安装包,解压。文件夹重命名为gem5_stable
强烈建议安装前仔细阅读http://www.m5sim.org/Compiling_M5,上面有安装需要的软件版本。
1、安装Python
因为SCons是用Python编写的,所以你必须在使用SCons之前安装好Python。你在安装Python之前,应该注意查看Python是否在你的系统里已经可用了(在系统的命令行中运行python -V或python --version)。
$python -V
Python 2.7.5+
2、安装scons
在联网的情况下,直接输入命令sudo apt-get install scons
安装完成后输入scons -v
SCons by Steven Knight et al.:
script: v2.3.0, 2013/03/03 09:48:35, by garyo on reepicheep
engine: v2.3.0, 2013/03/03 09:48:35, by garyo on reepicheep
engine path: ['/usr/lib/scons/SCons']
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
3、安装g++
sudo apt-get install g++
4、安装swig(GEM5网站上,明确说明了
swig2.0.9,swig2.0.10两个版本对GEM5有bug)
下载swig2.0.7安装包,不要输入命令sudo apt-get install swig否则gem5编译后,运行hello时会报错
我安装的swig2.0.7
./configure --without-pcre
make
sudo make install
可以用swig -version 查看swig版本
5、安装python-dev
在联网的情况下,直接输入命令sudo apt-get install python-dev
6、安装zlib
zlib:最近的版本。http://www.zlib.net/
解压下载的压缩包:
tar -xzvf zlib-1.2.8.tar.gz
解压之后的文件夹 zlib-1.2.8放到gem5_stable目录下
cd zlib-1.2.8
执行命令:
./configure
sudo make install
7、安装M4
m4:宏处理器。http://www.gnu.org/software/m4/
解压下载的压缩包:
tar -xzvf m4-1.4.17.tar.gz
解压之后的文件夹 m4-1.4.17放到gem5_stable目录下
cd m4-1.4.17
执行命令:
./configure
sudo make install
8、安装protobuf
https://code.google.com/p/protobuf/ 我安装的2.5版本
./configure
make
make check
sudo make install(需要root权限)
9、安装libprotobuf-dev
sudo apt-get install libprotobuf-dev
10、安装libgoogle-perftools-dev
sudo apt-get install libgoogle-perftools-dev
10、编译gem5:
cd gem5-stable
mkdir build
scons build/X86/gem5.opt
如果出现如下错误:
错误:can't find Python.h header in ['/usr/include/python2.7']
解决:sudo apt-get install python-dev
测试
在gem5目录下输入命令
./build/X86/gem5.opt ./configs/example/se.py -c tests/test-progs/hello/bin/x86/linux/hello
gem5 Simulator System. http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.
gem5 compiled Nov 22 2013 21:02:57
gem5 started Nov 22 2013 21:06:19
gem5 executing on ubuntu
command line: ./build/ALPHA/gem5.opt ./configs/example/se.py -c tests/test-progs/hello/bin/alpha/linux/hello
/home/hu/gem5-stable/configs/common/CacheConfig.py:48: SyntaxWarning: import * only allowed at module level
def config_cache(options, system):
Global frequency set at 1000000000000 ticks per second
warn: CoherentBus system.membus has no snooping ports attached!
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
**** REAL SIMULATION ****
info: Entering event queue @ 0. Starting simulation...
info: Increasing stack size by one page.
Hello world!
hack: be nice to actually delete the event here
Exiting @ tick 3233000 because target called exit()
安装成功!
*********************
如果protobuf有错误,可以移除以前的版本
sudo apt-get autoremove libprotobuf-dev