Hi,
Configuring bpftrace-0.17.1 (GitHub - iovisor/bpftrace: High-level tracing language for Linux eBPF) during build phase failing in finding libbfd header file (bfd.h). bpftrace cmake structure is given below.
bpftrace-0.17.1
├── build
├── CMakeLists.txt
├── cmake
├── FindLibBfd.cmake
└── CHECK_CXX_SOURCE_COMPILES("
#include <string.h>
// See comment in bfd-disasm.cpp for why this needs to exist
#define PACKAGE \"bpftrace-test\"
#include <bfd.h>
#include <dis-asm.h>
int main(void) {
bfd *abfd = bfd_openr(NULL, NULL);
disassembler(bfd_get_arch(abfd),
bfd_big_endian(abfd),
bfd_get_mach(abfd),
abfd);
return 0;
}" LIBBFD_DISASM_FOUR_ARGS_SIGNATURE)
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_02d7a/fast && gmake[1]: Entering directory '
bpftrace-0.17.1/build/CMakeFiles/CMakeTmp'
/usr/bin/gmake -f CMakeFiles/cmTC_02d7a.dir/build.make CMakeFiles/cmTC_02d7a.dir/build
gmake[2]: Entering directory 'bpftrace-0.17.1/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_02d7a.dir/src.cxx.o
//bin/x86_64-ftnt-linux-gnu-g++ --sysroot=//x86_64-ftnt-linux-gnu/sysroot -DLIBBFD_DISASM_FOUR_ARGS_SIGNATURE -std=c++17 -o CMakeFiles/cmTC_02d7a.dir/src.cxx.o -c target/bpftrace-0.17.1/build/CMakeFiles/CMakeTmp/src.cxx
/bpftrace-0.17.1/build/CMakeFiles/CMakeTmp/src.cxx:5:10: fatal error: bfd.h: No such file or directory
5 | #include <bfd.h>
| ^~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/cmTC_02d7a.dir/build.make:78: CMakeFiles/cmTC_02d7a.dir/src.cxx.o] Error 1
bfd.h header is included on target include/bfd.h path but still FindLibBfd.cmake is failing to find it.
i passed bfd.h path to 'cmake ’ command during configure stage itself as given below.
cmake -DUSE_SYSTEM_BPF_BCC=1
-DLIBBFD_LIBRARIES="${TARGET_DESTDIR}/lib" \
-DLIBBFD_INCLUDE_DIRS="${TARGET_DESTDIR}/include" \
...
But still bfd.h path is not recognized in cmake/FindLibBfd.cmake file . configure stage log is given below.
===> begin compile bpftrace-0.17.1
....
-- Found LibBpf: /target/lib
-- Found LibCereal: /target/include/cereal
-- Found BISON: /bin/bison (found version "3.8.2")
...
-- Found LibBfd: /target/lib
-- Found LibOpcodes: /target/lib
-- Performing Test LIBBFD_DISASM_FOUR_ARGS_SIGNATURE
-- Performing Test LIBBFD_DISASM_FOUR_ARGS_SIGNATURE - Failed
...
Any input in towards this issue , please let me kow
Regards
Koti