环境:Ubuntu 10.10;gcc 4.4.5;
体系结构实验需要用到。装起来有够麻烦的。主要是东西都太老了,需要用到的交叉编译器gcc的版本都是2.7.2啊,SimpleScalar上写的居然是"newer version"(相对与自带的2.6版本的)。基本上每次make都是一个错。照着老师的指导书一步步装还是有错误,要不就是我那一步出现了错误。费了九牛二虎之力才装好。最后靠的是国外大学的资源来安装的,网站上有一个安装脚本,在我的Ubuntu10.10上成功执行。
先把网址晒一下:http://www.ann.ece.ufl.edu/courses/eel5764_10fal/project/
貌似是佛罗里达大学一位助理教授授课时用到的资料,里面有一些安装SimpleScalar和一个安装的脚本buildSS。安装说明基本跟我的实验指导书上的差不多,最受用的还是那个安装脚本。多谢这位老师啊!
直接贴上脚本代码以备后用:
NAME=Simplescalar
PACKAGE=simplescalar
TOOL=simpletools-2v0
UTIL=simpleutils
SIM=simplesim
# Update Ubuntu Software Package
sudo apt-get update
# Getting required applications
sudo apt-get install flex-old bison build-essential
# Create Simplescalar Directory
cd
mkdir $NAME
cd $NAME
# Getting simplescalar tar file
wget http://csrl.unt.edu/downloads/$PACKAGE.tgz
# Extraction
tar xvfz $PACKAGE.tgz
export CC="gcc"
# Setting up installation
export HOST=i686-unknown-linux
export TARGET=sslittle-na-sstrix
export IDIR=~/$NAME
# Build Simplescalar tools
cd ~/$NAME
tar xvfz $TOOL.tgz
rm -rf gcc-2.6.3
# Build Simplescalar utils
cd ~/$NAME
tar xvfz $UTIL-990811.tar.gz
cd $UTIL-990811
./configure --host=$HOST --target=$TARGET --with-gnu-as --with-gnu-ld --prefix=$IDIR
make CC=gcc
sudo make install CC=gcc
# Build Simplescalar
cd ~/$NAME
tar xvfz $SIM-3v0d.tgz
cd $SIM-3.0
make config-pisa
make CC=gcc
# Build Compiler
cd ~/$NAME
tar xvfz gcc-2.7.2.3.ss.tar.gz
cd ~/$NAME/gcc-2.7.2.3
export PATH=$PATH:$IDIR/simpleutils-990811/sslittle-na-sstrix/bin
./configure --host=$HOST --target=$TARGET --with-gnu-as --with-gnu-ld --prefix=$IDIR
# Fix file errors
make LANGUAGES="c c++" CFLASS=-O3 CC="gcc"
sed -i 's/return "FIXME\n/return "FIXME\n\/g' ~/$NAME/gcc-2.7.2.3/insn-output.c
make LANGUAGES="c c++" CFLASS=-O3 CC="gcc"
wget http://www.ict.kth.se/courses/IS2202/ar
wget http://www.ict.kth.se/courses/IS2202/ranlib
chmod 700 ar
chmod 700 ranlib
sudo cp ar $IDIR/sslittle-na-sstrix/bin/ar
sudo cp ranlib $IDIR/sslittle-na-sstrix/bin/ranlib
rm ar
rm ranlib
chmod +w ~/$NAME/gcc-2.7.2.3/obstack.h
sed -i 's/next_free)++/next_free++)/g' ~/$NAME/gcc-2.7.2.3/obstack.h
make LANGUAGES="c c++" CFLASS=-O3 CC="gcc"
sed -i '98i
#define BITS_PER_UNIT 8
' ~/$NAME/gcc-2.7.2.3/libgcc2.c
#make LANGUAGES="c c++" CFLASS=-O3 CC="gcc"
cp $IDIR/gcc-2.7.2.3/patched/sys/cdefs.h $IDIR/sslittle-na-sstrix/include/sys/cdefs.h
make LANGUAGES="c c++" CFLASS=-O3 CC="gcc"
make enquire CC=gcc
sudo make install LANGUAGES="c c++" CFLASS=-O3 CC="gcc" PATH=$PATH:~/$NAME/bin
# Done!
exit 0
一旦已经下载了所需要的tar包,可以把
wget http://csrl.unt.edu/downloads/$PACKAGE.tgz
这一行去掉。也可以直接下载,就是速度可能有点慢。这个包里面已经包含了所有需要的工具。使用simscalar-cheetath相应该一下脚本即可。