Built-in BEGIN bpftrace event is broken. Reproducible: Always Steps to Reproduce: 1. bpftrace -e 'BEGIN { @++ }' Actual Results: Attaching 1 probe... ERROR: Could not resolve symbol: /proc/self/exe:BEGIN_trigger This is bug 754648 again, except RESTRICT=strip no longer helps for some reason. Maybe see bug 754648 comment 4
(In reply to WGH from comment #0) > Built-in BEGIN bpftrace event is broken. > > Reproducible: Always > > Steps to Reproduce: > 1. bpftrace -e 'BEGIN { @++ }' > Actual Results: > Attaching 1 probe... > ERROR: Could not resolve symbol: /proc/self/exe:BEGIN_trigger > > > This is bug 754648 again, except RESTRICT=strip no longer helps for some > reason. Maybe see bug 754648 comment 4 i can acknowledge this. i recompiled kernel mutiple times with different debug settings. i compiled bpftrace with -g with split with nosplit etc etc etc bpftrace do not work on gentoo. i always get = ERROR: Could not resolve symbol: /proc/self/exe:BEGIN_trigger on debian i get same error. BUT; after "apt install bpftrace-debugsysmbols" it works !
Does this help (I haven't been able to reproduce this locally): diff --git a/dev-util/bpftrace/bpftrace-0.14.0-r2.ebuild b/dev-util/bpftrace/bpftrace-0.14.0-r2.ebuild index 483f341c490..579122a8090 100644 --- a/dev-util/bpftrace/bpftrace-0.14.0-r2.ebuild +++ b/dev-util/bpftrace/bpftrace-0.14.0-r2.ebuild @@ -94,5 +94,6 @@ src_configure() { src_install() { cmake_src_install + dostrip -x /usr/bin/bpftrace doman man/man8/*.? }
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e576dd19c0e1bdc56ad8e9f356490f456f8dc604 commit e576dd19c0e1bdc56ad8e9f356490f456f8dc604 Author: Jakov Smolić <jsmolic@gentoo.org> AuthorDate: 2021-11-07 20:58:15 +0000 Commit: Jakov Smolić <jsmolic@gentoo.org> CommitDate: 2021-11-07 20:58:39 +0000 dev-util/bpftrace: Statically link (partially), avoid stripping bpftrace bpftrace is currently broken due to BEGIN_trigger symbol missing. To fix this, we need to avoid stripping the binary since it clearly needs to have symbols to work properly, and we also need to link some of the libraries statically into the binary, namely some internal libraries provided by bpftrace need to be statically linked, otherwise the binary will still end up missing the needed symbol (upstream issue - https://github.com/iovisor/bpftrace/issues/954). For previous versions it was enough to skip stripping the binary, but BEGIN_trigger symbol was moved to libbpftrace several versions ago, so even if it is present as a .so library the symbol won't be found. Closes: https://bugs.gentoo.org/809362 Signed-off-by: Jakov Smolić <jsmolic@gentoo.org> dev-util/bpftrace/bpftrace-0.14.0-r3.ebuild | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)