From b76620c856fbff0d8716540520aafeb6627c9b01 Mon Sep 17 00:00:00 2001 From: Gouri Jain Date: Wed, 25 Feb 2026 12:40:33 +0530 Subject: [PATCH] gh-144942: Fix macOS dylib build by adding $(MODLIBS) and removing -undefined dynamic_lookup --- Makefile.pre.in | 2 +- .../next/macOS/2026-02-25-07-20-00.gh-issue-144942.H7g6F5.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/macOS/2026-02-25-07-20-00.gh-issue-144942.H7g6F5.rst diff --git a/Makefile.pre.in b/Makefile.pre.in index 122957dec29b6f..9baca83ab0c46b 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1034,7 +1034,7 @@ libpython3.so: libpython$(LDVERSION).so $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^ libpython$(LDVERSION).dylib: $(LIBRARY_OBJS) - $(CC) -dynamiclib $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \ + $(CC) -dynamiclib $(PY_CORE_LDFLAGS) -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \ libpython$(VERSION).sl: $(LIBRARY_OBJS) diff --git a/Misc/NEWS.d/next/macOS/2026-02-25-07-20-00.gh-issue-144942.H7g6F5.rst b/Misc/NEWS.d/next/macOS/2026-02-25-07-20-00.gh-issue-144942.H7g6F5.rst new file mode 100644 index 00000000000000..07fe59e499e8f9 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2026-02-25-07-20-00.gh-issue-144942.H7g6F5.rst @@ -0,0 +1 @@ +Correctly link with $(MODLIBS) when building the macOS dylib and remove the -undefined dynamic_lookup linker flag.