iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.61k stars 3.89k forks source link

CMake error in bcc source compilation #4462

Open koteswararao18 opened 1 year ago

koteswararao18 commented 1 year ago

Hi,

BCC build on ubuntu 22.04 fails with below error. Installed clang-14/llvm-14 versions for backend compilation. {{ /bcc/bcc/build$ cmake .. -- The C compiler identification is GNU 11.2.0 -- The CXX compiler identification is Clang 14.0.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.26.0 -- Git HEAD is 99726b9ece813883b3be3a74d94af634f34bfad2 -- Revision is 0.26.0-99726b9e (major 0, minor 26, 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: 5.15.0-46-generic -- Kernel headers: /usr/src/linux-headers-5.15.0-46-generic CMake Error at CMakeLists.txt:127 (find_package): Could not find a package configuration file provided by "LLVM" with any of the following names:

LLVMConfig.cmake
llvm-config.cmake

Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set "LLVM_DIR" to a directory containing one of the above files. If "LLVM" provides a separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred! See also "/var/build/bcc/bcc/build/CMakeFiles/CMakeOutput.log". }} Reported similar issue in https://github.com/iovisor/bcc/issues/1975 but fix is not posted in it? Regards Kot

yonghong-song commented 1 year ago

The error message

Could not find a package configuration file provided by "LLVM" with any of
the following names:

LLVMConfig.cmake
llvm-config.cmake

shows the bcc didn't find a proper llvm package in the system. You probably missed llvm-dev package. See INSTALL.md file for more details.

vladd12 commented 1 year ago

Is the problem solved?

koteswararao18 commented 1 year ago

Tried to install llvm-14-dev but its in turn triggering libxml2 failure on ubuntu22.04 {{

apt-get install llvm-14-dev

Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

The following packages have unmet dependencies: libxml2-dev : Depends: libxml2 (= 2.9.13+dfsg-1build1) but 2.9.13+dfsg-1ubuntu0.1 is to be installed E: Unable to correct problems, you have held broken packages. currently looking in to this issue.

vladd12 commented 1 year ago

@koteswararao18, do you tried reinstall libxml2-dev package? It looks strange that this package is in the list of dependencies for llvm.

zer0-1s commented 1 year ago

same question

$ cmake ..    
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.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
子模组 'libbpf-tools/blazesym'(https://github.com/libbpf/blazesym)已对路径 'libbpf-tools/blazesym' 注册
正克隆到 '/hdiska/cyn/bcc/libbpf-tools/blazesym'...

子模组路径 'libbpf-tools/blazesym':检出 'd954f73867527dc75025802160c759d0b6a0641f'
子模组 'libbpf-tools/bpftool'(https://github.com/libbpf/bpftool)已对路径 'libbpf-tools/bpftool' 注册
子模组 'src/cc/libbpf'(https://github.com/libbpf/libbpf.git)已对路径 'src/cc/libbpf' 注册
正克隆到 '/hdiska/cyn/bcc/libbpf-tools/bpftool'...
正克隆到 '/hdiska/cyn/bcc/src/cc/libbpf'...
子模组路径 'libbpf-tools/bpftool':检出 '6eb3e20583da834da18ea3011dcefd08b3493f8d'
子模组 'libbpf'(https://github.com/libbpf/libbpf.git)已对路径 'libbpf-tools/bpftool/libbpf' 注册
正克隆到 '/hdiska/cyn/bcc/libbpf-tools/bpftool/libbpf'...
子模组路径 'libbpf-tools/bpftool/libbpf':检出 '7984737fbf3b2a14a86321387bb62abb16cfc4ed'
子模组路径 'src/cc/libbpf':检出 '1e479aec4f8dc1715923c5de87aa624e633b75c4'
-- Latest recognized Git tag is v0.26.0
-- Git HEAD is 9b5af1b0c140c8dbcbd9b821dccf2f7fceb6429c
-- Revision is 0.26.0-9b5af1b0 (major 0, minor 26, 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: 5.15.0-57-generic
-- Kernel headers: /usr/src/linux-headers-5.15.0-57-generic
CMake Error at CMakeLists.txt:127 (find_package):
  Could not find a package configuration file provided by "LLVM" with any of
  the following names:

    LLVMConfig.cmake
    llvm-config.cmake

  Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
  "LLVM_DIR" to a directory containing one of the above files.  If "LLVM"
  provides a separate development package or SDK, be sure it has been
  installed.

-- Configuring incomplete, errors occurred!
See also "/home/viko/cyn/bcc/build/CMakeFiles/CMakeOutput.log".
Kolo7 commented 1 year ago

I am a beginner, how to solve this problem? OS: ubuntu 22.04

Created bcc/build directory, and then executed cmake in that directory.Unfortunately, ran into the same trouble as them.

xueqing commented 1 year ago

Hi,

BCC build on ubuntu 22.04 fails with below error. Installed clang-14/llvm-14 versions for backend compilation. {{ /bcc/bcc/build$ cmake .. -- The C compiler identification is GNU 11.2.0 -- The CXX compiler identification is Clang 14.0.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.26.0 -- Git HEAD is 99726b9 -- Revision is 0.26.0-99726b9e (major 0, minor 26, 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: 5.15.0-46-generic -- Kernel headers: /usr/src/linux-headers-5.15.0-46-generic CMake Error at CMakeLists.txt:127 (find_package): Could not find a package configuration file provided by "LLVM" with any of the following names:

LLVMConfig.cmake
llvm-config.cmake

Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set "LLVM_DIR" to a directory containing one of the above files. If "LLVM" provides a separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred! See also "/var/build/bcc/bcc/build/CMakeFiles/CMakeOutput.log". }} Reported similar issue in #1975 but fix is not posted in it? Regards Kot

Have you run the following command accorfing to "Install build dependencies":

# For Jammy (22.04)
sudo apt install -y zip bison build-essential cmake flex git libedit-dev \
  libllvm14 llvm-14-dev libclang-14-dev python3 zlib1g-dev libelf-dev libfl-dev python3-setuptools \
  liblzma-dev libdebuginfod-dev arping netperf iperf