bpftrace BEGIN trigger not working because of missing BEING_trigger symbol
I tried using one of the examples in bpftrace-tools which almost have a BEGIN statement... This can be trimmed down to:
alpine:~# bpftrace -e 'BEGIN { printf("hello world\n"); }'
Attaching 1 probe...
Could not resolve symbol: /proc/self/exe:BEGIN_trigger
Others had the problem on other distros: https://github.com/iovisor/bpftrace/issues/954
TL;DR: we need to call strip with strip --keep-symbol BEGIN_trigger
because bpftrace sets a probe on itself to start probing and needs the symbol for that; the closest way I can see to do that with abuild would be options="!strip"
and calling strip ourselves in the build process? I can open a MR for that if acceptable.
Cc @mpolanski as the one who have done recent updates.
(Semi-unrelated: Note that for bpftrace to be more easily usable having CONFIG_IKHEADERS for the kernel might make sense, but kernel probles work when installing the proper linux-*-dev package (e.g. linux-virt-dev for VMs); the error is far from obvious though as it finds uapi headers with same name so just complains of missing types e.g. error: unknown type name 's64'
and nothing about missing files :/ Well, that works once requirements are figured out, I guess CONFIG_IKHEADERS is just a waste of space from a distro's point of view)