From 7d8bf845341495c12b3f0a7ec952f7877c2ea0ca Mon Sep 17 00:00:00 2001 From: Yonghong Song Date: Sun, 26 Mar 2023 13:10:49 -0700 Subject: [PATCH] Fix compilation error when built with llvm17 With llvm17, building bcc hits the following compilation errors: ... /home/yhs/work/bcc/src/cc/bpf_module.cc:21:10: fatal error: llvm-c/Transforms/IPO.h: No such file or directory 21 | #include | ^~~~~~~~~~~~~~~~~~~~~~~~~ /home/yhs/work/bcc/src/cc/bpf_module.cc:48:10: fatal error: llvm/Transforms/IPO/PassManagerBuilder.h: No such file or directory 48 | #include | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The above two files are removed by https://reviews.llvm.org/D144970 and https://reviews.llvm.org/D145835 Change-Id: I5f72ae78ed22734e5a786dd745f21293a057e46f Signed-off-by: Yonghong Song --- src/cc/bpf_module.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/cc/bpf_module.cc b/src/cc/bpf_module.cc index f48df7af..c8bff5ca 100644 --- a/src/cc/bpf_module.cc +++ b/src/cc/bpf_module.cc @@ -21,8 +21,9 @@ #include #include #include -#include - +#if LLVM_MAJOR_VERSION <= 16 +#include +#endif #include #include #if LLVM_MAJOR_VERSION >= 16 @@ -45,8 +46,18 @@ #include #include #include +#if LLVM_MAJOR_VERSION <= 16 #include -#include +#endif +#include +#include +#include + +#include +#include +#include +#include +#include #include "common.h" #include "bcc_debug.h" -- 2.34.1