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

Bug 838472

Summary: dev-libs/libgcrypt-1.10.1 build fails with custom-cflags set
Product: Gentoo Linux Reporter: Jan Psota <jasiupsota>
Component: Current packagesAssignee: Mikle Kolyada (RETIRED) <zlogene>
Status: RESOLVED FIXED    
Severity: normal CC: base-system, floppym, lssndrbarbieri
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jan Psota 2022-04-15 13:08:51 UTC
/var/tmp/portage/dev-libs/libgcrypt-1.10.1/work/libgcrypt-1.10.1/random/jitterentropy-base.c:58:3: error:
#error "The CPU Jitter random number generator must not be compiled with optimizations. See documentation. Use the compiler switch -O0 for compiling jitterentropy.c."

With custom-cflags unset compiles OK when using gcc.
Comment 1 Mike Gilbert gentoo-dev 2022-04-15 19:19:00 UTC
Enabling custom-cflags means you are responsible for any breakage.
Comment 2 Jan Psota 2022-04-16 18:47:59 UTC
(In reply to Mike Gilbert from comment #1)
> Enabling custom-cflags means you are responsible for any breakage.

-custom-cflags in libgcrypt _does not_ disable custom cflags.

+custom-cflags only turns off o_flag_munging, so random/jitterentropy-base.c
is tried to be compiled without filtering flags it does not accept:
sed -e 's/-O\([1-9sg][1-9sg]*\)/-O0/g' -e 's/-Ofast/-O0/g' (from Makefile)

...so compilation of libgcrypt with custom-cflags will not work on any system with -O set to >0, while on my system, for example, 10 packages was compiled with custom-cflags turned on (by default in make.conf) and runs without any problems.

Rather https://bugs.gentoo.org/707330 should be called "invalid".
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-16 18:49:36 UTC
(In reply to Jan Psota from comment #2)
> (In reply to Mike Gilbert from comment #1)
> > Enabling custom-cflags means you are responsible for any breakage.
> 
> -custom-cflags in libgcrypt _does not_ disable custom cflags.
> 
> +custom-cflags only turns off o_flag_munging, so random/jitterentropy-base.c
> is tried to be compiled without filtering flags it does not accept:
> sed -e 's/-O\([1-9sg][1-9sg]*\)/-O0/g' -e 's/-Ofast/-O0/g' (from Makefile)
> 
> ...so compilation of libgcrypt with custom-cflags will not work on any
> system with -O set to >0, while on my system, for example, 10 packages was
> compiled with custom-cflags turned on (by default in make.conf) and runs
> without any problems.
> 
> Rather https://bugs.gentoo.org/707330 should be called "invalid".

custom-cflags is generally used to allow forcing things and disable munging either in the ebuild or upstream. Having it off doesn't mean ALL flags will be disrespected.

Anyway, we can just remove it and always force o-flag-munging unless there's a good reason not to?
Comment 4 Jan Psota 2022-04-16 18:55:14 UTC
> Anyway, we can just remove it and always force o-flag-munging unless there's
> a good reason not to?

I'm sure it is a good idea! And that 5KB ebuild will be some lines shorter :-)
Comment 5 Larry the Git Cow gentoo-dev 2022-04-16 19:35:09 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eadc4f710b6783d509cb6d9b2b5b475069e16391

commit eadc4f710b6783d509cb6d9b2b5b475069e16391
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2022-04-16 19:32:25 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2022-04-16 19:34:26 +0000

    dev-libs/libgcrypt: always enable O-flag-munging
    
    Exposing this as a USE flag is mostly pointless, and results in silly
    bug reports from users who disable it by accident.
    
    Users can disable it using EXTRA_ECONF if so desired.
    
    Bug: https://bugs.gentoo.org/629410
    Bug: https://bugs.gentoo.org/707330
    Closes: https://bugs.gentoo.org/838472
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 dev-libs/libgcrypt/libgcrypt-1.10.1.ebuild   | 3 +--
 dev-libs/libgcrypt/libgcrypt-1.8.8.ebuild    | 5 ++---
 dev-libs/libgcrypt/libgcrypt-1.8.9.ebuild    | 3 +--
 dev-libs/libgcrypt/libgcrypt-1.9.4-r1.ebuild | 3 +--
 dev-libs/libgcrypt/metadata.xml              | 1 -
 5 files changed, 5 insertions(+), 10 deletions(-)