Skip to content
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

OS X: do not use -ld_classic #38931

Merged
merged 2 commits into from
Nov 16, 2024
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
7 changes: 5 additions & 2 deletions src/bin/sage-env
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,15 @@ if [ -n "$SAGE_LOCAL" ]; then
# "Toolchains/XcodeDefault.xctoolchain/usr/bin/". (See #37237.)
if [ -z "$LD" ]; then
# Running xcode-select on a system with no toolchain writes an
# error message to stderr, so redirect stderr to /dev/null.
# error message to stderr, so redirect stderr to /dev/null.
XCODE_PATH=$(/usr/bin/xcode-select -p 2> /dev/null)
if [ -n $XCODE_PATH ]; then
if [ -x "$XCODE_PATH/usr/bin/ld-classic" -o \
-x "$XCODE_PATH/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-classic" ]; then
LDFLAGS="$LDFLAGS -Wl,-ld_classic"
# Add -ld_classic only if -ld_classic is not deprecated.
if [ -z "$(ld -ld_classic 2>&1 | grep 'ld_classic is deprecated')" ]; then
LDFLAGS="$LDFLAGS -Wl,-ld_classic"
fi
fi
else
# On a macOS system with no toolchain we don't want this script
Expand Down
15 changes: 15 additions & 0 deletions src/sage/doctest/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,21 @@
pythran_numpy_warning_regex = re.compile(r'WARNING: Overriding pythran description with argspec information for: numpy\.random\.[a-z_]+')
got = pythran_numpy_warning_regex.sub('', got)
did_fixup = True

if "ld_classic is deprecated" in got:
# New warnings as of Oct '24, Xcode 16.
ld_warn_regex = re.compile("ld: warning: -ld_classic is deprecated and will be removed in a future release")
got = ld_warn_regex.sub('', got)
did_fixup = True

Check warning on line 1524 in src/sage/doctest/parsing.py

View check run for this annotation

Codecov / codecov/patch

src/sage/doctest/parsing.py#L1522-L1524

Added lines #L1522 - L1524 were not covered by tests

if "duplicate libraries" in got:
# New warnings as of Sept '23, OS X 13.6, new command-line
# tools. In particular, these seem to come from ld in
# Xcode 15.
dup_lib_regex = re.compile("ld: warning: ignoring duplicate libraries: .*")
got = dup_lib_regex.sub('', got)
did_fixup = True

Check warning on line 1532 in src/sage/doctest/parsing.py

View check run for this annotation

Codecov / codecov/patch

src/sage/doctest/parsing.py#L1530-L1532

Added lines #L1530 - L1532 were not covered by tests

return did_fixup, want, got

def output_difference(self, example, got, optionflags):
Expand Down
11 changes: 10 additions & 1 deletion src/sage/tests/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,4 +776,13 @@ def test_executable(args, input='', timeout=100.0, pydebug_ignore_warnings=False
p.stderr.close()
err.append(s)

return (''.join(out), ''.join(err), p.wait())
# In case out or err contains a quoted string, force the use of
# double quotes so that the output is enclosed in single
# quotes. This avoids some doctest failures with some versions of
# OS X and Xcode.
out = ''.join(out)
out = out.replace("'", '"')
err = ''.join(err)
err = err.replace("'", '"')

return (out, err, p.wait())
Loading