Opened 12 years ago

Last modified 9 years ago

#7818 closed defect

Update sage-env — at Initial Version

Reported by: drkirkby Owned by: drkirkby
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: porting Keywords:
Cc: was, jsp Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


This is an update to the sage-env file. It should allow a much improved build process, simplifying the code in spkg install files, as much of it will be taken care of. The code will also be more portable.

  • Little or no need for any SAGE64 rubbish in any spkg-install files. The appropriate flag to build 64-bit code is added if SAGE64 is set to use.
  • No need to add -Wall or -g, as these are added by default.
  • GNU specific compiler options can be replaced by variables with similar names to the GNU ones, making substitution a relatively easy task.
  • Will enable code to be much more portable.

The changes mainly affect the 3 variables for compiler flags - CFLAGS, CXXFLAGS and FCFLAGS.

The user may set CFLAGS, CXXFLAGS and FCFLAGS, but the following will be appended.

General flags

  • The -g option is added to enable debugging unless SAGE_DEBUG is set to "no".
  • -Wall is added for gcc, g++ and gfortran.

64-bit Flags

If SAGE64 is "yes"

  • -m64 is added for GCC
  • -m64 is added for Sun Studio
  • -q64 is added for IBM's compiler on AIX
  • +DA2.OW is added on HP-UX. (This will not work on Itanium processors running on HP-UX. I'll update when I have more information).

A variable CFLAG64 is set to the correct option for building 64-bit binaries with the C compiler. So if -m64 is replaced by $CFLAG64, the code will work on any C compiler.

(Some compilers may require a different option for C and C++ files. The names CXXFLAG64 and FCFLAG64 are reserved for this, but its not suggested they are used now)

C++ library flags

Due to changes in the C++ standard, it is impossible for compiler vendors to distribute a C++ runtime library which is both compatible with the old standard and the new one. Both HP and Sun use the older library by default, and need a switch added to enable the newer libraries, which more closely follow the latest C++ standard. See:


  • If the compiler is Sun Studio, library=stlport4 is added to CXXFLAGS.
  • If the Compiler is HP's on HP-UX, the option -AA is added to CXXFLAGS.

Shared Library Flags

Five new variables are set in sage-env. These are for building shared libraries and take on names very similar to the GNU names for the flags.

Flag nameValue with GCCValue with Sun Studio

A reviewer may notice two further variable names used. These options can be linker dependent and will be finalized once some code to detect the linker is in place.

Change History (0)

Note: See TracTickets for help on using tickets.