Saturday, October 18, 2008

Installing Simplescalar


Note: If you have 64-bit processor install VMware on your OS and then install Linux on that virtual machine. SimpleScalar gcc (gcc 2.6.3) gives segmentation fault on 64-bit architecture.

Ubuntu for VMware :http://www.vmware.com/appliances/directory/63860

Here is the procedure I used ..

1) on Ubuntu (or whichever Linux you use) first do--

sudo apt-get update

2) Getting required applications

sudo apt-get install flex-old bison gedit

3) Start extraction

mkdir /tmp/simplescalar
cd /tmp/simplescalar/
wget http://csrl.unt.edu/downloads/simplescalar.tgz
tar xvfz simplescalar.tgz

  4) Install gcc 3.3 (Required)
sudo apt-get install g++-3.3 gcc-3.3 
export CC="gcc-3.3"; 

 5) setting up installation
export HOST=i686-unknown-linux 
export TARGET=sslittle-na-sstrix export 
IDIR=/opt/simplescalar 

 6) Simplescalar tools
cd /tmp/simplescalar tar xvfz simpletools-2v0.tgz 
rm -rf gcc-2.6.3
 sudo mkdir -p /opt/simplescalar
sudo mv f2c-1994.09.27/ glibc-1.09/ ssbig-na-sstrix/ sslittle-na-sstrix/ /opt/simplescalar/

7) Simplescalar utils 
cd /tmp/simplescalar 
tar xvfz simpleutils-990811.tar.gz
cd /tmp/simplescalar/simpleutils-990811  
./configure --host=$HOST --target=$TARGET --with-gnu-as --with-gnu-ld --prefix=$IDIR 
make CC=gcc-3.3 
sudo make install CC=gcc-3.3

8) Simplescalar!!

cd /tmp/simplescalar 
tar xvfz simplesim-3v0d.tgz
cd simplesim-3.0 
make config-pisa
make CC=gcc-3.3

>>You will get "My work is done here" :)
cd /tmp/simplescalar sudo mv simplesim-3.0 /opt/simplescalar
  9) Now the hard part

cd /tmp/simplescalar/ tar xvfz gcc-2.7.2.3.ss.tar.gz
 cd /tmp/simplescalar/gcc-2.7.2.3 
export PATH=$PATH:$IDIR/sslittle-na-sstrix/bin
./configure --host=$HOST --target=$TARGET --with-gnu-as --with-gnu-ld --prefix=$IDIR  
make LANGUAGES="c c++" CFLAGS=-O3 CC=gcc-3.3
>>>>Error! Many errors about \ missing in insn-output.o
gedit insn-output.c 

>>>> Edit file insn-output.c and add a \ (backslash) at the end of lines 675, 750, and 823.
make LANGUAGES="c c++" CFLAGS=-O3 CC=gcc-3.3
 >> Error! about libgcc2.a
gedit Makefile
 >>Edit file Makefile and add -I/usr/include to the end of line 130.
make LANGUAGES="c c++" CFLAGS=-O3 CC=gcc-3.3
sudo cp patched/sys/cdefs.h /opt/simplescalar/sslittle-na-sstrix/include/sys/
make enquire CC=gcc-3.3
/opt/simplescalar/simplesim-3.0/sim-safe ./enquire -f > float.h-cross
sudo make install LANGUAGES="c c++" CFLAGS=-O3 CC=gcc-3.3 PATH=$PATH:/opt/simplescalar/bin

>>>>Update from Tim
>>>>I ran into an additional issue during step nine with cxxmain.c.
>>>>For some reason the code redefines malloc.

>>>>To fix, just comment out lines 2978‐2979 and the compilation should continue.
>>>>Thanks Tim


 10) Testing the installation!!!
cd /tmp/simplescalar /opt/simplescalar/bin/sslittle-na-sstrix-gcc hello.c
 /opt/simplescalar/simplesim-3.0/sim-safe a.out 

Happy simulating!!


I have referred to : -

And a lot more..

36 comments:

Parijat Shukla said...

Harry,
I am new to ubuntu and simplescalar both.
guess i am facing similar problems.
i have a intel core2 duo machine+vista.
and have Sun xVM virtual box running ubuntu 6 version.
i am following the help from webpage
http://www.seas.gwu.edu/~bhagiweb/cs211/SimpleScalar/simplescalar-ubuntu-install.txt

