bcc icon indicating copy to clipboard operation
bcc copied to clipboard

bcc installation from the source fails at Ubuntu 24.04.2, LLVM 19.

Open KnightChaser opened this issue 5 months ago • 4 comments

I'm currently experiencing a problem installing the bcc package, as the installation guide (https://github.com/iovisor/bcc/blob/master/INSTALL.md#libbpf-submodule) suggests.

Here is the context of my environment.

  • Software environment
    • OS: Ubuntu 24.04.2 LTS x86_64
    • Kernel: 6.11.0-28-generic
    • cmake version: 3.28.3 (required >= 3.1)
    • GCC version: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 (required >= 4.7)
    • flex* version: 2.6.4
    • bison* version: (GNU Bison) 3.8.2
    • LLVM version: 19
      • *: In my memory, I haven't manually installed them. I think they were already installed basically...? (Not sure about those two packages.)
  • Procedures I tried to install bcc on my computer
    • Since my Ubuntu version is 24.04, according to the given installation guide, I installed the following required apt packages:
sudo apt install -y zip bison build-essential cmake flex git libedit-dev \
  libllvm18 llvm-18-dev libclang-18-dev python3 zlib1g-dev libelf-dev libfl-dev python3-setuptools \
  liblzma-dev libdebuginfod-dev arping netperf iperf libpolly-18-dev
  • And I execute the following commands sequentially.
git clone https://github.com/iovisor/bcc.git
mkdir bcc/build; cd bcc/build
cmake ..
make
  • Especially, when I execute the cmake .. command, which is described right above, the cmake output is as follows:
-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Latest recognized Git tag is v0.35.0
-- Git HEAD is 2f3361c6fd361bc5e7424df21671d728e98d55c3
-- Revision is 0.35.0+2f3361c6 (major 0, minor 35, patch 0)
-- Performing Test HAVE_NO_PIE_FLAG
-- Performing Test HAVE_NO_PIE_FLAG - Success
-- Performing Test HAVE_REALLOCARRAY_SUPPORT
-- Performing Test HAVE_REALLOCARRAY_SUPPORT - Success
-- Kernel release: 6.11.0-28-generic
-- Kernel headers: /usr/src/linux-headers-6.11.0-28-generic
-- Performing Test HAVE_FFI_CALL
-- Performing Test HAVE_FFI_CALL - Success
-- Found FFI: /usr/lib/x86_64-linux-gnu/libffi.so  
-- Looking for histedit.h
-- Looking for histedit.h - found
-- Found LibEdit: /usr/include (found version "2.11") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.3")  
-- Found zstd: /usr/lib/x86_64-linux-gnu/libzstd.so  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.14") 
-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) 
-- Found LLVM: /usr/lib/llvm-19/include 19.1.7 (Use LLVM_ROOT envronment variable for another version of LLVM)
-- Found BISON: /usr/bin/bison (found version "3.8.2") 
-- Found FLEX: /usr/bin/flex (found version "2.6.4") 
-- Found LibElf: /usr/lib/x86_64-linux-gnu/libelf.so  
-- Performing Test ELF_GETSHDRSTRNDX
-- Performing Test ELF_GETSHDRSTRNDX - Success
-- Found LibDebuginfod: /usr/lib/x86_64-linux-gnu/libdebuginfod.so  
-- Found LibLzma: /usr/lib/x86_64-linux-gnu/liblzma.so  
-- Using static-libstdc++
-- Could NOT find LuaJIT (missing: LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR) 
-- Configuring done (1.6s)
-- Generating done (0.0s)
-- Build files have been written to: /home/paff/ghrepo/bcc/build
  • When I hit make, it suddenly stops with the following error:
... (abbreviated) ...
[ 18%] Building C object src/cc/CMakeFiles/bcc-shared.dir/bcc_proc.c.o
[ 18%] Building C object src/cc/CMakeFiles/bcc-shared.dir/bcc_zip.c.o
[ 18%] Building CXX object src/cc/CMakeFiles/bcc-shared.dir/common.cc.o
make[2]: *** No rule to make target '/usr/lib/llvm-19/lib/libPolly.a', needed by 'src/cc/libbcc.so.0.35.0'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:836: src/cc/CMakeFiles/bcc-shared.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

Even though I searched for other error cases related to the installation on Google or GitHub issues, to the best of my ability, I couldn't resolve the installation failure on my own, so I'm leaving an issue now to get some help.

Thanks in advance!

KnightChaser avatar Jul 02 '25 06:07 KnightChaser

Update: I changed the LLVM version from 19 to 18 and retried the installation procedure, as below, the compilation(make) works well.

paff@helblinde:~/ghrepo/bcc/build$ cmake ..
...
-- Found LLVM: /usr/lib/llvm-18/include 18.1.3 (Use LLVM_ROOT envronment variable for another version of LLVM)

(Note: Meanwhile, there is a warning about Python3's setuptools and setup.py. It didn't make me fail to install bcc on my computer, but anyway, it doesn't seem to be okay to abandon to me. The log snippet below is a part of the log of the command sudo make install.)

...
/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
...

Anyway, I succeeded in installing the bcc package with LLVM version 18 instead of 19. So, isn't there a way to go with the LLVM 19?

KnightChaser avatar Jul 03 '25 06:07 KnightChaser

Update: I changed the LLVM version from 19 to 18 and retried the installation procedure, as below, the compilation(make) works well.

paff@helblinde:~/ghrepo/bcc/build$ cmake ..
...
-- Found LLVM: /usr/lib/llvm-18/include 18.1.3 (Use LLVM_ROOT envronment variable for another version of LLVM)

(Note: Meanwhile, there is a warning about Python3's setuptools and setup.py. It didn't make me fail to install bcc on my computer, but anyway, it doesn't seem to be okay to abandon to me. The log snippet below is a part of the log of the command sudo make install.)

...
/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
...

Anyway, I succeeded in installing the bcc package with LLVM version 18 instead of 19. So, isn't there a way to go with the LLVM 19?

I did a quick search and found this issue. tldr: sudo apt install libpolly-19-dev

MisileLab avatar Jul 03 '25 16:07 MisileLab

Try to enable ENABLE_LLVM_SHARED?

yonghong-song avatar Jul 03 '25 20:07 yonghong-song

Update: I changed the LLVM version from 19 to 18 and retried the installation procedure, as below, the compilation(make) works well.

paff@helblinde:~/ghrepo/bcc/build$ cmake ..
...
-- Found LLVM: /usr/lib/llvm-18/include 18.1.3 (Use LLVM_ROOT envronment variable for another version of LLVM)

(Note: Meanwhile, there is a warning about Python3's setuptools and setup.py. It didn't make me fail to install bcc on my computer, but anyway, it doesn't seem to be okay to abandon to me. The log snippet below is a part of the log of the command sudo make install.)

...
/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
...

Anyway, I succeeded in installing the bcc package with LLVM version 18 instead of 19. So, isn't there a way to go with the LLVM 19?

I did a quick search and found this issue. tldr: sudo apt install libpolly-19-dev

Yes, that resolved the issue.

Speaking about libpolly-XX-dev packages, your suggestion was right. When I installed LLVM 18, basically, libpolly-18-dev:amd64 was also installed. But when I install LLVM 19 (currently the newest available) via the following command as the official documentation instructed,

bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"

There was no libpolly-19-dev package. (So, highly likely, that was the reason of the previous installation attempt failure.) After manually installing that libpolly package, the build process(make) was successfully finished! Thanks. 😄

(P.S.: Why doesn't LLVM 19 include the libpolly package?)

KnightChaser avatar Jul 04 '25 04:07 KnightChaser