Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 872416 - sys-devel/gcc-config: should install ${CTARGET}-cc symlinks (sys-devel/clang-toolchain-symlinks may cause unwanted clang use by picking CHOST-cc (was: net-misc/openssh-9.0_p1-r4 is picking clang over gcc 12.2))
Summary: sys-devel/gcc-config: should install ${CTARGET}-cc symlinks (sys-devel/clang-...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-22 20:07 UTC by Mike Lothian
Modified: 2024-02-19 06:17 UTC (History)
5 users (show)

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


Attachments
Build.log (build.log,7.52 KB, text/plain)
2022-09-22 20:08 UTC, Mike Lothian
Details
config.log (config.log,8.84 KB, text/plain)
2022-09-22 20:08 UTC, Mike Lothian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Lothian 2022-09-22 20:07:18 UTC
I've just tried recompiling world after the glibc upgrade and now ssh won't compile as it's picking clang over gcc but doesn't like -flto=16

Reproducible: Always
Comment 1 Mike Lothian 2022-09-22 20:08:36 UTC
Created attachment 813721 [details]
Build.log
Comment 2 Mike Lothian 2022-09-22 20:08:54 UTC
Created attachment 813724 [details]
config.log
Comment 3 Mike Lothian 2022-09-22 20:19:27 UTC
If I manually set CC=gcc and CXX=g++ it compiles
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-22 20:20:43 UTC
Can you run env-update && . /etc/profile and try again?
Comment 5 Ionen Wolkens gentoo-dev 2022-09-22 20:25:56 UTC
configure:3036: checking for x86_64-pc-linux-gnu-cc
configure:3057: found /usr/lib/llvm/15/bin/x86_64-pc-linux-gnu-cc

Seems to be because the new sys-devel/clang-toolchain-symlinks provides a x86_64-pc-linux-gnu-cc symlink while gcc-config does not (and so isn't shadowed).

Could argue it could be a gcc-config issue, but given we've been living without that symlink...
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-22 20:29:54 UTC
Ah, thanks! I think we should probably make gcc-config provide it.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-22 20:37:32 UTC
(I've wanted it before but couldn't justify adding it.)
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-09-22 20:43:25 UTC
This is probably a side effect of our super-stupid super-ancient policy that CC/CXX needs to be set unless the package just picks whatever default we had 22 years ago.
Comment 9 Larry the Git Cow gentoo-dev 2022-09-22 23:46:19 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=1ff1ed38697ed3b376db5c5157fcec24df67aa91

commit 1ff1ed38697ed3b376db5c5157fcec24df67aa91
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-09-22 23:41:28 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-22 23:45:43 +0000

    gcc-config: create ${CTARGET}-cc symlink
    
    We need this because configure scripts may look for ${CTARGET}-cc first,
    and while this wasn't a problem in the past, LLVM installs fallback
    symlinks in /usr/lib/llvm/${SLOT}/bin for the benefit of llvm-only profiles,
    and configure has started finding these rather than falling back to say,
    ${CTARGET}-gcc like it has been all this time.
    
    Bug: https://bugs.gentoo.org/870577
    Bug: https://bugs.gentoo.org/872416
    Signed-off-by: Sam James <sam@gentoo.org>

 gcc-config | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Comment 10 Larry the Git Cow gentoo-dev 2022-09-22 23:47:58 UTC
The bug has been referenced in the following commit(s):

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

commit cc6a27ec99c1e08ac51c69ff0ab4c2b8a5578e2e
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-09-22 23:46:57 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-22 23:47:27 +0000

    sys-devel/gcc-config: add 2.6
    
    Creates ${CTARGET}-cc symlink.
    
    We need this because configure scripts may look for ${CTARGET}-cc first,
    and while this wasn't a problem in the past, LLVM installs fallback
    symlinks in /usr/lib/llvm/${SLOT}/bin for the benefit of llvm-only profiles,
    and configure has started finding these rather than falling back to say,
    ${CTARGET}-gcc like it has been all this time.
    
    Bug: https://bugs.gentoo.org/870577
    Bug: https://bugs.gentoo.org/872416
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/gcc-config/Manifest               |  1 +
 sys-devel/gcc-config/gcc-config-2.6.ebuild  | 60 +++++++++++++++++++++++++++++
 sys-devel/gcc-config/gcc-config-9999.ebuild |  6 +--
 3 files changed, 64 insertions(+), 3 deletions(-)
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-22 23:50:57 UTC
Let's call this in progress until we push new GCCs to ~arch which will make gcc-config run, I guess.
Comment 12 Ionen Wolkens gentoo-dev 2022-09-23 18:27:31 UTC
(In reply to Sam James from comment #11)
> Let's call this in progress until we push new GCCs to ~arch which will make
> gcc-config run, I guess.
ftr it seems to run it in postinst when gcc-config is updated, I can rm the -cc link and emerge -1 gcc-config and a new one pops up
Comment 13 Larry the Git Cow gentoo-dev 2022-09-23 23:02:55 UTC
The bug has been referenced in the following commit(s):

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

commit 961f11b11a0022c5a4a4a34cc4065d13a48906ba
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-09-23 23:01:10 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-23 23:01:49 +0000

    net-misc/openssh: block older gcc-config w/o ${CTARGET}-cc
    
    >=sys-devel/gcc-config-2.6 will create ${CTARGET}-cc which avoids
    clang-toolchain-symlinks providing it even on systems with GCC.
    
    See cc6a27ec99c1e08ac51c69ff0ab4c2b8a5578e2e for the details but
    abuse a blocker given it can lead to runtime problems with say,
    OpenSSH.
    
    Bug: https://bugs.gentoo.org/872416
    Bug: https://bugs.gentoo.org/872548
    See: cc6a27ec99c1e08ac51c69ff0ab4c2b8a5578e2e
    Signed-off-by: Sam James <sam@gentoo.org>

 .../openssh/{openssh-9.0_p1-r4.ebuild => openssh-9.0_p1-r5.ebuild}    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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

commit 91b1e01095b7af1b517bc45f94c0c32de9bf9f86
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-09-23 22:55:16 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-23 23:01:45 +0000

    sys-devel/clang-toolchain-symlinks: block older gcc-config w/o ${CTARGET}-cc
    
    >=sys-devel/gcc-config-2.6 will create ${CTARGET}-cc which avoids
    clang-toolchain-symlinks providing it even on systems with GCC.
    
    See cc6a27ec99c1e08ac51c69ff0ab4c2b8a5578e2e for the details but
    abuse a blocker given it can lead to runtime problems with say,
    OpenSSH.
    
    Bug: https://bugs.gentoo.org/872416
    Bug: https://bugs.gentoo.org/872548
    See: cc6a27ec99c1e08ac51c69ff0ab4c2b8a5578e2e
    Signed-off-by: Sam James <sam@gentoo.org>

 ...olchain-symlinks-14.ebuild => clang-toolchain-symlinks-14-r1.ebuild} | 2 ++
 ...olchain-symlinks-15.ebuild => clang-toolchain-symlinks-15-r1.ebuild} | 2 ++
 ...olchain-symlinks-16.ebuild => clang-toolchain-symlinks-16-r1.ebuild} | 2 ++
 3 files changed, 6 insertions(+)
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-23 23:05:57 UTC
(In reply to Ionen Wolkens from comment #12)
> (In reply to Sam James from comment #11)
> > Let's call this in progress until we push new GCCs to ~arch which will make
> > gcc-config run, I guess.
> ftr it seems to run it in postinst when gcc-config is updated, I can rm the
> -cc link and emerge -1 gcc-config and a new one pops up

Ah, thanks, I was a bit unsure of myself because of the magic in toolchain.eclass but all looks well.
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-23 23:06:22 UTC
(espc. as blockers now enforce non-breakage)
Comment 16 Larry the Git Cow gentoo-dev 2022-09-23 23:17:39 UTC
The bug has been referenced in the following commit(s):

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

commit 3194d18b9e7a583b3dc764bd1fdceada10417859
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-09-23 23:15:07 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-23 23:17:07 +0000

    net-misc/openssh: depend on newer gcc-config or clang-toolchain-symlinks
    
    Made the classic mistake I always moan about! Blockers don't affect
    dependency resolution, although they do mean "eventual consistency"
    in that it ensures you do upgrade by the end of the run.
    
    Let's be safe given we're talking miscompilation here (i.e. runtime
    failure) and depend on newer gcc-config (or newer clang-toolchain-symlinks)
    in openssh to make sure the merge order is correct.
    
    Bug: https://bugs.gentoo.org/872416
    Bug: https://bugs.gentoo.org/872548
    See: cc6a27ec99c1e08ac51c69ff0ab4c2b8a5578e2e
    Fixes: 961f11b11a0022c5a4a4a34cc4065d13a48906ba
    Signed-off-by: Sam James <sam@gentoo.org>

 .../{openssh-9.0_p1-r5.ebuild => openssh-9.0_p1-r6.ebuild}  | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
Comment 17 Larry the Git Cow gentoo-dev 2024-02-19 06:17:39 UTC
The bug has been referenced in the following commit(s):

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

commit 9930542f8c659d729750b6abf2bfb81dcab40cee
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-02-19 06:17:02 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-02-19 06:17:11 +0000

    net-misc/openssh: drop old gcc-config workaround
    
    This shouldn't be needed anymore since 0b22d07f89b16ac3400e45077702ac4c4492e5a4 anyway.
    
    Bug: https://bugs.gentoo.org/872416
    Signed-off-by: Sam James <sam@gentoo.org>

 net-misc/openssh/openssh-9.6_p1-r3.ebuild | 7 -------
 1 file changed, 7 deletions(-)