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 <llvm-c/Transforms/IPO.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/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 <llvm/Transforms/IPO/PassManagerBuilder.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 <yhs@fb.com>
#include <vector>
#include <set>
#include <linux/bpf.h>
-#include <net/if.h>
-
+#if LLVM_MAJOR_VERSION <= 16
+#include <llvm-c/Transforms/IPO.h>
+#endif
#include <llvm/ExecutionEngine/MCJIT.h>
#include <llvm/ExecutionEngine/SectionMemoryManager.h>
#if LLVM_MAJOR_VERSION >= 16
#include <llvm/IR/Verifier.h>
#include <llvm/Support/TargetSelect.h>
#include <llvm/Transforms/IPO.h>
+#if LLVM_MAJOR_VERSION <= 16
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
-#include <llvm-c/Transforms/IPO.h>
+#endif
+#include <net/if.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <map>
+#include <set>
+#include <string>
+#include <iostream>
+#include <vector>
#include "common.h"
#include "bcc_debug.h"