Skip to content

Commit

Permalink
Trac #28317: Use -print-prog-name instead of -print-file-name in gcc …
Browse files Browse the repository at this point in the history
…spkg-configure.m4

Here's what I get

{{{
~/sage$ echo $CC
/projects/66d93023-00f0-4c12-8a25-5d6d4e486740/sage-
build/bin/x86_64-conda_cos6-linux-gnu-cc

~/sage$ $CC -print-prog-name=ld
/projects/66d93023-00f0-4c12-8a25-5d6d4e486740/sage-
build/bin/../lib/gcc/x86_64-conda_cos6-linux-
gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld

~/sage$ $CC -print-file-name=ld
ld

~/sage$ echo $LD
/projects/66d93023-00f0-4c12-8a25-5d6d4e486740/sage-
build/bin/x86_64-conda_cos6-linux-gnu-ld
}}}

Therefore `-print-file-name` is clearly not what we need.
`-print-prog-name` gives a path with `..`s in it.

We need to check that the two files are equivalent using -ef which
checks that the files are the same.

URL: https://trac.sagemath.org/28317
Reported by: isuruf
Ticket author(s): Isuru Fernando
Reviewer(s): Dima Pasechnik
  • Loading branch information
Release Manager committed Sep 4, 2019
2 parents 16c230b + dec073b commit 246658e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions build/pkgs/gcc/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -154,22 +154,21 @@ SAGE_SPKG_CONFIGURE_BASE([gcc], [
# Check that the assembler and linker used by $CXX match $AS and $LD.
# See http://trac.sagemath.org/sage_trac/ticket/14296
if test -n "$AS"; then
CXX_as=`$CXX -print-file-name=as 2>/dev/null`
CXX_as=`$CXX -print-prog-name=as 2>/dev/null`
CXX_as=`command -v $CXX_as 2>/dev/null`
cmd_AS=`command -v $AS`
if test "$CXX_as" != "" -a "$CXX_as" != "$cmd_AS"; then
if ! (test "$CXX_as" = "" -o "$CXX_as" -ef "$cmd_AS"); then
SAGE_SHOULD_INSTALL_GCC([there is a mismatch of assemblers])
AC_MSG_NOTICE([ $CXX uses $CXX_as])
AC_MSG_NOTICE([ \$AS equal to $AS])
fi
fi
if test -n "$LD"; then
CXX_ld=`$CXX -print-file-name=ld 2>/dev/null`
CXX_ld=`$CXX -print-prog-name=ld 2>/dev/null`
CXX_ld=`command -v $CXX_ld 2>/dev/null`
cmd_LD=`command -v $LD`
if test "$CXX_ld" != "" -a "$CXX_ld" != "$cmd_LD"; then
if ! (test "$CXX_ld" = "" -o "$CXX_ld" -ef "$cmd_LD"); then
SAGE_SHOULD_INSTALL_GCC([there is a mismatch of linkers])
AC_MSG_NOTICE([ $CXX uses $CXX_ld])
AC_MSG_NOTICE([ \$LD equal to $LD])
Expand Down

0 comments on commit 246658e

Please sign in to comment.