simpleutils was somehow installed.
But facing problem in simplesim-3.0
where 'make' command is failing.
please help me

outlog is here:
---------------------------
ubuntu@ubuntu:~/simplescalar3$ pwd
/home/ubuntu/simplescalar3
ubuntu@ubuntu:~/simplescalar3$ cd $IDIR/simplesim-3.0
ubuntu@ubuntu:~/simplescalar3/simplesim-3.0$ make config-pisa
rm -f config.h machine.h machine.c machine.def loader.c symbol.c syscall.c
ln -s target-pisa/config.h config.h
ln -s target-pisa/pisa.h machine.h
ln -s target-pisa/pisa.c machine.c
ln -s target-pisa/pisa.def machine.def
ln -s target-pisa/loader.c loader.c
ln -s target-pisa/symbol.c symbol.c
ln -s target-pisa/syscall.c syscall.c
rm -f tests
ln -s tests-pisa tests
ubuntu@ubuntu:~/simplescalar3/simplesim-3.0$ make
make: *** No rule to make target `version.h', needed by `main.o'. Stop.
ubuntu@ubuntu:~/simplescalar3/simplesim-3.0$ clear

ubuntu@ubuntu:~/simplescalar3/simplesim-3.0$ pwd
/home/ubuntu/simplescalar3/simplesim-3.0
ubuntu@ubuntu:~/simplescalar3/simplesim-3.0$ cd $IDIR/simplesim-3.0
ubuntu@ubuntu:~/simplescalar3/simplesim-3.0$ make config-pisa
rm -f config.h machine.h machine.c machine.def loader.c symbol.c syscall.c
ln -s target-pisa/config.h config.h
ln -s target-pisa/pisa.h machine.h
ln -s target-pisa/pisa.c machine.c
ln -s target-pisa/pisa.def machine.def
ln -s target-pisa/loader.c loader.c
ln -s target-pisa/symbol.c symbol.c
ln -s target-pisa/syscall.c syscall.c
rm -f tests
ln -s tests-pisa tests
ubuntu@ubuntu:~/simplescalar3/simplesim-3.0$ make
make: *** No rule to make target `version.h', needed by `main.o'. Stop.
ubuntu@ubuntu:~/simplescalar3/simplesim-3.0$
ubuntu@ubuntu:~/simplescalar3/simplesim-3.0$

---------------------------

Sylar said...

Your makefile cannot find 'version.h'. It is usually in the simplesim-3.0 folder.

Try downloading the simplesim folder again.

Some files might have got corrupted.

Every time 'make' fails do 'make clean' after that before trying again.

Best of luck..

Ashish Singhal said...

Hi..

I have downloaded VMware image of ubuntu from the location specified but I am unable to login. What are the login details?

Thanks

Sylar said...

root ID: sudo
Password: bagside

Anonymous said...

Hi Harry,

First of all, thanks for gathering all the useful info so many can be benefited from.

Regarding to the steps you have listed, I have followed it successfully until the step9 on
make enquire CC=gcc-3.3

Following is the error message complaining of not being able to find crt0.o

if [ -f libgcc2.ready ] ; then \
true; \
else \
touch libgcc2.ready; \
fi
./xgcc -B./ -DCROSS_COMPILE -DIN_GCC -g -I./include -I/usr/include enquire.o -o enquire
/opt/simlescalar/sslittle-na-sstrix/bin/ld: cannot open crt0.o: No such file or directory
make: *** [enquire] Error 1

Could you help me on it?

Thanks a lot!!

CW

Anonymous said...

Hi,

Sorry that I made a mistake along the way, Pls ingore the previous post.

My new problem happens on the very next step.

/opt/simplescalar/simplesim3.0/sim-safe ./enquire -f > float.h-cross

i can see that sim-safe is executed, but it just hanged there afterward.

any idea?

CW

Anonymous said...

cannot open crt0.o: No such file or directory
make: *** [enquire] Error 1

I have a same problem and as you said you've fixed it would you please help me about it?

Anonymous said...

Try

touch crt.o

jkndrkn said...

I share your frustration. I'm currently struggling with building gcc 2.7.X. I'm hoping that the SimpleScalar project maintainers publish a fixed-up codebase and updated documentation soon!

Tim M. said...

Thanks so much for this! One thing for others trying this...

I ran into an additional issue during step nine with cxxmain.c. For some reason the code redefines malloc.

