Skip to content

Gather and clean up compiler flags #30375

@kliem

Description

@kliem

We gather and clean up compiler flags. Also we

  • add --enable-fat-binary to configure (as an alternative to setting SAGE_FAT_BINARY)
  • add --enable_debug={no|symbols|yes} as alternative to setting SAGE_DEBUG
  • compile with -Og -g if SAGE_DEBUG=yes
  • compile with -O2 if SAGE_DEBUG=no (some packages with O3 instead)
  • compile with -O2 -g otherwise (some packages with O3 instead)

During the build of Sage there are now flags that can be exported
in spkg_install.in with one line, instead of checking SAGE_DEBUG
etc. for each individual package, e.g. by

  • export CFLAGS=$CFLAGS (redundant, use flags as above)
  • export CFLAGS=$CFLAGS_O3 (O3 instead of O2, but only if not in debug mode)
  • export CFLAGS=$ORIGINAL_CFLAGS (use $CFLAGS as set before configure)

Likewise we do with CXXFLAGS, FCFLAGS, F77FLAGS.

We try to respect the user's choice and do not overwrite the flags if already
set by the user, but only add compile flags if necessary for packages to work.

Inidividual packages can still be compiled with specified flags or in debug mode using

make CFLAGS=-O2 some-package

or

make SAGE_DEBUG="yes" some-package

This ticket prepares #27122, which adds -march=native to the defaults.

CC: @slel @dimpase

Component: build

Keywords: compile flags, sd111

Author: Jonathan Kliem

Branch/Commit: 3bb3099

Reviewer: Matthias Koeppe

Issue created by migration from https://trac.sagemath.org/ticket/30375

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions