Scons 找不到 git 和编译器

Scons failes to find git and compiler

我正在为 Linux 使用 Windows 子系统和 Ubuntu Focal。

安装后
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
我正在尝试使用 gem5 文件夹中的 scons 构建 gem5
scons build/ARM/gem5.opt -j 4
并得到错误

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

在使用 Bionics 的旧版 WSL 上,这些步骤没有问题。 知道吗,我在这里缺少什么?

在python 3中,子进程通信将return这里的一个类字节对象:gem5 SConstruct which is what sets CXX_version (python bytes-like docs: PIPE and communicate)

使用 str 参数对该类字节对象调用 find,但应将其转换为字节以在类字节对象中查找。 returned 通信输出的 readCommand 函数可能应该是将输出从 bytes-like 转换为 str 的函数。

这个 运行 使用的是什么版本的 python 和 SCons?我的猜测是使用了 python 3,并且该版本的 SConstruct 与 python 3.

不兼容

现在可能会尝试使用 python2.7。

一种方法是通过 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