主机为ubuntu15.10,64位系统安装gem5-817bed25c1a8(http://www.m5sim.org/Download)版本
安装gem5前首先要预装一些软件,如下:
1.gcc
2.python
3.SCons
4.SWIG
5.Zlib
6.m4
7.protobuf
各预装软件解决方法及版本(所有软件安装之前检测是否安装,检测方法: whereis+名字):
1.gcc: 版本5.2.1,系统自带
2.python 版本2.7.10,系统自带
3.Scons版本2.3.6:sudo apt-get install scons
4..SWIG:两种解决办法
a. sudo apt-get install swig,但是可能版本不兼容(我升级到了2.0.12),需要的版本为3.0及以上版本。
问题描述:
Warning:This combination of gcc and swig have knownincompatibilities. If you encounter build problems, please update swig to 3.0or later.
b.下载安装包http://www.swig.org/,安装教程:http://www.linuxdiyf.com/linux/17128.html
5. zlib: whereis zlib,假如本机没有自带的话,需要自己安装,安装方法:安装包安装,教程http://topcat.iteye.com/blog/403277)版本:1.2.8
6. m4: sudoapt-get install m4,版本1.4.17
7. protobuf: 安装包安装,安装版本,2.6.1
产生错误:protoc: error while loading shared libraries: libprotoc.so.9:connotopen shared object file: No such file or directory.
解决办法:exportLD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib. 但是只是临时解决办法。证明:该错误产生的原因是需要添加环境变量
Sudo vim/etc/profile(设置该用户的环境变量)。如果在全局/root/.bashrc中设环境变量,容易开不开机
1.export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
2.export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib // 是protobuf默认的安装路径
3.export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/root/gem5/protobuf-2.6.1 // 是protobuf的解压缩路径
环境变量设置好之后重启电脑。Protoc –version :libprotoc 2.6.1
提示:安装软件sudoapt-get install libgoogle-perftools-dev 可以提速百分之12
开始编译:
Scons build/ARM/gem5.opt
Warning:This combination of gcc and swig have knownincompatibilities. If you encounter build problems, please update swig to 3.0or later.
Checking for C header file Python.h…no
Error:can’t find Python.h header in []
Install Python header(package python-dev on Ubuntu and RedHat)
第一个问题已经解决了,
第二个问题解决办法:sudoapt-get install python-dev
编译40分钟左右,编译是单核编译,大概40分钟左右。
安装完成!
测试语句:./build/ARM/gem5.opt ./configs/example/se.py -c ./tests/test-progs/hello/bin/arm/linux/hello 输出结果:helloworld!
编译语句要静态编译:arm-linux-gnueabi-gcc–-static file.c –o file
完成!
Ubuntu12.04安装gem5/M5模拟器:http://www.linuxdiyf.com/linux/2108.html
解决gem5/M5模拟器“kernel too old”错误:http://www.linuxdiyf.com/linux/2101.html