我正在尝试在 Ubuntu 20.04 上编译 BCC BPF 框架 ( https://github.com/iovisor/bcc )。我遵循了 18.04 的所有说明,但是当然;他们失败了。
我遇到的问题似乎与 clang 相关
In file included from /usr/local/include/clang/Frontend/CompilerInstance.h:15,
from /home/matt/code/bpf/bcc/src/cc/frontends/clang/loader.cc:43:
/usr/local/include/clang/Frontend/CompilerInvocation.h:157:15: note: candidate: ‘static bool clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<const char*>, clang::DiagnosticsEngine&)’
157 | static bool CreateFromArgs(CompilerInvocation &Res,
| ^~~~~~~~~~~~~~
/usr/local/include/clang/Frontend/CompilerInvocation.h:157:15: note: candidate expects 3 arguments, 4 provided
make[2]: *** [src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/build.make:63: src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/loader.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:982: src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
如何在 Ubuntu 20.04 上进行 BCC 编译?
最佳答案
从 BCC v0.14.0-a28337a 开始,我必须使用 llvm-7 而不是最新的 LLVM。另外,需要 -DPYTHON_CMD=python3
或安装 Python2(或 python
命令),因为默认情况下不再安装 Python2。 https://github.com/iovisor/bcc/blob/master/INSTALL.md#ubuntu---source 中列出的其他依赖项也是必需的。
我可以在我的 Ubuntu 20.04 VM 上构建它。
cmake -Bbuild -DPYTHON_CMD=python3 -DCMAKE_PREFIX_PATH=/usr/lib/llvm-7
make -Cbuild -j$(nproc)
关于linux-kernel - 如何在Ubuntu 20.04上编译BCC?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61978175/