Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ SHELL= /bin/sh -e
# Use this to make a link between python$(VERSION) and python in $(BINDIR)
LN= @LN@

# patchelf is used on Linux to set SONAME of libpython3.so for stable ABI
PATCHELF= @PATCHELF@

# Portable install script (configure doesn't always guess right)
INSTALL= @INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
Expand Down Expand Up @@ -1026,7 +1029,11 @@ libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACE_OBJS)
fi

libpython3.so: libpython$(LDVERSION).so
$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
if test -n "$(PATCHELF)"; then \
cp $^ $@ && $(PATCHELF) --set-soname $@ $@; \
else \
$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^; \
fi

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); \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix libpython3.so stable ABI on Linux
54 changes: 54 additions & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,17 @@ if test -z "$LN" ; then
esac
fi

# patchelf is required on Linux to set the SONAME of libpython3.so for stable ABI support
AC_SUBST([PATCHELF])
case $ac_sys_system in
Linux*)
AC_CHECK_PROG([PATCHELF], [patchelf], [patchelf], [])
if test -z "$PATCHELF"; then
AC_MSG_ERROR([patchelf is required on Linux for stable ABI support. Please install patchelf.])
fi
;;
esac

# For calculating the .so ABI tag.
AC_SUBST([ABIFLAGS])
AC_SUBST([ABI_THREAD])
Expand Down
Loading