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 source setup make error on Debian Bookworm #5015

Open
VishnuVelayuthan opened this issue May 24, 2024 · 4 comments · May be fixed by #5041
Open

BCC source setup make error on Debian Bookworm #5015

VishnuVelayuthan opened this issue May 24, 2024 · 4 comments · May be fixed by #5041

Comments

@VishnuVelayuthan
Copy link

I'm trying to compile BCC from source in a debian bookworm container (specs listed below) on my Ubuntu Jammy system.

It compiles perfectly on my Ubuntu system, however, when I followed the setup steps on Debian (configuring sid, downloading the build tools) I was faced with a make error when running make in the bcc/build directory. It threw the following error:
make[2]: *** No rule to make target '/usr/lib/llvm-16/lib/libPolly.a', needed by 'src/cc/libbcc.so.0.30.0'. Stop. make[1]: *** [CMakeFiles/Makefile2:780: src/cc/CMakeFiles/bcc-shared.dir/all] Error 2
At around 20% on the first time I ran the command and 14% on subsequent runs. The Makefile seems to be missing a rule to build a the /usr/lib/llvm-16/lib/libPolly.a file while trying to build CXX object src/cc/CMakeFiles/bcc-shared.dir/common.cc.o

To simply test and hack a solution, I created an empty /usr/lib/llvm-16/lib/libPolly.a file and kept on going with the build process. Right, after, I received another error:
make[2]: *** No rule to make target '/usr/lib/llvm-16/lib/libPollyISL.a', needed by 'src/cc/libbcc.so.0.30.0'. Stop. make[1]: *** [CMakeFiles/Makefile2:780: src/cc/CMakeFiles/bcc-shared.dir/all] Error 2 make: *** [Makefile:146: all] Error 2
image

I touched and created another empty file by the name of '/usr/lib/llvm-16/lib/libPollyISL.a' to keep on going ahead with the build process. I'm then faced with another error (as expected) at around 38%:
image
Here's the trace:
/usr/bin/ld: /usr/lib/llvm-16/lib/libclangCodeGen.a(BackendUtil.cpp.o): in function `(anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile> >&)': (.text._ZN12_GLOBAL__N_118EmitAssemblyHelper23RunOptimizationPipelineEN5clang13BackendActionERSt10unique_ptrIN4llvm17raw_pwrite_streamESt14default_deleteIS5_EERS3_INS4_14ToolOutputFileES6_ISA_EE+0x14ad): undefined reference to `getPollyPluginInfo()' /usr/bin/ld: /usr/lib/llvm-16/lib/libLLVMLTO.a(LTOBackend.cpp.o): in function `llvm::lto::opt(llvm::lto::Config const&, llvm::TargetMachine*, unsigned int, llvm::Module&, bool, llvm::ModuleSummaryIndex*, llvm::ModuleSummaryIndex const*, std::vector<unsigned char, std::allocator<unsigned char> > const&)': (.text._ZN4llvm3lto3optERKNS0_6ConfigEPNS_13TargetMachineEjRNS_6ModuleEbPNS_18ModuleSummaryIndexEPKS8_RKSt6vectorIhSaIhEE+0x8e5): undefined reference to `getPollyPluginInfo()' /usr/bin/ld: /usr/lib/llvm-16/lib/libLLVMExtensions.a(Extensions.cpp.o): in function `llvm::details::extensions_anchor()': (.text._ZN4llvm7details17extensions_anchorEv+0x1a): undefined reference to `getPollyPluginInfo()' collect2: error: ld returned 1 exit status make[2]: *** [examples/cpp/CMakeFiles/CGroupTest.dir/build.make:184: examples/cpp/CGroupTest] Error 1 make[1]: *** [CMakeFiles/Makefile2:1127: examples/cpp/CMakeFiles/CGroupTest.dir/all] Error 2 make: *** [Makefile:146: all] Error 2

Could someone please help me fix this problem as I need to build this tool in Debian to test it out on a machine that runs on Debian. Let me know if more information is required. Here are the specs of my image:
image

@VishnuVelayuthan
Copy link
Author

VishnuVelayuthan commented Jun 12, 2024

After some debugging, I found that it was an issue with the llvm version I was using. For some reason, any version of llvm over 13 requires this /usr/lib/llvm-[version]/lib/libPolly.a file as I was receiving the same error when I downgraded my llvm version to 14.

I was able to build the tool by downgrading to version 13 by installing all the llvm/c++ related tools as version 13.

For the build tool installation, make sure you run this command instead:

sudo apt-get install arping bison clang-format-13 cmake dh-python \ dpkg-dev pkg-kde-tools ethtool flex inetutils-ping iperf \ libbpf-dev libclang-dev libclang-cpp13-dev libedit-dev libelf-dev \ libfl-dev libzip-dev linux-libc-dev llvm-13 libluajit-5.1-dev \ luajit python3-netaddr python3-pyroute2 python3-setuptools python3 zip

notice llvm-dev, clang-format, and libclang-cpp-dev have been swapped accordingly. Also, the make process requires zip. I'd probably recommend uninstalling those packages if installed.

I'd recommend the maintainers to change the installation instructions to reflect this. Let me know if you would desire a change and I'd be happy to draft it up and make a pr for it.

@yonghong-song
Copy link
Collaborator

Please submit a pull request for this. I suspect libPolly.a is needed probably due to different llvm build options.

@VishnuVelayuthan
Copy link
Author

PR submitted, lmk if there are any issues

@agentzex
Copy link
Contributor

I can confirm I have the same error on :
Ubuntu 24.04
with
Ubuntu clang version 18.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants