Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 781923

Summary: net-misc/bird-2.0.10 does not respect CFLAGS
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Alarig Le Lay <alarig>
Status: RESOLVED FIXED    
Severity: normal CC: arkamar, ionen, proxy-maint, sam
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/20334
https://github.com/gentoo/gentoo/pull/29942
https://github.com/gentoo/gentoo/pull/29980
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 59506    
Attachments: build.log
lxc-build
QA CFLAGS

Description Agostino Sarubbo gentoo-dev 2021-04-10 08:22:25 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: net-misc/bird-2.0.8 does not respect CFLAGS.
Discovered on: amd64 (internal ref: ci)

NOTE:
To reproduce this issue you may want to add "-frecord-gcc-switches" to CFLAGS/CXXFLAGS/FFLAGS/FCFLAGS. If this is not something about c/c++ context see this bug as an hint to hide the QA warning (with QA_FLAGS_IGNORED) where is not possible to respect CFLAGS.
Comment 1 Agostino Sarubbo gentoo-dev 2021-04-10 08:22:27 UTC
Created attachment 698895 [details]
build.log

build log and emerge --info
Comment 2 Alarig Le Lay 2021-04-10 12:27:50 UTC
Created attachment 698931 [details]
lxc-build

Which options are you using for the QA messages?

I use the same CFLAGS and FEATURES as you (except buildpkg) and your EMERGE_DEFAULT_OPTS aren’t about QA, but I don’t have any warning.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-04-10 12:42:52 UTC
(In reply to Alarig Le Lay from comment #2)
> Created attachment 698931 [details]
> lxc-build
> 
> Which options are you using for the QA messages?
> 
> I use the same CFLAGS and FEATURES as you (except buildpkg) and your
> EMERGE_DEFAULT_OPTS aren’t about QA, but I don’t have any warning.

Make sure you set it in LDFLAGS too.


CFLAGS="-O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches"
CXXFLAGS="-O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches"
LDFLAGS="-O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,--as-needed"
PORTAGE_ELOG_CLASSES="${PORTAGE_ELOG_CLASSES} qa"
Comment 4 Ionen Wolkens gentoo-dev 2021-04-10 13:17:13 UTC
I see you've only set CFLAGS, there's sneaky thing about the flags check:

        if [[ "${CFLAGS}" == *-frecord-gcc-switches* ]] && \
        [[ "${CXXFLAGS}" == *-frecord-gcc-switches* ]] && \
        [[ "${FFLAGS}" == *-frecord-gcc-switches* ]] && \
        [[ "${FCFLAGS}" == *-frecord-gcc-switches* ]]

Needs to be set in all four (even fortran), or else it does nothing.
Comment 5 Alarig Le Lay 2021-04-10 17:55:04 UTC
I added it everywhere:
bird ~ # grep FLAGS= /etc/portage/make.conf 
CFLAGS="-O2 -pipe -march=native -frecord-gcc-switches"
CXXFLAGS="${CFLAGS}"
LDFLAGS="${LDFLAGS} -frecord-gcc-switches"
FFLAGS="${FFLAGS} -frecord-gcc-switches"
FCFLAGS="${FCFLAGS} -frecord-gcc-switches"
bird ~ # emerge --info | grep FLAGS=
setlocale: unsupported locale setting
setlocale: unsupported locale setting
CFLAGS="-O2 -pipe -march=native -frecord-gcc-switches"
CXXFLAGS="-O2 -pipe -march=native -frecord-gcc-switches"
FCFLAGS="-O2 -pipe -frecord-gcc-switches"
FFLAGS="-O2 -pipe -frecord-gcc-switches"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -frecord-gcc-switches"

But I still don’t have any warning
Comment 6 Ionen Wolkens gentoo-dev 2021-04-10 18:14:02 UTC
Try these:

CFLAGS="-O2 -pipe -march=native -frecord-gcc-switches"
CXXFLAGS="-O2 -pipe -march=native -frecord-gcc-switches"
FCFLAGS="-O2 -pipe -frecord-gcc-switches"
FFLAGS="-O2 -pipe -frecord-gcc-switches"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0"
PORTAGE_ELOG_CLASSES="${PORTAGE_ELOG_CLASSES} qa"
Comment 7 Ionen Wolkens gentoo-dev 2021-04-10 18:17:29 UTC
Additionally, MAKEOPTS='VERBOSE=1' will probably be useful here.
Comment 8 Ionen Wolkens gentoo-dev 2021-04-10 18:19:36 UTC
Think problem seem to be because of lto and linker flags, if you have -frecord-gcc-switches in LDFLAGS then it spares you the warning because flag was used at link time.
Comment 9 Ionen Wolkens gentoo-dev 2021-04-10 18:24:00 UTC
Honestly detection on this one may be a bit bogus, I do see flags being used in all the right place (CFLAGS for building, LDFLAGS for linking, but then it adds that -flto).
Comment 10 Alarig Le Lay 2021-04-10 18:28:52 UTC
Created attachment 699060 [details]
QA CFLAGS

Thanks! I do have the notice now.

However, with the verbose build, it seems to me that the CFLAGS are respected
Comment 11 Ionen Wolkens gentoo-dev 2021-04-11 01:53:06 UTC
Considering adding non-essential flags that users didn't ask for isn't so great, you could fix this by doing:

bird_cv_c_lto=no econf \ [...]

And then no QA notice.

Additionally defining `emake VERBOSE=1` is always a nice gesture so users can see what's going on.
Comment 12 Ionen Wolkens gentoo-dev 2021-04-11 01:55:21 UTC
(In reply to Ionen Wolkens from comment #11)
> bird_cv_c_lto=no econf \ [...]
or minor self-nitpick, I find these are better as arguments
e.g. econf bird_cv_c_lto=no
Comment 13 Alarig Le Lay 2021-04-11 11:57:38 UTC
I created a merge request to add the lto flag, which is enabled by default. So you will be able to test your CI without lto.
I don’t want to disable it by default because:
 1. a BGP convergence on fullviews is already long enough and LTO is meant to have more efficient binaries
 2. it has been introduced in 2.0.7 (2019-10-11), which has been pulled in the tree Mon Feb 10 13:53:17 2020 +0000 and nobody complained about it
 3. bird developers know better than me what they are doing with the gcc build/link flags
Comment 14 David Seifert gentoo-dev 2021-04-11 16:29:24 UTC
(In reply to Alarig Le Lay from comment #13)
> I created a merge request to add the lto flag, which is enabled by default.
> So you will be able to test your CI without lto.
> I don’t want to disable it by default because:
>  1. a BGP convergence on fullviews is already long enough and LTO is meant
> to have more efficient binaries
>  2. it has been introduced in 2.0.7 (2019-10-11), which has been pulled in
> the tree Mon Feb 10 13:53:17 2020 +0000 and nobody complained about it
>  3. bird developers know better than me what they are doing with the gcc
> build/link flags

Argument 1. can be invoked for pretty much half the ::gentoo tree, yet we don't prematurely optimize for all these specific use cases. People caring about a specific performance edge-case have all the tools they need to optimize them.
Comment 15 Alarig Le Lay 2021-04-11 18:57:54 UTC
I’m not prematurely optimising, I’m keeping a compilation option used upstream to build the code as it’s meant to be.
By searching "lto site:https://bird.network.cz/pipermail/bird-users/", I think that LTO never created any issue (on Gentoo and elsewhere), plus the ebuild does in fact respect the CFLAGS (thus, moving the bug from net-misc/bird-2.0.{7,8} to tinderbox). So I really don’t see why I should modify something working.
Comment 16 Agostino Sarubbo gentoo-dev 2022-02-28 15:12:52 UTC
ci has reproduced this issue with version 2.0.9 - Updating summary.
Comment 17 Agostino Sarubbo gentoo-dev 2022-11-21 08:20:43 UTC
ci has reproduced this issue with version 2.0.10 - Updating summary.
Comment 18 Joonas Niilola gentoo-dev 2023-04-15 13:47:18 UTC
447ab933512e18f1d9d3e37cdf84b8b8d12f08e4