Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BCC does not support LLVLM 7 or earlier anymore with the master branch #3881

Closed
viniciusd opened this issue Feb 24, 2022 · 7 comments
Closed

Comments

@viniciusd
Copy link
Contributor

viniciusd commented Feb 24, 2022

By trying to compile BCC on Ubuntu (both 18.04 and 20.04, GCC 7.5+llvm6 and GCC 9.3+llvm7, respectively), it fails as per the log:

/tmp/bcc/src/cc/bpf_module.cc: In member function ‘virtual void ebpf::MyMemoryManager::notifyObjectLoaded(llvm::ExecutionEngine*, const llvm::object::ObjectFile&)’:
/tmp/bcc/src/cc/bpf_module.cc:108:46: error: no matching function for call to ‘llvm::object::SectionRef::getName() const’
       auto sec_name = section.get()->getName();
                                              ^
In file included from /usr/lib/llvm-6.0/include/llvm/DebugInfo/DIContext.h:19:0,
                 from /usr/lib/llvm-6.0/include/llvm/ExecutionEngine/RuntimeDyld.h:19,
                 from /usr/lib/llvm-6.0/include/llvm/ExecutionEngine/RTDyldMemoryManager.h:19,
                 from /usr/lib/llvm-6.0/include/llvm/ExecutionEngine/SectionMemoryManager.h:20,
                 from /tmp/bcc/src/cc/bpf_module.cc:22:
/usr/lib/llvm-6.0/include/llvm/Object/ObjectFile.h:399:24: note: candidate: std::error_code llvm::object::SectionRef::getName(llvm::StringRef&) const
 inline std::error_code SectionRef::getName(StringRef &Result) const {
                        ^~~~~~~~~~
/usr/lib/llvm-6.0/include/llvm/Object/ObjectFile.h:399:24: note:   candidate expects 1 argument, 0 provided
src/cc/CMakeFiles/bcc-shared.dir/build.make:110: recipe for target 'src/cc/CMakeFiles/bcc-shared.dir/bpf_module.cc.o' failed
make[2]: *** [src/cc/CMakeFiles/bcc-shared.dir/bpf_module.cc.o] Error 1
CMakeFiles/Makefile2:234: recipe for target 'src/cc/CMakeFiles/bcc-shared.dir/all' failed
make[1]: *** [src/cc/CMakeFiles/bcc-shared.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

Checking the autogenerated doxygen, I see indeed the function getName() does not have an argument anymore, but the headers for both llvm 7 and llvm 6 contain only std::error_code SectionRef::getName(StringRef &Result) const

This was changed in this commit of the llvm project (llvm/llvm-project@bcc00e1afbdc1). Looking at the releases history, I assume it was initially released in llvm9, as the commit dates to mid 2019.

BCC changed the usage of this getName function in the commit 8323d74 by @davemarchevsky, which was merged a couple of weeks ago to BCC's master branch.

Should BCC require llvm9+ now? Not sure what solution should the project adopt.

INSTALL.md suggested llvm6 for Ubuntu 18.04 and llvm7 for Ubuntu 19 or 20.

@viniciusd viniciusd changed the title BCC does not support LLVLM 7 or earlier anymore BCC does not support LLVLM 7 or earlier anymore with the master branch Feb 24, 2022
@chenhengqi
Copy link
Collaborator

see #3808

@viniciusd
Copy link
Contributor Author

For whoever arrives here facing the same issue, download the release 0.24.0, it will compile successfully.

But check #3808 for future releases.

@asmca
Copy link

asmca commented Mar 8, 2022

confirmed on similar platform to ubuntu 20.04 with llvm7.
also checked release 0.24.0 works.

@ulidtko
Copy link

ulidtko commented Mar 23, 2022

v0.24.0 tag did not compile for me on bionic 18.04.6 LTS + LLVM 7.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.6 LTS
Release:	18.04
Codename:	bionic

$ cmake BUILD
-- Latest recognized Git tag is v0.24.0
-- Git HEAD is 43fec8b8eddaf3dd8805ff0cfcf4bd031db60f38
-- Revision is 0.24.0-43fec8b8
-- Found LLVM: /usr/lib/llvm-7/include 7.0.0 (Use LLVM_ROOT envronment variable for another version of LLVM)
-- Could NOT find LibDebuginfod (missing: LIBDEBUGINFOD_LIBRARIES LIBDEBUGINFOD_INCLUDE_DIRS) 
-- Using static-libstdc++
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dev-be/src/bcc/BUILD

Same error, different line:

/home/dev-be/src/bcc/src/cc/bpf_module.cc: In member function ‘virtual void ebpf::MyMemoryManager::notifyObjectLoaded(llvm::ExecutionEngine*, const llvm::object::ObjectFile&)’:
/home/dev-be/src/bcc/src/cc/bpf_module.cc:113:46: error: no matching function for call to ‘llvm::object::SectionRef::getName() const’
       auto sec_name = section.get()->getName();
                                              ^

Edit: got successful compile of v0.24.0 with newer LLVM 10.

@ulugbek5609
Copy link

ulugbek5609 commented Apr 7, 2022

Release v0.24.0 only compiled for me with focal 20.04 + LLVM 10. Could be useful: 3601 2340

@magichan
Copy link

ubuntu 18.04 and llvm 10, compile fail when checkout v0.24.0 from master ,

delete repo, and reclone the bcc based on v0.24.0 , got successful compile

( maybe the libbpf submodule affect

@sujankh
Copy link

sujankh commented Oct 20, 2022

I installed llvm-11 in Ubuntu 18.04 using llvm.sh script provided in https://apt.llvm.org/ . I was able to compile the latest bcc master successfully. I had to manually update CMakeLists to point to the new installation but the rest worked fine:

To install llvm-11:
NOTE: I had to remove libunwind-11-dev from the llvm.sh script because apt reported that it was unavailable for installation.

sudo ./llvm.sh 11 all

CMakeLists diff:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d5614896..65b95908 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -123,7 +123,7 @@ if(CMAKE_USE_LIBBPF_PACKAGE)
 endif()
 
 if(NOT PYTHON_ONLY)
-  find_package(LLVM REQUIRED CONFIG)
+  find_package(LLVM REQUIRED CONFIG HINTS /usr/lib/llvm-11/cmake)
   message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIRS} ${LLVM_PACKAGE_VERSION} (Use LLVM_ROOT envronment variable for another version of LLVM)")
 
   if(ENABLE_CLANG_JIT)
@@ -138,7 +138,7 @@ if(NOT PYTHON_ONLY)
 
     # clang is linked as a library, but the library path searching is
     # primitively supported, unlike libLLVM
-    set(CLANG_SEARCH "/opt/local/llvm/lib;/usr/lib/llvm-3.7/lib;${LLVM_LIBRARY_DIRS}")
+    set(CLANG_SEARCH "/usr/lib/llvm-11/lib;${LLVM_LIBRARY_DIRS}")
     find_library(libclangAnalysis NAMES clangAnalysis clang-cpp HINTS ${CLANG_SEARCH})
     find_library(libclangAST NAMES clangAST clang-cpp HINTS ${CLANG_SEARCH})
     find_library(libclangBasic NAMES clangBasic clang-cpp HINTS ${CLANG_SEARCH})

@iovisor iovisor locked as resolved and limited conversation to collaborators Oct 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants