Welcome to gem5 Q&A, where you can ask questions and receive answers from other members of the community.

Error why building with gem5 [closed]

0 votes


I just installed gem5 (I followed the steps, i cloned the git repertory, had Scons 3.0.0 installed on my server.)

When I try to run a basic build (scons build/ARM/gem5.opt), I get this error:

scons: Reading SConscript files ...
  File "USERS/jackoup/gem5/SConstruct", line 93

    print """
For more details, see:


SyntaxError: invalid syntax


I have gcc 4.85 and python 2.7.5 so everything should be fine.

Any idea?
closed with the note: Resolved
asked Oct 4 in Compiling by jackoup (140 points)
closed Oct 10 by jackoup

1 Answer

0 votes
Hi jackoup,

in a Debian based distro I would recommend this:

sudo apt-get install m4 scons python python-dev gcc g++ libgoogle-perftools-dev protobuf-compiler gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu device-tree-compiler

(you can always install one by one to find out what exactly is missing)

If you're using another distro the packages may have slightly different names.

I hope it helps.


answered Oct 5 by efzulian (180 points)
Hi Eder, thank you for your help.

I am now able to go further in the build but still have some errors:

KeyError: 0:
  File "/jackoup/gem5/SConstruct", line 1554:
    SConscript('src/SConscript', variant_dir = variant_path, exports = 'env')
  File "/usr/lib/scons-0.98.1/SCons/Script/SConscript.py", line 596:
    return apply(method, args, kw)
  File "/usr/lib/scons-0.98.1/SCons/Script/SConscript.py", line 533:
    return apply(_SConscript, [self.fs,] + files, subst_kw)
  File "/usr/lib/scons-0.98.1/SCons/Script/SConscript.py", line 256:
    exec _file_ in call_stack[-1].globals
  File "/jackoup/gem5/build/ARM/SConscript", line 343:
    SConscript(joinpath(root, 'SConscript'), variant_dir=build_dir)
  File "/usr/lib/scons-0.98.1/SCons/Script/SConscript.py", line 596:
    return apply(method, args, kw)
  File "/usr/lib/scons-0.98.1/SCons/Script/SConscript.py", line 533:
    return apply(_SConscript, [self.fs,] + files, subst_kw)
  File "/usr/lib/scons-0.98.1/SCons/Script/SConscript.py", line 256:
    exec _file_ in call_stack[-1].globals
  File "/jackoup/gem5/build/ARM/arch/arm/SConscript", line 101:
  File "/usr/lib/scons-0.98.1/SCons/Environment.py", line 219:
    return apply(MethodWrapper.__call__, (self, target, source) + args, kw)
  File "/usr/lib/scons-0.98.1/SCons/Environment.py", line 183:
    return apply(self.method, nargs, kwargs)
  File "/usr/lib/scons-0.98.1/SCons/Builder.py", line 614:
    return self._execute(env, target, source, OverrideWarner(kw), ekw)
  File "/usr/lib/scons-0.98.1/SCons/Builder.py", line 561:
    tlist, slist = self._create_nodes(env, target, source)
  File "/usr/lib/scons-0.98.1/SCons/Builder.py", line 525:
    target, source = self.emitter(target=tlist, source=slist, env=env)
  File "/jackoup/gem5/build/ARM/arch/SConscript", line 136:
    if key in env:
  File "/usr/lib/scons-0.98.1/SCons/Environment.py", line 368:
    return self._dict[key]

Do you have any idea about this? I installed all the dependencies so that should be fine normally
Difficult to say, maybe try this (it will remove untracked files from your repo, so if you have any save it ;) ):
git stash
git clean -fdx
git pull

On the other hand, I think your first problem could be related to compatibility with the scons-3.0.0 (released recently 20170918).
I have scons-2.x on my computers, I tried scons-3.0.0 and I got the first error you posted. The release notes say: "... print statements must now use python 3 syntax of "print()" ". I fixed the first print and I the problem moved to the next. It would be nice if more people could confirm this issue. ;)

Maybe try to make sure you're using scons-2.x.x and python 2.x:
Check your default versions:
scons --version
python --version

Try to compile this way:
$(which python2) $(which scons) build/ARM/gem5.opt -j$(cat /proc/cpuinfo | grep proc | wc -l)
I used scons 2.4 and it worked, thanks!