Skip to content

Commit bc99705

Browse files
author
Matthias Koeppe
committed
src/bin/sage-env [macOS]: Detect ld-classic when full XCode is in use
1 parent a8f57e7 commit bc99705

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bin/sage-env

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,12 @@ if [ -n "$SAGE_LOCAL" ]; then
373373
# On OS X, test whether "ld-classic" is present in the installed
374374
# version of the command-line tools. If so, we add "-ld_classic"
375375
# to LD_FLAGS. See #36599.
376-
if [ "$UNAME" = "Darwin" ] && [ -x "$(xcode-select -p)/usr/bin/ld-classic" ] ; then
376+
# When the full XCode is installed and in use, for example after
377+
# "sudo xcode-select -s /Applications/Xcode.app", then "xcode-select -p"
378+
# gives "/Applications/Xcode.app/Contents/Developer", but "ld-classic"
379+
# is not in the subdirectory "usr/bin/" but rather in the subdirectory
380+
# "Toolchains/XcodeDefault.xctoolchain/usr/bin/". See #37237.
381+
if [ "$UNAME" = "Darwin" ] && [ -x "$(xcode-select -p)/usr/bin/ld-classic" -o -x "$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-classic" ] ; then
377382
LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-ld_classic,-rpath,$SAGE_LOCAL/lib $LDFLAGS"
378383
else
379384
LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-rpath,$SAGE_LOCAL/lib $LDFLAGS"

0 commit comments

Comments
 (0)