编译 ns-3 waf 时出错(无法加载 Waf 工具'clang_compilation_database)

Error compiling ns-3 waf (Could not load the Waf tool 'clang_compilation_database)

我将我的 ns-3 版本(包括私有模块)更新到最新版本,编译时,这是生成的错误:

mattia@pcsensori16:~/ns3-mmwave$ ./waf configure
Setting top to                           : /home/mattia/ns3-mmwave 
Setting out to                           : /home/mattia/ns3-mmwave/build 
Checking for 'gcc' (C compiler)          : /usr/bin/gcc 
Checking for cc version                  : 4.8.4 
Checking for 'g++' (C++ compiler)        : /usr/bin/g++ 
Could not load the Waf tool 'clang_compilation_database' from ['/home/mattia/ns3-mmwave/.waf-1.8.12-f00e5b53f6bbeab1384a38c9cc5d51f7', '/home/mattia/ns3-mmwave', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
No module named clang_compilation_database
(complete log in /home/mattia/ns3-mmwave/build/config.log)

有人知道我遗漏了什么吗?

[编辑:添加 config.log 文件]

Checking for 'clang++' (C++ compiler)
find program=['clang++'] paths=['/Library/Frameworks/Python.framework/Versions/3.4/bin', '/Library/Frameworks/Python.framework/Versions/3.4/bin', '/opt/local/bin', '/opt/local/sbin', '/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin', '/sbin', '/opt/X11/bin', '/Library/TeX/texbin'] var='CXX' -> ['/usr/bin/clang++']
(tool ar is already loaded, skipping)
/usr/bin/clang++
from /Users/mattia/ns3-mmwave: Could not load the Waf tool 'clang_compilation_database' from ['/Users/mattia/ns3-mmwave/.waf-1.8.12-f00e5b53f6bbeab1384a38c9cc5d51f7', '/Users/mattia/ns3-mmwave/.waf-1.8.12-f00e5b53f6bbeab1384a38c9cc5d51f7/waflib', '/Users/mattia/ns3-mmwave', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages']
No module named clang_compilation_database

尝试手动删除构建文件夹 (rm -f build) 或使用 ./waf distclean 并重新配置。

超级老,但今天仍然发现这个问题相关。在我的 wscript 中,特别是 ns3,tooldir 是 waf-tools,所以你想做这样的事情:

def options(opt):
    opt.load('clang_compilation_database', tooldir='waf-tools')

def configure(conf):
    conf.load('clang_compilation_database', tooldir='waf-tools')

发现这对于尝试使用 ns3 设置 clion 很有用:How to setup CLion to use waf as build system