I am trying to set up gem5 for RISCV on Ubuntu 18.04. I first ran the following commands:
sudo apt install build-essential
apt install m4 zlib1g-dev scons python-six python-dev
git clone https://gem5.googlesource.com/public/gem5
Then I tried running the following command:
/usr/bin/env python3.9 $(which scons) build/RISCV/gem5.opt
Everything starts perfectly but then it gives an error that there is no working python environment. So, I had to edit the file SConstruct under gem5 directory on line 521 from:
py_version = conf.CheckPythonLib()
to:
vi = sys.version_info
py_version = (vi.major, vi.minor, vi.micro)
After I did this, it started to work but it then complained about PIE objects:
/usr/bin/ld: /usr/local/lib/python3.9/config-3.9-x86_64-linux-gnu/libpython3.9.a(myreadline.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
So, I finally ran it with the following command and it finished without any errors:
/usr/bin/env python3.9 $(which scons) build/RISCV/gem5.opt -no-pie
However, I can not find gem5.opt under build/RISCV and therefore can not run gem5. I would really appreciate it if anyone has any suggestion that might fix the issue. Thank you!