diff --git a/Makefile b/Makefile index 55a4ad8bb0bb..ab36d7b6db23 100644 --- a/Makefile +++ b/Makefile @@ -684,12 +684,18 @@ $(ALL_TEST_PROGRAMS) $(ALL_FUZZ_TARGETS): %: %.o # (as per EXTERNAL_LDLIBS) so we filter them out here. $(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS): @$(call VERBOSE, "ld $@", $(LINK.o) $(filter-out %.a,$^) $(LOADLIBES) $(EXTERNAL_LDLIBS) $(LDLIBS) libccan.a $($(@)_LDLIBS) -o $@) +ifeq ($(OS),Darwin) + @$(call VERBOSE, "dsymutil $@", dsymutil $@) +endif # We special case the fuzzing target binaries, as they need to link against libfuzzer, # which brings its own main(). FUZZ_LDFLAGS = -fsanitize=fuzzer $(ALL_FUZZ_TARGETS): @$(call VERBOSE, "ld $@", $(LINK.o) $(filter-out %.a,$^) $(LOADLIBES) $(EXTERNAL_LDLIBS) $(LDLIBS) libccan.a $(FUZZ_LDFLAGS) -o $@) +ifeq ($(OS),Darwin) + @$(call VERBOSE, "dsymutil $@", dsymutil $@) +endif # Everything depends on the CCAN headers, and Makefile @@ -819,6 +825,12 @@ install-program: installdirs $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS) $ @if [ -d "$(DESTDIR)$(plugindir)/wss-proxy" ]; then rm -rf $(DESTDIR)$(plugindir)/wss-proxy; fi [ -z "$(PLUGINS)" ] || $(INSTALL_PROGRAM) $(PLUGINS) $(DESTDIR)$(plugindir) 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 +ifeq ($(OS),Darwin) + # Install dSYM bundles alongside binaries on macOS + for BIN in $(BIN_PROGRAMS); do if [ -d $$BIN.dSYM ]; then cp -a $$BIN.dSYM $(DESTDIR)$(bindir)/; fi; done + for BIN in $(PKGLIBEXEC_PROGRAMS); do if [ -d $$BIN.dSYM ]; then cp -a $$BIN.dSYM $(DESTDIR)$(pkglibexecdir)/; fi; done + for PLUGIN in $(PLUGINS); do if [ -d $$PLUGIN.dSYM ]; then cp -a $$PLUGIN.dSYM $(DESTDIR)$(plugindir)/; fi; done +endif MAN1PAGES = $(filter %.1,$(MANPAGES)) MAN5PAGES = $(filter %.5,$(MANPAGES)) diff --git a/configure b/configure index c72981610b2a..015af842ddd0 100755 --- a/configure +++ b/configure @@ -148,7 +148,18 @@ set_defaults() # which matters since you might explicitly set of these blank. PREFIX=${PREFIX:-/usr/local} CC=${CC:-cc} - CDEBUGFLAGS=${CDEBUGFLAGS--std=gnu11 -g -fstack-protector-strong} + # Detect macOS and use appropriate debug flags for libbacktrace compatibility + if [ "$(uname -s)" = "Darwin" ]; then + # Always override to avoid DWARF 5 + CDEBUGFLAGS="-std=gnu11 -g -gdwarf-4 -fno-standalone-debug -fstack-protector-strong" + + # Optional: confirm dsymutil is available + if ! command -v dsymutil >/dev/null 2>&1; then + echo "Warning: dsymutil not found. Install Xcode Command Line Tools for better debug support." + fi + else + CDEBUGFLAGS=${CDEBUGFLAGS--std=gnu11 -g -fstack-protector-strong} + fi DEBUGBUILD=${DEBUGBUILD:-0} COMPAT=${COMPAT:-1} STATIC=${STATIC:-0} @@ -194,6 +205,9 @@ usage() usage_with_default "CWARNFLAGS" "$DEFAULT_CWARNFLAGS" usage_with_default "COPTFLAGS" "$DEFAULT_COPTFLAGS" usage_with_default "CDEBUGFLAGS" "$CDEBUGFLAGS" + if [ "$(uname -s)" = "Darwin" ]; then + echo " Note: On macOS, -g is used instead of -g3 for libbacktrace compatibility" + fi usage_with_default "CONFIGURATOR_CC" "${CONFIGURATOR_CC:-$CC}" echo " To override compile line for configurator itself" usage_with_default "PYTEST" "$PYTEST" diff --git a/external/libbacktrace b/external/libbacktrace index 2446c6607648..793921876c98 160000 --- a/external/libbacktrace +++ b/external/libbacktrace @@ -1 +1 @@ -Subproject commit 2446c66076480ce07a6bd868badcbceb3eeecc2e +Subproject commit 793921876c981ce49759114d7bb89bb89b2d3a2d