Page 1 of 1

[SOLVED] Does Mageia have a bpftrace tool?

PostPosted: Jun 6th, '21, 00:45
by alopez
I'm trying to install bpftrace but I only found the packages bpftool and bcc-tools. None of them includes bpftrace.

Is bpftrace in some other package, maybe with a less evident name? Or it is not at all available in Mageia?

Re: Does Mageia have a bpftrace tool?

PostPosted: Jun 6th, '21, 14:33
by doktor5000
No, it's not available. You could try the fedora packages.

Re: Does Mageia have a bpftrace tool?

PostPosted: Jun 6th, '21, 14:40
by alopez
Thanks. I'll do that.

Re: Does Mageia have a bpftrace tool?

PostPosted: Jun 6th, '21, 16:23
by alopez
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")

Re: [SOLVED] Does Mageia have a bpftrace tool?

PostPosted: Jun 6th, '21, 16:27
by morgano
Thank you for sharing the instruction.
Have you considered becoming a packager? :)

Re: [SOLVED] Does Mageia have a bpftrace tool?

PostPosted: Jun 6th, '21, 18:08
by alopez
For a moment it crossed my mind. I need to check how to become one.

Re: [SOLVED] Does Mageia have a bpftrace tool?

PostPosted: Jun 6th, '21, 20:11
by doktor5000

Re: [SOLVED] Does Mageia have a bpftrace tool?

PostPosted: Jun 6th, '21, 22:37
by alopez
Thanks. That's what Iḿ doing right now. :-)