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}"
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?
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}" ...
(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...
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
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.
(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.
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.
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