I finally decided to build bpftrace instead of using Fedora's package because it depends on packages that don't have the same name in Mageia.
So this is how I did:
- Code: Select all
dnf install lib64bcc-devel lib64elfutils-devel cmake bison flex systemtap-sdt-devel binutils-devel
git clone https://github.com/iovisor/bpftrace
cd bpftrace
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DENABLE_TEST_VALIDATE_CODEGEN=OFF -DLIBBFD_DISASM_FOUR_ARGS_SIGNATURE=y ..
make -j8
sudo make install
bpftrace will be installed in /usr/local. To change the destination, use -DCMAKE_INSTALL_PREFIX=<destination> in cmake.
If during make you get this error:
- Code: Select all
[ 98%] Linking CXX executable bpftrace
/usr/bin/ld: /usr/lib64/libbfd.a(plugin.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib64/libdl.so.2: error al añadir símbolos: DSO faltante desde línea de orden
collect2: error: ld devolvió el estado de salida 1
make[2]: *** [src/CMakeFiles/bpftrace.dir/build.make:115: src/bpftrace] Error 1
make[1]: *** [CMakeFiles/Makefile2:438: src/CMakeFiles/bpftrace.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
Apply this patch:
- Code: Select all
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a32b5f5..7313c80 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -47,7 +47,7 @@ add_executable(${BPFTRACE}
)
install(TARGETS ${BPFTRACE} DESTINATION ${CMAKE_INSTALL_BINDIR})
-target_link_libraries(${BPFTRACE} libbpftrace)
+target_link_libraries(${BPFTRACE} libbpftrace ${CMAKE_DL_LIBS})
if (BUILD_FUZZ)
target_compile_options(${BPFTRACE} PUBLIC "-DFUZZ")