iovisor / iovisor/bcc

Can't build Ubuntu 20.04 bcc docker container

Open
#3,897 2 comments 0 reactions 1 assignee Claimed by @davemarchevsky View on GitHub
bug prio:high
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

Building the bcc docker container fails for Ubuntu 20.04 LTS using the bcc repo HEAD of master or the v0.24.0 tagged commit. v0.23.0 and earlier work, so this error was introduced after that release.

```docker build -f docker/Dockerfile.ubuntu -t bcc:latest --build-arg OS_TAG=20.04 .```

It fails with an llvm error. `debian/control` forces it to use llvm 9, even though Ubuntu 20.04 LTS has llvm 10 through 12 in the apt repo (10 is the default if you don't specify), which do build bcc. The error trace ends like this:

```/tmp/debuild.BIfCG8/bcc/src/cc/bpf_module.cc: In member function 'virtual void ebpf::MyMemoryManager::notifyObjectLoaded(llvm::ExecutionEngine*, const llvm::object::ObjectFile&)':
/tmp/debuild.BIfCG8/bcc/src/cc/bpf_module.cc:108:46: error: no matching function for call to 'llvm::object::SectionRef::getName() const'
108 | auto sec_name = section.get()->getName();
| ^
In file included from /usr/lib/llvm-9/include/llvm/DebugInfo/DIContext.h:18,
from /usr/lib/llvm-9/include/llvm/ExecutionEngine/RuntimeDyld.h:18,
from /usr/lib/llvm-9/include/llvm/ExecutionEngine/RTDyldMemoryManager.h:18,
from /usr/lib/llvm-9/include/llvm/ExecutionEngine/SectionMemoryManager.h:19,
from /tmp/debuild.BIfCG8/bcc/src/cc/bpf_module.cc:22:
/usr/lib/llvm-9/include/llvm/Object/ObjectFile.h:437:24: note: candidate: 'std::error_code llvm::object::SectionRef::getName(llvm::StringRef&) const'
437 | inline std::error_code SectionRef::getName(StringRef &Result) const {
| ^~~~~~~~~~
/usr/lib/llvm-9/include/llvm/Object/ObjectFile.h:437:24: note: candidate expects 1 argument, 0 provided
/tmp/debuild.BIfCG8/bcc/src/cc/bpf_module.cc: In member function 'int ebpf::BPFModule::finalize()':
/tmp/debuild.BIfCG8/bcc/src/cc/bpf_module.cc:505:42: warning: 'void llvm::EngineBuilder::setUseOrcMCJITReplacement(bool)' is deprecated [-Wdeprecated-declarations]
505 | builder.setUseOrcMCJITReplacement(false);
| ^
In file included from /usr/lib/llvm-9/include/llvm/ExecutionEngine/MCJIT.h:17,
from /tmp/debuild.BIfCG8/bcc/src/cc/bpf_module.cc:21:
/usr/lib/llvm-9/include/llvm/ExecutionEngine/ExecutionEngine.h:668:6: note: declared here
668 | void EngineBuilder::setUseOrcMCJITReplacement(bool UseOrcMCJITReplacement) {
| ^~~~~~~~~~~~~
make[3]: *** [src/cc/CMakeFiles/bcc-static.dir/build.make:79: src/cc/CMakeFiles/bcc-static.dir/bpf_module.cc.o] Error 1
make[3]: Leaving directory '/tmp/debuild.BIfCG8/bcc/obj-x86_64-linux-gnu'
make[2]: *** [CMakeFiles/Makefile2:780: src/cc/CMakeFiles/bcc-static.dir/all] Error 2
make[2]: Leaving directory '/tmp/debuild.BIfCG8/bcc/obj-x86_64-linux-gnu'
make[1]: *** [Makefile:144: all] Error 2
make[1]: Leaving directory '/tmp/debuild.BIfCG8/bcc/obj-x86_64-linux-gnu'
dh_auto_build: error: cd obj-x86_64-linux-gnu && make -j1 returned exit code 2
make: *** [debian/rules:12: build] Error 25
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
```

Adding support for llvm 10, 11 and 12 in `debian/control` fixes the problem and the container builds.

```
--- a/debian/control
+++ b/debian/control
@@ -4,10 +4,10 @@ Section: misc
Priority: optional
Standards-Version: 3.9.5
Build-Depends: debhelper (>= 9), cmake,
- libllvm9 | libllvm8 | libllvm6.0 | libllvm3.8 [!arm64] | libllvm3.7 [!arm64],
- llvm-9-dev | llvm-8-dev | llvm-6.0-dev | llvm-3.8-dev [!arm64] | llvm-3.7-dev [!arm64],
- libclang-9-dev | libclang-8-dev | libclang-6.0-dev | libclang-3.8-dev [!arm64] | libclang-3.7-dev [!arm64],
- clang-format-9 | clang-format-8 | clang-format-6.0 | clang-format-3.8 [!arm64] | clang-format-3.7 [!arm64] | clang-format,
+ libllvm12 | libllvm11 | libllvm10 | libllvm9 | libllvm8 | libllvm6.0 | libllvm3.8 [!arm64] | libllvm3.7 [!arm64],
+ llvm-12-dev | llvm-11-dev | llvm-10-dev | llvm-9-dev | llvm-8-dev | llvm-6.0-dev | llvm-3.8-dev [!arm64] | llvm-3.7-dev [!arm64],
+ libclang-12-dev | libclang-11-dev | libclang-10-dev | libclang-9-dev | libclang-8-dev | libclang-6.0-dev | libclang-3.8-dev [!arm64] | libclang-3.7-dev [!arm64],
+ clang-format-12 | clang-format-11 | clang-format-10 | clang-format-9 | clang-format-8 | clang-format-6.0 | clang-format-3.8 [!arm64] | clang-format-3.7 [!arm64] | clang-format,
libelf-dev, bison, flex, libfl-dev, libedit-dev, zlib1g-dev, git,
python (>= 2.7), python-netaddr, python-pyroute2 | python3-pyroute2, luajit,
libluajit-5.1-dev, arping, inetutils-ping | iputils-ping, iperf, netperf,
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.