-
Notifications
You must be signed in to change notification settings - Fork 971
configure: Add macOS-specific debug flags for libbacktrace compatibility #8431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rustyrussell
merged 2 commits into
ElementsProject:master
from
sangbida:fix-libbacktrace-macos
Aug 6, 2025
Merged
configure: Add macOS-specific debug flags for libbacktrace compatibility #8431
rustyrussell
merged 2 commits into
ElementsProject:master
from
sangbida:fix-libbacktrace-macos
Aug 6, 2025
Conversation
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
Collaborator
|
Amazing! |
…lity On macOS, libbacktrace was failing to find debug information due to: 1. Debug symbols not being properly linked with dsymutil 2. Apple Clang 17.0.0 generating DWARF 5 which libbacktrace couldn't parse In this commit we address both issues: Debug symbol accessibility: - Add dsymutil integration in Makefile to properly link debug symbols - Use -fno-standalone-debug to embed debug info inline in executable DWARF format compatibility: - Force -gdwarf-4 instead of default DWARF 5 to avoid "DW_FORM_addrx value out of range" errors Changelog-added: libbacktrace works with macOS
When installing core lightning on macOS I found that the debug symbols were not being preserved leading to "no debug info in Mach-O executable". This is because the .dSYM files, which contain the debug information, is generated in the build directory and could not be found by the installed binaries. Changes: - Add -fno-standalone-debug flag to CDEBUGFLAGS on macOS to reduce dependency on absolute source paths - Modify install-program target to copy .dSYM bundles alongside binaries for BIN_PROGRAMS, PKGLIBEXEC_PROGRAMS, and PLUGINS Testing: 1. ./configure --reconfigure 2. make install PREFIX=/tmp/lightning-install 3. make clean (removes all .dSYM files from build directory) 4. /tmp/lightning-install/bin/lightningd --help 5. Verified stack traces now work correctly without "no debug info" errors
0bdf81b to
00563e5
Compare
Collaborator
Looks like its working for me! Awesome fix.
ACK 00563e5 |
PastaPastaPasta
added a commit
to dashpay/dash
that referenced
this pull request
Nov 14, 2025
… make detection more robust, refactor and add platform-specific checks, add linker and compiler flags 0d1d6d3 fix: resolve compile errors in `stacktraces.cpp` on Windows (Kittywhiskers Van Gogh) 2699740 fix: use `-fno-standalone-debug` on macOS, `-gdwarf-4` on non-Windows (Kittywhiskers Van Gogh) c5c8baf fix: set `-export-dynamic` to ensure symbols are preserved (Kittywhiskers Van Gogh) fc77534 build: if enabling stacktraces, search for `libexecinfo` on BSDs (Kittywhiskers Van Gogh) 9998bf6 fix: improve libbacktrace detection (Kittywhiskers Van Gogh) bc762cc build: move `BACKTRACE_LIBS` determination to `configure.ac` (Kittywhiskers Van Gogh) b73deae build: s/BACKTRACE_LIB/BACKTRACE_LIBS/g (Kittywhiskers Van Gogh) e41899e refactor: consolidate enhanced debugging logic (Kittywhiskers Van Gogh) 046d87a depends: ianlancetaylor/libbacktrace@b9e40069c0 (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * ianlancetaylor/libbacktrace@b9e40069c0 includes fixes relevant to us, specifically [`3fda5a87`](ianlancetaylor/libbacktrace@3fda5a8), [`d48f8403`](ianlancetaylor/libbacktrace@d48f840) as they relate to handling of Mach-O * On BSDs, `libexecinfo` ([source](https://www.freshports.org/devel/libexecinfo)) is a distinct library (unlike Linux, where it is bundled as part of `glibc`) that needs to be obtained in order for stacktraces to work, we will now explicitly specify we want to link against this dependency when we configure the build. * `libbacktrace` is known to have issues with DWARF 5 parsing (see [ianlancetaylor/libbacktrace#158](ianlancetaylor/libbacktrace#158)) and we are therefore adapting the fix implemented in [ElementsProject/lightning#8431](ElementsProject/lightning#8431) to ensure that we emit DWARF 4 binaries that should work with `libbacktrace`. * It appears that until this PR, some portions of our stacktrace code weren't being built on Windows which revealed some compile errors ([build](https://github.com/dashpay/dash/actions/runs/19303109295/job/55206686088#step:8:1806)), they have been resolved in a separate commit. * We need to make sure that we build with `-export-dynamic` (or `-rdynamic` on certain compilers, [source](https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html)) to ensure symbol data is preserved for generating backtraces. ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK 0d1d6d3 UdjinM6: utACK 0d1d6d3 Tree-SHA512: 02aa71e3a8aae0bddf677fd71319356090a6f97b036e079631dce58a8ba52d6d4971c8f33aaf43fdae35df36cfd3475dda9bba64df81ef579596797c8f6a1d7d
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Status::Ready for Review
The work has been completed and is now awaiting evaluation or approval.
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.

On macOS, libbacktrace was failing to find debug information due to:
In this commit we address both issues:
Debug symbol accessibility:
DWARF format compatibility:
Changelog-added: libbacktrace works with macOS
Example stacktrace:
Important
25.09 FREEZE July 28TH: Non-bugfix PRs not ready by this date will wait for 25.12.
RC1 is scheduled on August 11th
The final release is scheduled for September 1st.
Checklist
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked: