简体   繁体   中英

SConscript EnvironmentError: No module named compilation_db

I'm trying to compile the GitHub project: https://github.com/commaai/openpilot , I'm getting an error when creating the SCons environment (the call to Environment()), it points this line:

Environement(
# Other options ...
tools=["default", "cython", "compilation_db"
)

The result of the scons is then:

scons: Reading SConscript files ...
EnvironmentError: No module named compilation_db:
  File "/home/skoumad/openpilot/master/SConstruct", line 213:
    "compilation_db"
  File "/usr/lib/scons/SCons/Environment.py", line 982:
    apply_tools(self, tools, toolpath)
  File "/usr/lib/scons/SCons/Environment.py", line 107:
    env.Tool(tool)
  File "/usr/lib/scons/SCons/Environment.py", line 1788:
    tool = SCons.Tool.Tool(tool, toolpath, **kw)
  File "/usr/lib/scons/SCons/Tool/__init__.py", line 118:
    module = self._tool_module()
  File "/usr/lib/scons/SCons/Tool/__init__.py", line 215:
    raise SCons.Errors.EnvironmentError(error_string)

I tried to install compilation_db using: https://pypi.org/project/scons-compiledb/0.4.7/ but still the same error:/.

Any idea on how to install this missing module??

Regards.

You likely have a version of SCons older than 4.0.0

The compilation_db tool was added in 4.0.0

See release notice

If you're distro(linux,python, macports, etc) doesn't have 4.0.0 or newer, then I'd advise setting up a python virtualenv (no this is not a VM, it's just a tool to create a clean python environment to install packages in)

Here's how to do that:

# assuming posix system, for win32, of course change the path to windows correct syntax
# also the python below should be 3.5 or newer, generally it's best to use the newest installed
python -m venv ~/sconsvenv 
. ~/sconsvenv/bin/activate
pip install  scons

scons --version

# should yield

SCons by Steven Knight et al.:
    SCons: v4.1.0.post1.dc58c175da659d6c0bb3e049ba56fb42e77546cd, 2021-01-20 04:32:28, by bdbaddog on ProDog2020
    SCons path: ['/Users/bdbaddog/sconsvenv/lib/python3.8/site-packages/SCons']
Copyright (c) 2001 - 2021 The SCons Foundation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM