Skip to content

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

Conversation

sangbida
Copy link
Collaborator

@sangbida sangbida commented Jul 29, 2025

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

DWARF format compatibility:

  • Force -gdwarf-4 instead of default DWARF 5 to avoid "DW_FORM_addrx value out of range" errors
  • Update the version of libbacktrace being used in core-lightning (see commit)

Changelog-added: libbacktrace works with macOS

Example stacktrace:

sangbida@Sangbidas-MacBook-Pro lightning % ./lightningd/lightningd
lightningd: FATAL SIGNAL 6 (version v25.05-62-g3622a81-modded)
0x102833dcb send_backtrace
        common/daemon.c:33
0x1028344db crashdump
        common/daemon.c:78
0x185a6f623 ???
        ???:0
0x185a3588b ???
        ???:0
0x18593ec5f ???
        ???:0
0x1027ae32b main
        lightningd/lightningd.c:1217
zsh: abort      ./lightningd/lightningd

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:

  • The changelog has been updated in the relevant commit(s) according to the guidelines.
  • Tests have been added or modified to reflect the changes.
  • Documentation has been reviewed and updated as needed.
  • Related issues have been listed and linked, including any that this PR closes.

@ddustin
Copy link
Collaborator

ddustin commented Aug 1, 2025

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
@sangbida sangbida force-pushed the fix-libbacktrace-macos branch from 0bdf81b to 00563e5 Compare August 3, 2025 05:58
@ddustin
Copy link
Collaborator

ddustin commented Aug 4, 2025

image Looks like its working for me! Awesome fix.

ACK 00563e5

@madelinevibes madelinevibes added the Status::Ready for Review The work has been completed and is now awaiting evaluation or approval. label Aug 6, 2025
@rustyrussell rustyrussell merged commit 9e55e8d into ElementsProject:master Aug 6, 2025
76 of 78 checks passed
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants