1

I am using a Windows Subsystem for Linux with Ubuntu Focal.

After installing
sudo apt install build-essential git m4 scons zlib1g zlib1g-dev libprotobuf-dev protobuf-compiler libprotoc-dev libgoogle-perftools-dev python-dev python libboost-all-dev
I am trying to build gem5 with scons from the gem5 folder
scons build/ARM/gem5.opt -j 4
and get the error

Warning: Failed to find git repo directory: a bytes-like object is required, not 'str' :
TypeError: argument should be integer or bytes-like object, not 'str' :
   File "/home/user/gem5/Sconstruct", line 355:
       main['GCC'] = CXX_version and CXX_version.find('g++')>= 0

On an older build of WSL using Bionics, those steps worked without problems. Any idea, what i am missing here?

chenino
  • 67
  • 5

1 Answers1

1

In python 3, subprocess communicate is going to return a bytes-like object here: gem5 SConstruct which is what sets CXX_version (python bytes-like docs: PIPE and communicate)

That bytes-like object gets find called on it with a str argument, but it should be converted to bytes for finding in a bytes-like object. Probably the readCommand function that returned the communicate output should be the one to convert the output from bytes-like to str.

What version of python and SCons was this run with? My guess is python 3 was used and the SConstruct for that build is not compatible with python 3.

Probably try with python2.7 for now.

One way to do that is through virtualenv

# assuming linux
python2.7 -m pip install virtualenv
virtualenv /home/user/venv
/home/user/venv/bin/pip install -U setuptools wheel pip
/home/user/venv/bin/pip install scons
cd /home/user/gem5
/home/user/venv/bin/scons
dmoody256
  • 538
  • 4
  • 12
  • Sounds reasonable to me, but should Scons not automatically select Python 2.7? It has been installed using apt and it seems to have done that on the Bionics Build – chenino May 01 '20 at 10:48
  • if you check the scons script (*nix: scons or windows: where scons) it shows it uses your systems 'python' command, so if your system is configured with python3 as the python command then it use's that. This issue shows several solutions for using a different python version with scons: https://stackoverflow.com/questions/48185262/how-to-execute-scons-in-a-python3-environment – dmoody256 May 01 '20 at 14:25
  • Thank you very much for your explanation! – chenino May 02 '20 at 18:20
  • Focal tried very hard to excise python2 bits, so "should SCons not automatically select Python 2.7" seems like something Ubuntu may have chosen intentionally not to do. This is just a guess, I don't run scons from distro pkgs so don't know how they set it up. – Mats Wichmann May 05 '20 at 17:19