Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 575446 - FFLAGS and FCFLAGS should be set up defaults in make.conf
Summary: FFLAGS and FCFLAGS should be set up defaults in make.conf
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Release Media
Classification: Unclassified
Component: Stages (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Gentoo Release Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-23 11:26 UTC by Dainius Masiliūnas
Modified: 2019-12-29 13:50 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
COMMON_FLAGS patch (05-COMMON_FLAGS.patch,59.64 KB, patch)
2018-01-31 20:22 UTC, Ben Kohler
Details | Diff
COMMON_FLAGS patch, setting unset values to COMMON_FLAGS too (file_575446.txt,51.58 KB, patch)
2018-09-13 17:30 UTC, dwfreed
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dainius Masiliūnas 2016-02-23 11:26:15 UTC
In the make.conf provided by the x32 stage3 archives, there is a line for CFLAGS, but no lines setting CXXFLAGS, nor FFLAGS and FCFLAGS, to the same value. That results in all C++ and Fortran programs being compiled with defaults (thus without -march=native and such).

The make.conf file should include lines:

CXXFLAGS="${CFLAGS}"
FFLAGS="${CFLAGS}"
FCFLAGS="${CFLAGS}"
Comment 1 Jorge Manuel B. S. Vicetto (RETIRED) gentoo-dev 2016-11-14 02:59:49 UTC
I just checked and stage3-x32-20161110 and stage3-amd64-20161110 have the same config. Both have:

CFLAGS="-O2 -pipe"
CXXFLAGS="${CFLAGS}"

However, they're not setting FFLAGS or FCFLAGS.

@toolchain:
are we missing the above or should we keep things as they are?
Comment 2 SpanKY gentoo-dev 2016-11-14 14:37:19 UTC
we've long provided defaults for FFLAGS and FCFLAGS via the profile for all targets.  you can see that via `portageq envvar FFLAGS`.  those are all evaluated before the user settings though.

when the user overrides CFLAGS with make.conf, since FFLAGS has already been expanded, then it doesn't default to the user's settings.

an argument could be made either way.  if we want to try to set this up in catalyst, we probably need to redo the flags.  we don't want to coach people into thinking that CFLAGS is equiv to CXXFLAGS is equiv to FFLAGS and such -- because they aren't.  instead we should be writing something like:
  # These are flags that work for all compilers.
  COMMON_FLAGS="-O2 -pipe"
  # These are flags for just the C compiler.
  CFLAGS="${COMMON_FLAGS}"
  ...
Comment 3 Andreas K. Hüttel archtester gentoo-dev 2017-08-29 20:45:57 UTC
(In reply to SpanKY from comment #2)
> we've long provided defaults for FFLAGS and FCFLAGS via the profile for all
> targets.  you can see that via `portageq envvar FFLAGS`.  those are all
> evaluated before the user settings though.
> 
> when the user overrides CFLAGS with make.conf, since FFLAGS has already been
> expanded, then it doesn't default to the user's settings.
> 
> an argument could be made either way.  if we want to try to set this up in
> catalyst, we probably need to redo the flags.  we don't want to coach people
> into thinking that CFLAGS is equiv to CXXFLAGS is equiv to FFLAGS and such
> -- because they aren't.  instead we should be writing something like:
>   # These are flags that work for all compilers.
>   COMMON_FLAGS="-O2 -pipe"
>   # These are flags for just the C compiler.
>   CFLAGS="${COMMON_FLAGS}"
>   ...

This makes sense to me. However, I have no clue where the "master copy" of make.conf comes from...
Comment 4 Ben Kohler gentoo-dev 2018-01-15 14:16:38 UTC
The stage3 make.conf is assembled here: https://gitweb.gentoo.org/proj/catalyst.git/tree/catalyst/base/stagebase.py#n1084

Due to recent catalyst changes [1], CXXFLAGS is no longer set at all... do we want to try to implement this COMMON_FLAGS setup, or put CXXFLAGS back how it was, or do nothing?

[1] https://gitweb.gentoo.org/proj/catalyst.git/commit/catalyst/base/stagebase.py?id=b409bd9bb4b50f69a555e4e148057ade86a7ed16
Comment 5 Ben Kohler gentoo-dev 2018-01-31 20:22:06 UTC
Created attachment 517302 [details, diff]
COMMON_FLAGS patch

Currently catalyst has code which treats CFLAGS as the "master" variable, and if CXXFLAGS (or other *FLAGS) match it then they will be collapsed to CXXFLAGS="${CFLAGS}"

This patch instead makes COMMON_FLAGS the master, and if CFLAGS/CXXFLAGS/etc match it then they will be collapsed.  Let me know what you think.

It basically gets us to where comment #2 suggests, but without the comment lines.
Comment 6 Matt Turner gentoo-dev 2018-09-12 17:36:56 UTC
(In reply to Ben Kohler from comment #5)
> Created attachment 517302 [details, diff] [details, diff]
> COMMON_FLAGS patch
> 
> Currently catalyst has code which treats CFLAGS as the "master" variable,
> and if CXXFLAGS (or other *FLAGS) match it then they will be collapsed to
> CXXFLAGS="${CFLAGS}"
> 
> This patch instead makes COMMON_FLAGS the master, and if CFLAGS/CXXFLAGS/etc
> match it then they will be collapsed.  Let me know what you think.
> 
> It basically gets us to where comment #2 suggests, but without the comment
> lines.

Looks good to me.
Comment 7 dwfreed 2018-09-13 17:30:16 UTC
Created attachment 546878 [details, diff]
COMMON_FLAGS patch, setting unset values to COMMON_FLAGS too

This'll set unset values to COMMON_FLAGS (except LDFLAGS and ASFLAGS) as well as setting values that match COMMON_FLAGS to COMMON_FLAGS.  THis allows for less setting duplication in the arch files.
Comment 8 Ben Kohler gentoo-dev 2018-09-14 14:02:40 UTC
I'm going to look into merging this latest patch from dwfreed.  Here is the resulting amd64 stage3 make.conf:

# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
COMMON_FLAGS="-O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"

# NOTE: This stage was built with the bindist Use flag enabled
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C