Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2021
Merged
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
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 16 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -13033,15 +13033,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 :
Expand Down Expand Up @@ -13085,13 +13076,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
Expand Down
26 changes: 0 additions & 26 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3946,34 +3946,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], [
Expand Down
41 changes: 3 additions & 38 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1118,16 +1118,6 @@ def detect_readline_curses(self):
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.
Expand All @@ -1139,7 +1129,6 @@ def detect_readline_curses(self):
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')
Expand Down Expand Up @@ -1609,16 +1598,6 @@ def detect_sqlite(self):
):
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
Expand All @@ -1632,7 +1611,6 @@ def detect_sqlite(self):
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')
Expand Down Expand Up @@ -1691,13 +1669,8 @@ def detect_compress_exts(self):
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')
Expand All @@ -1712,24 +1685,16 @@ def detect_compress_exts(self):
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')

Expand Down