Repository navigation
Include <execinfo.h> only where backtrace() is used - #1554
Merged
Merged
Conversation
Utils.hpp included <execinfo.h> on every non-Android __unix__ target, but only print_backtrace() in Utils.cpp needs it, and only under USE_BACKTRACE. musl (Alpine Linux) does not provide the header, so the SDK failed to compile there. This also breaks ONNX Runtime builds on Alpine, which build the SDK by default since 1DS became their telemetry backend (microsoft/onnxruntime#33827).
Contributor
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change addressing compilation failures on musl-based systems.
No open issues 🎉
What changed in this PR
Removes the SDK’s dependency on <execinfo.h> for regular builds, addressing the reported compilation failure on musl-based systems such as Alpine Linux.
Changes:
- Removes
<execinfo.h>from the shared utility header. - Includes it in
Utils.cpponly whenUSE_BACKTRACEand__unix__are defined.
| File | Description |
|---|---|
lib/utils/Utils.hpp |
Removes the transitive dependency on <execinfo.h>. |
lib/utils/Utils.cpp |
Places the include alongside its backtrace usage, under the matching condition. |
Review effort: Balanced
bmehta001
approved these changes
Nov 5, 2026
bmehta001
enabled auto-merge (squash)
November 5, 2026 05:58
Contributor
|
Evstifeev Mikhail (@mievst) Thank you for identifying the problem and creating a fix. I will try to get this into a new release for ORT ASAP |
7 tasks
Contributor
Author
|
Thanks for the quick review! |
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.
lib/utils/Utils.hppincludes<execinfo.h>on every non-Android__unix__target. The header is glibc-specific and musl (Alpine Linux) does not provide it, so the SDK fails to compile there:The only user of the header is
print_backtrace()inlib/utils/Utils.cpp, and only underUSE_BACKTRACE. This change moves the include there, under the same condition. Builds withoutUSE_BACKTRACE(all regular builds) no longer depend on the header.This breaks ONNX Runtime builds on Alpine, which build the SDK by default since 1DS became their telemetry backend: microsoft/onnxruntime#33827.
Tested:
libmat.alinks, the Python wheel runs a model. Without the change it fails with the error above.mainwith this change on Debian 13 (gcc 14.2.0, glibc 2.41):matbuilds.Note, not changed here: with
-DUSE_BACKTRACEon GCCprint_backtrace()does not compile, with or without this change.mat_demangleis the identity macro there (_CPPRTTIis MSVC-only), somat_demangle(strings[i]).c_str()is called on achar*.