Skip to content

Commit 8fefaad

Browse files
authored
bpo-45743: -Wl,-search_paths_first is no longer needed (GH-29464)
1 parent cfc9154 commit 8fefaad

File tree

4 files changed

+5
-80
lines changed

4 files changed

+5
-80
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
On macOS, the build system no longer passes ``search_paths_first`` to the
2+
linker. The flag has been the default since Xcode 4 / macOS 10.6.

Diff for: configure

-16
Original file line numberDiff line numberDiff line change
@@ -12886,15 +12886,6 @@ $as_echo "#define HAVE_LCHFLAGS 1" >>confdefs.h
1288612886
fi
1288712887

1288812888
# Check for compression libraries
12889-
case $ac_sys_system/$ac_sys_release in
12890-
Darwin/*)
12891-
_CUR_CFLAGS="${CFLAGS}"
12892-
_CUR_LDFLAGS="${LDFLAGS}"
12893-
CFLAGS="${CFLAGS} -Wl,-search_paths_first"
12894-
LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
12895-
;;
12896-
esac
12897-
1289812889
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5
1289912890
$as_echo_n "checking for inflateCopy in -lz... " >&6; }
1290012891
if ${ac_cv_lib_z_inflateCopy+:} false; then :
@@ -12938,13 +12929,6 @@ $as_echo "#define HAVE_ZLIB_COPY 1" >>confdefs.h
1293812929
fi
1293912930

1294012931

12941-
case $ac_sys_system/$ac_sys_release in
12942-
Darwin/*)
12943-
CFLAGS="${_CUR_CFLAGS}"
12944-
LDFLAGS="${_CUR_LDFLAGS}"
12945-
;;
12946-
esac
12947-
1294812932

1294912933

1295012934
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hstrerror" >&5

Diff for: configure.ac

-26
Original file line numberDiff line numberDiff line change
@@ -3833,34 +3833,8 @@ fi
38333833

38343834
# Check for compression libraries
38353835
dnl Check if system zlib has *Copy() functions
3836-
dnl
3837-
dnl On MacOSX the linker will search for dylibs on the entire linker path
3838-
dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
3839-
dnl to revert to a more traditional unix behaviour and make it possible to
3840-
dnl override the system libz with a local static library of libz. Temporarily
3841-
dnl add that flag to our CFLAGS as well to ensure that we check the version
3842-
dnl of libz that will be used by setup.py.
3843-
dnl The -L/usr/local/lib is needed as wel to get the same compilation
3844-
dnl environment as setup.py (and leaving it out can cause configure to use the
3845-
dnl wrong version of the library)
3846-
case $ac_sys_system/$ac_sys_release in
3847-
Darwin/*)
3848-
_CUR_CFLAGS="${CFLAGS}"
3849-
_CUR_LDFLAGS="${LDFLAGS}"
3850-
CFLAGS="${CFLAGS} -Wl,-search_paths_first"
3851-
LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
3852-
;;
3853-
esac
3854-
38553836
AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
38563837

3857-
case $ac_sys_system/$ac_sys_release in
3858-
Darwin/*)
3859-
CFLAGS="${_CUR_CFLAGS}"
3860-
LDFLAGS="${_CUR_LDFLAGS}"
3861-
;;
3862-
esac
3863-
38643838
PY_CHECK_FUNC([hstrerror], [#include <netdb.h>])
38653839

38663840
PY_CHECK_FUNC([inet_aton], [

Diff for: setup.py

+3-38
Original file line numberDiff line numberDiff line change
@@ -1118,16 +1118,6 @@ def detect_readline_curses(self):
11181118
if find_file('readline/rlconf.h', self.inc_dirs, []) is None:
11191119
do_readline = False
11201120
if do_readline:
1121-
if MACOS and os_release < 9:
1122-
# In every directory on the search path search for a dynamic
1123-
# library and then a static library, instead of first looking
1124-
# for dynamic libraries on the entire path.
1125-
# This way a statically linked custom readline gets picked up
1126-
# before the (possibly broken) dynamic library in /usr/lib.
1127-
readline_extra_link_args = ('-Wl,-search_paths_first',)
1128-
else:
1129-
readline_extra_link_args = ()
1130-
11311121
readline_libs = [readline_lib]
11321122
if readline_termcap_library:
11331123
pass # Issue 7384: Already linked against curses or tinfo.
@@ -1139,7 +1129,6 @@ def detect_readline_curses(self):
11391129
readline_libs.append('termcap')
11401130
self.add(Extension('readline', ['readline.c'],
11411131
library_dirs=['/usr/lib/termcap'],
1142-
extra_link_args=readline_extra_link_args,
11431132
libraries=readline_libs))
11441133
else:
11451134
self.missing.append('readline')
@@ -1603,16 +1592,6 @@ def detect_sqlite(self):
16031592
):
16041593
raise DistutilsError("System version of SQLite does not support loadable extensions")
16051594

1606-
if MACOS:
1607-
# In every directory on the search path search for a dynamic
1608-
# library and then a static library, instead of first looking
1609-
# for dynamic libraries on the entire path.
1610-
# This way a statically linked custom sqlite gets picked up
1611-
# before the dynamic library in /usr/lib.
1612-
sqlite_extra_link_args = ('-Wl,-search_paths_first',)
1613-
else:
1614-
sqlite_extra_link_args = ()
1615-
16161595
include_dirs = ["Modules/_sqlite"]
16171596
# Only include the directory where sqlite was found if it does
16181597
# not already exist in set include directories, otherwise you
@@ -1626,7 +1605,6 @@ def detect_sqlite(self):
16261605
define_macros=sqlite_defines,
16271606
include_dirs=include_dirs,
16281607
library_dirs=sqlite_libdir,
1629-
extra_link_args=sqlite_extra_link_args,
16301608
libraries=["sqlite3",]))
16311609
else:
16321610
self.missing.append('_sqlite3')
@@ -1685,13 +1663,8 @@ def detect_compress_exts(self):
16851663
break
16861664
if version >= version_req:
16871665
if (self.compiler.find_library_file(self.lib_dirs, 'z')):
1688-
if MACOS:
1689-
zlib_extra_link_args = ('-Wl,-search_paths_first',)
1690-
else:
1691-
zlib_extra_link_args = ()
16921666
self.add(Extension('zlib', ['zlibmodule.c'],
1693-
libraries=['z'],
1694-
extra_link_args=zlib_extra_link_args))
1667+
libraries=['z']))
16951668
have_zlib = True
16961669
else:
16971670
self.missing.append('zlib')
@@ -1706,24 +1679,16 @@ def detect_compress_exts(self):
17061679
if have_zlib:
17071680
extra_compile_args.append('-DUSE_ZLIB_CRC32')
17081681
libraries = ['z']
1709-
extra_link_args = zlib_extra_link_args
17101682
else:
17111683
libraries = []
1712-
extra_link_args = []
17131684
self.add(Extension('binascii', ['binascii.c'],
17141685
extra_compile_args=extra_compile_args,
1715-
libraries=libraries,
1716-
extra_link_args=extra_link_args))
1686+
libraries=libraries))
17171687

17181688
# Gustavo Niemeyer's bz2 module.
17191689
if (self.compiler.find_library_file(self.lib_dirs, 'bz2')):
1720-
if MACOS:
1721-
bz2_extra_link_args = ('-Wl,-search_paths_first',)
1722-
else:
1723-
bz2_extra_link_args = ()
17241690
self.add(Extension('_bz2', ['_bz2module.c'],
1725-
libraries=['bz2'],
1726-
extra_link_args=bz2_extra_link_args))
1691+
libraries=['bz2']))
17271692
else:
17281693
self.missing.append('_bz2')
17291694

0 commit comments

Comments
 (0)