Skip to content

Commit 00563e5

Browse files
committed
configure: Fix debug symbols for installed binaries on 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
1 parent dbc3bbc commit 00563e5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,12 @@ install-program: installdirs $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS) $
825825
@if [ -d "$(DESTDIR)$(plugindir)/wss-proxy" ]; then rm -rf $(DESTDIR)$(plugindir)/wss-proxy; fi
826826
[ -z "$(PLUGINS)" ] || $(INSTALL_PROGRAM) $(PLUGINS) $(DESTDIR)$(plugindir)
827827
for PY in $(PY_PLUGINS); do DIR=`dirname $$PY`; DST=$(DESTDIR)$(plugindir)/`basename $$DIR`; if [ -d $$DST ]; then rm -rf $$DST; fi; $(INSTALL_PROGRAM) -d $$DIR; cp -a $$DIR $$DST ; done
828+
ifeq ($(OS),Darwin)
829+
# Install dSYM bundles alongside binaries on macOS
830+
for BIN in $(BIN_PROGRAMS); do if [ -d $$BIN.dSYM ]; then cp -a $$BIN.dSYM $(DESTDIR)$(bindir)/; fi; done
831+
for BIN in $(PKGLIBEXEC_PROGRAMS); do if [ -d $$BIN.dSYM ]; then cp -a $$BIN.dSYM $(DESTDIR)$(pkglibexecdir)/; fi; done
832+
for PLUGIN in $(PLUGINS); do if [ -d $$PLUGIN.dSYM ]; then cp -a $$PLUGIN.dSYM $(DESTDIR)$(plugindir)/; fi; done
833+
endif
828834

829835
MAN1PAGES = $(filter %.1,$(MANPAGES))
830836
MAN5PAGES = $(filter %.5,$(MANPAGES))

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ set_defaults()
151151
# Detect macOS and use appropriate debug flags for libbacktrace compatibility
152152
if [ "$(uname -s)" = "Darwin" ]; then
153153
# Always override to avoid DWARF 5
154-
CDEBUGFLAGS="-std=gnu11 -g -gdwarf-4 -fstack-protector-strong"
154+
CDEBUGFLAGS="-std=gnu11 -g -gdwarf-4 -fno-standalone-debug -fstack-protector-strong"
155155

156156
# Optional: confirm dsymutil is available
157157
if ! command -v dsymutil >/dev/null 2>&1; then

0 commit comments

Comments
 (0)