iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fatal error: clang/Basic/FileManager.h: No such file or directory

NobinPegasus opened this issue · comments

While I try to build the bcc from source. I see the following errors.

/home/pegasus/Documents/eBPFShield/bcc/src/cc/frontends/clang/loader.cc:35:10: fatal error: clang/Basic/FileManager.h: No such file or directory
   35 | #include <clang/Basic/FileManager.h>

How to fix this?

Here's specification of host:

pegasus@pegasus:~$ uname -a
Linux pegasus 6.4.0-060400-generic #202306271339 SMP PREEMPT_DYNAMIC Tue Jun 27 14:26:34 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
pegasus@pegasus:~$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 23.10"
NAME="Ubuntu"
VERSION_ID="23.10"
VERSION="23.10 (Mantic Minotaur)"
VERSION_CODENAME=mantic
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=mantic
LOGO=ubuntu-logo
pegasus@pegasus:~$ clang --version
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 815644b4dd882ade2e5649d4f97c3dd6f7aea200)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/pegasus/Documents/llvm-project/build/bin

My LLVM is also built from source. The binaries are here:

/home/pegasus/Documents/llvm-project/build/bin
pegasus@pegasus:~/Documents/eBPFShield/bcc/build$ cmake ..
cmake: /usr/local/lib/libcurl.so.4: no version information available (required by cmake)
CMake Deprecation Warning at CMakeLists.txt:3 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Latest recognized Git tag is v0.30.0
-- Git HEAD is 679166bdee74302b46b14c3a8fe5c3db7198d3f4
-- Revision is 0.30.0+679166bd (major 0, minor 30, patch 0)
-- Kernel release: 6.4.0-060400-generic
-- Kernel headers: /usr/src/linux-headers-6.4.0-060400-generic
-- Found LLVM: /home/pegasus/Documents/llvm-project/llvm/include;/home/pegasus/Documents/llvm-project/build/include 19.0.0git (Use LLVM_ROOT envronment variable for another version of LLVM)
-- Using static-libstdc++
-- Could NOT find LuaJIT (missing: LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR) 
-- Configuring done (0.5s)
-- Generating done (0.1s)
-- Build files have been written to: /home/pegasus/Documents/eBPFShield/bcc/build
pegasus@pegasus:~/Documents/eBPFShield/bcc/build$ make 
/usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)
[  0%] Building CXX object src/cc/frontends/clang/CMakeFiles/clang_frontend-objects.dir/loader.cc.o
/home/pegasus/Documents/eBPFShield/bcc/src/cc/frontends/clang/loader.cc:35:10: fatal error: clang/Basic/FileManager.h: No such file or directory
   35 | #include <clang/Basic/FileManager.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/cc/frontends/clang/CMakeFiles/clang_frontend-objects.dir/build.make:76: src/cc/frontends/clang/CMakeFiles/clang_frontend-objects.dir/loader.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:995: src/cc/frontends/clang/CMakeFiles/clang_frontend-objects.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

If you are on debian, install libclang-dev