bpo-45743: -Wl,-search_paths_first is no longer needed (GH-29464)

This commit is contained in:
Christian Heimes 2021-11-09 10:06:41 +02:00 committed by GitHub
parent cfc9154121
commit 8fefaad242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 80 deletions

View File

@ -0,0 +1,2 @@
On macOS, the build system no longer passes ``search_paths_first`` to the
linker. The flag has been the default since Xcode 4 / macOS 10.6.

16
configure vendored
View File

@ -12886,15 +12886,6 @@ $as_echo "#define HAVE_LCHFLAGS 1" >>confdefs.h
fi
# Check for compression libraries
case $ac_sys_system/$ac_sys_release in
Darwin/*)
_CUR_CFLAGS="${CFLAGS}"
_CUR_LDFLAGS="${LDFLAGS}"
CFLAGS="${CFLAGS} -Wl,-search_paths_first"
LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5
$as_echo_n "checking for inflateCopy in -lz... " >&6; }
if ${ac_cv_lib_z_inflateCopy+:} false; then :
@ -12938,13 +12929,6 @@ $as_echo "#define HAVE_ZLIB_COPY 1" >>confdefs.h
fi
case $ac_sys_system/$ac_sys_release in
Darwin/*)
CFLAGS="${_CUR_CFLAGS}"
LDFLAGS="${_CUR_LDFLAGS}"
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hstrerror" >&5

View File

@ -3833,34 +3833,8 @@ fi
# Check for compression libraries
dnl Check if system zlib has *Copy() functions
dnl
dnl On MacOSX the linker will search for dylibs on the entire linker path
dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
dnl to revert to a more traditional unix behaviour and make it possible to
dnl override the system libz with a local static library of libz. Temporarily
dnl add that flag to our CFLAGS as well to ensure that we check the version
dnl of libz that will be used by setup.py.
dnl The -L/usr/local/lib is needed as wel to get the same compilation
dnl environment as setup.py (and leaving it out can cause configure to use the
dnl wrong version of the library)
case $ac_sys_system/$ac_sys_release in
Darwin/*)
_CUR_CFLAGS="${CFLAGS}"
_CUR_LDFLAGS="${LDFLAGS}"
CFLAGS="${CFLAGS} -Wl,-search_paths_first"
LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
;;
esac
AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
case $ac_sys_system/$ac_sys_release in
Darwin/*)
CFLAGS="${_CUR_CFLAGS}"
LDFLAGS="${_CUR_LDFLAGS}"
;;
esac
PY_CHECK_FUNC([hstrerror], [#include <netdb.h>])
PY_CHECK_FUNC([inet_aton], [

View File

@ -1118,16 +1118,6 @@ class PyBuildExt(build_ext):
if find_file('readline/rlconf.h', self.inc_dirs, []) is None:
do_readline = False
if do_readline:
if MACOS and os_release < 9:
# In every directory on the search path search for a dynamic
# library and then a static library, instead of first looking
# for dynamic libraries on the entire path.
# This way a statically linked custom readline gets picked up
# before the (possibly broken) dynamic library in /usr/lib.
readline_extra_link_args = ('-Wl,-search_paths_first',)
else:
readline_extra_link_args = ()
readline_libs = [readline_lib]
if readline_termcap_library:
pass # Issue 7384: Already linked against curses or tinfo.
@ -1139,7 +1129,6 @@ class PyBuildExt(build_ext):
readline_libs.append('termcap')
self.add(Extension('readline', ['readline.c'],
library_dirs=['/usr/lib/termcap'],
extra_link_args=readline_extra_link_args,
libraries=readline_libs))
else:
self.missing.append('readline')
@ -1603,16 +1592,6 @@ class PyBuildExt(build_ext):
):
raise DistutilsError("System version of SQLite does not support loadable extensions")
if MACOS:
# In every directory on the search path search for a dynamic
# library and then a static library, instead of first looking
# for dynamic libraries on the entire path.
# This way a statically linked custom sqlite gets picked up
# before the dynamic library in /usr/lib.
sqlite_extra_link_args = ('-Wl,-search_paths_first',)
else:
sqlite_extra_link_args = ()
include_dirs = ["Modules/_sqlite"]
# Only include the directory where sqlite was found if it does
# not already exist in set include directories, otherwise you
@ -1626,7 +1605,6 @@ class PyBuildExt(build_ext):
define_macros=sqlite_defines,
include_dirs=include_dirs,
library_dirs=sqlite_libdir,
extra_link_args=sqlite_extra_link_args,
libraries=["sqlite3",]))
else:
self.missing.append('_sqlite3')
@ -1685,13 +1663,8 @@ class PyBuildExt(build_ext):
break
if version >= version_req:
if (self.compiler.find_library_file(self.lib_dirs, 'z')):
if MACOS:
zlib_extra_link_args = ('-Wl,-search_paths_first',)
else:
zlib_extra_link_args = ()
self.add(Extension('zlib', ['zlibmodule.c'],
libraries=['z'],
extra_link_args=zlib_extra_link_args))
libraries=['z']))
have_zlib = True
else:
self.missing.append('zlib')
@ -1706,24 +1679,16 @@ class PyBuildExt(build_ext):
if have_zlib:
extra_compile_args.append('-DUSE_ZLIB_CRC32')
libraries = ['z']
extra_link_args = zlib_extra_link_args
else:
libraries = []
extra_link_args = []
self.add(Extension('binascii', ['binascii.c'],
extra_compile_args=extra_compile_args,
libraries=libraries,
extra_link_args=extra_link_args))
libraries=libraries))
# Gustavo Niemeyer's bz2 module.
if (self.compiler.find_library_file(self.lib_dirs, 'bz2')):
if MACOS:
bz2_extra_link_args = ('-Wl,-search_paths_first',)
else:
bz2_extra_link_args = ()
self.add(Extension('_bz2', ['_bz2module.c'],
libraries=['bz2'],
extra_link_args=bz2_extra_link_args))
libraries=['bz2']))
else:
self.missing.append('_bz2')