To fix, just comment out lines 2978‐2979 and the compilation should continue.

Anonymous said...

During the make enquire step, i am getting the following error:

./xgcc -B./ -DCROSS_COMPILE -DIN_GCC -g -I./include -I/usr/include -DNO_MEM -DNO_LONG_DOUBLE_IO -O0 -I. -c ./enquire.c
In file included from /usr/include/sys/types.h:270,
from ./enquire.c:401:
/usr/include/bits/pthreadtypes.h:99: warning: unnamed struct/union that defines no instances
./xgcc -B./ -DCROSS_COMPILE -DIN_GCC -g -I./include -I/usr/include enquire.o -o enquire
enquire.o: In function `fCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
enquire.o: In function `dCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
enquire.o: In function `ldCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
make: *** [enquire] Error 1

Any suggestions/solutions are most welcome

rtcwolf said...

Hi Harry
im installing simplescalar on ubuntu 9.10 (32 bit processor)
the gcc available is 4.4.1
do i need to downgrade to gcc3.3?
thanks

Parijat Shukla said...

hi rtcwolf,
i guess yes,
although i am not working on ubuntu, but fedora10.
and faced issues while compiling a modified version of simplescalar for alpha set.
right now i have gcc3.4.3 for simplescalar.
.

deepu said...

Hi i am trying to install simplescalar in ubuntu 9.10
i have done simpleutils990811 and simplesim30 but when i run gcc 2.7.2.3 with the command make LANGUAGES="c c++" CFLAGS="-O" CC="gcc"
i get error make: *** [libgcc1.null] Error 1
can u get me some answers for it

Parijat Shukla said...

hi deepu,
hope you are correct gcc compiler for compiling simplescalar.
I mean to say that, you should not be compiling application with the compiler which comes with ubuntu, rather compile with version which is compatible for the version of simplescalar you have now.
.
I have used fedoar11 and gcc-3.4.2 version for my my work. as gcc-4.x which comes with fedora11 is not compatible with modified simplescalar I had.
you may refer to this link: if you already have this one, then religiously following all the steps shall lead be enough.
http://www.seas.gwu.edu/~bhagiweb/cs211/SimpleScalar/simplescalar-ubuntu-install.txt
.
Parijat Shukla

Parijat Shukla said...

If you find that version of current compiler is does not work for simplescalar, then you may install alternative compiler: steps are given here:
based on my experience I would say that you may need a seperate compiler for simplescalar on your machine. and that should be most likely 3.x version(again it depends on the simplescalar code you have)

http://www.mjmwired.net/resources/mjm-fedora-gcc.html

SOUAHI said...

Hi every body, I'm a new user for both ubuntu 9.10 and simplescalar, thanks for all the job you have done.

I found instructions concerning gcc and g++ 3.3 but I have 4.4 version, so I did not downgrade, I just replaced in any instruction 3.3 by 4.4 and it worked !

Until step 9, after : make LANGUAGES="c c++" CFLAGS=-O3 CC=gcc-4.4 I had no makefile, so what should I do ? thanks

Vincent said...

Hi,
I'm using 9.04 ubuntu 32 bit.
I get a RETURN error when make simplescalar w/ my gcc-4.3 inside
c-lex.c:

make LANGUAGES="c c++" CFLAGS=-O3 CC="gcc-4.3"
...
gcc-4.3 -c -DCROSS_COMPILE -DIN_GCC -O3 -I. -I. -I./config c-lex.c
In file included from c-lex.c:33:
c-parse.h:64: error: redeclaration of enumerator ‘RETURN’
rtl.def:473: error: previous definition of ‘RETURN’ was here
...
make: *** [c-lex.o] Error 1
$
Indeed, in rtl.def, RETURN is:
DEF_RTL_EXPR(RETURN, "return", "", 'x')
and in c-parse.h, RETURN is:
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
...
RETURN = 280,

Any suggestions, help? We need this for
an Architecture class.

thanks,
Vince

Harry said...

@Vincent

You have to use gcc 3.3.
Simplescalar is not compatible with gcc 4.3.

Vincent said...

Thanks,
when I try to do a
apt-get install gcc-3.3
I get a:
E: Couldn't find package gcc-3.3.

Are the gcc's archived somewhere?

Vince

Harry said...

Use Synaptic Package Manager in Ubuntu.

Otherwise you can get it here:

http://packages.ubuntu.com/dapper/gcc-3.3

Josh said...

I'm also getting this error during the enquire step. Any help would be greatly appreciated.

./xgcc -B./ -DCROSS_COMPILE -DIN_GCC -g -I./include -I/usr/include -DNO_MEM -DNO_LONG_DOUBLE_IO -O0 -I. -c ./enquire.c
In file included from /usr/include/sys/types.h:270,
from ./enquire.c:401:
/usr/include/bits/pthreadtypes.h:99: warning: unnamed struct/union that defines no instances
./xgcc -B./ -DCROSS_COMPILE -DIN_GCC -g -I./include -I/usr/include enquire.o -o enquire
enquire.o: In function `fCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
enquire.o: In function `dCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
enquire.o: In function `ldCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
make: *** [enquire] Error 1

