Skip to content

Commit 584a28a

Browse files
Release Managervbraun
Release Manager
authored andcommitted
Trac #16149: sage-env exports empty CXXFLAGS
That happens if `CFLAGS` are empty (or not exported at all, which presumably is the most frequent case) and `CXXFLAGS` aren't either: {{{ #!sh if [ "$CXXFLAGS" = "" ]; then export CXXFLAGS="$CFLAGS" fi }}} Unintentionally having exported but empty `CXXFLAGS` breaks '''at least''' MPIR, because it assumes the user had intentionally set them, so leaves them as they are (empty that is), not passing potentially important architecture and ABI flags to the C++ compiler (e.g. `-m...` flags to `g++`). The solution is of course simple: Don't (set and) export `CXXFLAGS` if `CFLAGS` aren't exported either. Not sure if setting `CXXFLAGS` to `CFLAGS` in case the latter are non-empty (or empty but exported) is desirable at all. URL: http://trac.sagemath.org/16149 Reported by: leif Ticket author(s): Frédéric Chapoton Reviewer(s): Volker Braun
2 parents fd6f191 + 420fa5f commit 584a28a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/bin/sage-env

+9-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,15 @@ if [ "$LDFLAGS" = "" ]; then
553553
LDFLAGS="" && export LDFLAGS
554554
fi
555555

556-
if [ "$CXXFLAGS" = "" ]; then
556+
if [ -z "$CFLAGS" ]; then
557+
unset CFLAGS
558+
fi
559+
560+
if [ -z "$CXXFLAGS" ]; then
561+
unset CXXFLAGS
562+
fi
563+
564+
if [ -n "$CFLAGS" -a -z "$CXXFLAGS" ]; then
557565
export CXXFLAGS="$CFLAGS"
558566
fi
559567

0 commit comments

Comments
 (0)