Conversation
exception.hpp unconditionally did `#include <elfutils/libdwfl.h>`, which
makes the elfutils development headers a hard build requirement for every
consumer even though the library is already loaded at runtime via
`dlopen("libdw.so.1")`. On a machine with the libdw runtime but without
those headers -- stock Ubuntu 24.04 ships libdw1t64 but not libdw-dev --
no DeepJIT header compiles at all, including tests/test_exception.py.
Guard the include with __has_include and provide a no-op DwflApi when the
headers are absent, so backtraces fall back to the existing dladdr path.
Machines that have the headers are unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DeepJIT is header-only, and 17 of its 27 public headers transitively include
include/deep_jit/utils/exception.hpp. That file unconditionally did#include <elfutils/libdwfl.h>, so on a machine that has thelibdwruntime but not the elfutils development headers, no DeepJIT header compiles — includingtests/test_exception.py, the only test that does not need a GPU. Stock Ubuntu 24.04 is exactly that case:libdw1t64is installed,libdw-devis not, and the requirement is not mentioned anywhere in the README.Reproduction with the same flags as
validate_header_self_containmentintests/test_cuda.py(Ubuntu 24.04.4, g++ 14.4.0, nolibdw-dev):Sweeping
include/deep_jit/**/*.hpp(excludingbackend/ascend/) the same way, 13 headers fail on that single line.The library already treats
libdwas optional at runtime —DwflApi's constructor doesdlopen("libdw.so.1", RTLD_LAZY | RTLD_LOCAL)andvalid()gates every use of the loaded symbols. Only the header was an unconditional requirement.This makes the include conditional on
__has_includeand supplies a no-opDwflApiwhen the headers are absent, so backtraces fall back to the existingdladdrpath. The same sweep after the change:Backtraces on a header-less machine keep demangled function names and the
file:linein the panic message, and report??:0per frame.tests/test_exception.pyneeds no change — it still seespanic_leaf,panic_middle,panic_entryand.cpp:in the message. On a machine withlibdw-devthe guarded branch is byte-identical to before, so nothing changes there; I could not build that variant locally because installinglibdw-devrequires root.