nirajk said...

this is one of the best tutorials on simplescalar. good job, thanks a lot

Anil said...

Thanks

Anderson Venturini said...

Congrats Harry!

No doubt that this is one of the best tutorials about simplescalar that I have read. Thanks for the tips!! Everything worked pretty fine!

Thank you, again.

Anderson Venturini

pawani said...

Harry,
I also got the same error as mentioned above by two people. I am using Ubuntu10.10 and I installed gcc-3.3. separately.

if [ -f libgcc2.ready ] ; then \
true; \
else \
touch libgcc2.ready; \
fi
./xgcc -B./ -DCROSS_COMPILE -DIN_GCC -g -I./include -I/usr/include enquire.o -o enquire
enquire.o: In function `fCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
enquire.o: In function `dCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
enquire.o: In function `ldCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
make: *** [enquire] Error 1

Please tell me a way to get out of this error.

Thanks
Laky

Anonymous said...

rm -rf tmpcopy
if [ -f /home/sergey/development/SimpleScalar/sslittle-na-sstrix/bin/ranlib ] ; then /home/sergey/development/SimpleScalar/sslittle-na-sstrix/bin/ranlib tmplibgcc.a; else true; fi
mv tmplibgcc.a libgcc.a
./xgcc -B./ -DCROSS_COMPILE -DIN_GCC -g -I./include -I/usr/include enquire.o -o enquire
enquire.o: In function `fCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
enquire.o: In function `dCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
enquire.o: In function `ldCheck':
./enquire.c:2186: undefined reference to `__isoc99_sscanf'
make: *** [enquire] Error 1
sergey@ubuntu:~/development/SimpleScalar/gcc-2.7.2.3$

rahulgoel said...

Harry,
All your instructions are working fine and the errors are showing as you predicted.But the problem that I am facing is :
After executing the statement :-

/opt/simplescalar/simplesim-3.0/sim-fast ./enquire -f > float.h-cross

it is showing that cannot execute enquire.
Help required.

Parijat Shukla said...

Hi Rahul,
I was not following the posts since long.

/opt/simplescalar/simplesim-3.0/sim-fast ./enquire -f > float.h-cross
I guess enquire is the application you want to run.
Have a question: is "./enquire" or just "enquire" is enough

Anonymous said...

Ahm can i Ask why cxxmain.c isnt generated in my simplescalar tnx

JUNQI DENG said...

Regarding to the undefined reference to `__isoc99_sscanf' problem, you can refer to http://godblesstangkk.blogspot.hk/2013/01/install-simplescalar-30-on-ubuntu-1204.html

This is a very good page describing how to install simplescalar 3.0 on ubuntu 12.04

Eliza DEF dispensing said...

Everything is very clear.It was truly informative.Your website is very useful.Thank you for sharing.

Hose assembly said...

Excellent blog. Your site was great and will be finding it again!I surf the net for blogs like yours.

Anonymous said...

hey!!
i'm tryin to install simple scalar in ubuntu 12.10. i'm using x86_64. i'm having problems installing gcc-2.7.2. it says Configuration x86_64-pc-linux not supported.
any suggestions??

Anonymous said...

hey!!
i'm tryin to install simple scalar in ubuntu 12.10. i'm using x86_64. i'm having problems installing gcc-2.7.2. it says Configuration x86_64-pc-linux not supported.
any suggestions??

Anonymous said...

This is very helpful. Thanks
Plz tell me which commands to use to run spec 95 and spec 2000 little endian Pisa benchmark programs on simplescalar
Thanks a lot