trace: make sys/sdt.h include optional#9886
Conversation
|
@mhgerlach30 is not a repository collaborator. To proceed:
|
|
Couldn't this silently ignore cases where some build infrastructure failed to install systemtap-sdt-dev? That's the point I realize, but silently stubbing out doesn't seem right to me. |
sys/sdt.h (SystemTap USDT) is not present in all Linux build environments, notably cross-compilation toolchains and embedded distributions that do not ship systemtap-sdt-dev. The unconditional include causes a build failure in those environments. Add a new option, XRT_ENABLE_USDT, that defaults to ON. Generate an error when XRT_ENABLE_USDT=ON, and the header file, sys/sdt.h, does not exist. When XRT_ENABLE_USDT=OFF, define no-op stubs for the four USDT macros used by XRT (STAP_PROBEV, DTRACE_PROBE, DTRACE_PROBE1, DTRACE_PROBE2). Signed-off-by: Matthew Gerlach <matthew@anodize.com>
31da04f to
31cf4ef
Compare
|
@mhgerlach30 is not a repository collaborator. To proceed:
|
Good point. The build will get a clear error message if systemtap-sdt-dev in not installed when XRT_ENABLE_USDT=ON. |
stsoe
left a comment
There was a problem hiding this comment.
Thank you. Looks good.
CI is broken currently so merge will be delayed.
Thank you for speedy responses. Is Xilinx/aiebu#314 something you can look at too? |
|
clang-tidy review says "All clean, LGTM! 👍" |
sys/sdt.h (SystemTap USDT) is not present in all Linux build environments, notably cross-compilation toolchains and embedded distributions that do not ship systemtap-sdt-dev. The unconditional include causes a build failure in those environments.
Use __has_include to make the inclusion conditional. When sys/sdt.h is unavailable, define no-op stubs for the four USDT macros used by XRT (STAP_PROBEV, DTRACE_PROBE, DTRACE_PROBE1, DTRACE_PROBE2) so that the tracing call sites compile without change.
Problem solved by the commit
Compilation errors in environments without sys/sdt.h
How problem was solved, alternative solutions (if any) and why they were rejected
Define no-op stubs for the four USDT macros used by XRT (STAP_PROBEV, DTRACE_PROBE, DTRACE_PROBE1, DTRACE_PROBE2).
What has been tested and how, request additional testing if necessary
Successfully compiled on Ubuntu 24.04 with and without systemtap-sdt-dev installed.
Documentation impact (if any)