Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 906040 - sys-devel/gcc-config-2.10 on llvm profile: unmerging leaves /etc/clang/gentoo-gcc-install.cfg with stale --gcc-install-dir
Summary: sys-devel/gcc-config-2.10 on llvm profile: unmerging leaves /etc/clang/gentoo...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor
Assignee: Gentoo Toolchain Maintainers
URL: https://forums.gentoo.org/viewtopic-t...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-09 18:47 UTC by Ilja ”Zucca” Sara
Modified: 2025-01-02 18:33 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilja ”Zucca” Sara 2023-05-09 18:47:37 UTC
gcc-config leaves traces of gcc installation inside /etc/clang even when gcc and gcc-config are removed from the system.
The main culprit is /etc/clang/gentoo-gcc-install.cfg, which is included from /etc/clang/gentoo-common.cfg.

Reproducible: Always

Steps to Reproduce:
1. Have a llvm profile enabled
2. run: emerge --oneshot gcc
3. run: emerge --depclean
4. Try emerge any package which needs c and/or c++ code compiling
Actual Results:  
Portage can't use any compiler. Tries to run clang, but clang complains about missing gcc installation

Expected Results:  
A Working Portage which can compile c and c++ -based software.

We had some conversation already at forums. Please see the URL.

I don't see this as a very critical bug as one can either clean /etc/clang from gcc-config leftovers or just refraing from using (emerging) gcc in llvm based system.
A quickest fix would be to add package.mask for gcc and gcc-config in llvm profiles.

I accidentaly stumbled upon this because refind doesn't compile using clang at the moment. So masking gcc and gcc-config could potentially also block some other packages on llvm profiles.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-10 00:53:37 UTC
1. gcc becomes depcleanable
2. gcc (and then gcc-config) are unmerged
3. /etc/clang/gentoo-gcc-install.cfg's --gcc-install-dir points to a now-non-existent path

We should either clean it up in toolchain.eclass in pre/postrm or in pre/postrm in gcc-config.

(prerm sounds better because we narrow the race then.)

gcc-config might be able to do it by itself as well.
Comment 2 Ilja ”Zucca” Sara 2023-05-28 18:14:16 UTC
Also this gets printed when doing 'emerge --info'

!!! No gcc found. You probably need to 'source /etc/profile'
!!! to update the environment of this terminal and possibly 
!!! other terminals also. 

I'm not sure if this happens because gcc-config did leave something else hanging under /etc or if portage/emerge always expects gcc to be founf from the system even when using llvm based profile.
Comment 3 Larry the Git Cow gentoo-dev 2025-01-02 18:33:30 UTC
The bug has been closed via the following commit(s):

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

commit 8f9703447530c55709c3462035ecdb7562347185
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-01-02 18:28:11 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-01-02 18:28:11 +0000

    toolchain.eclass: cleanup /etc/clang/gentoo-gcc-install.cfg on removing last GCC
    
    Otherwise, /etc/clang/gentoo-gcc-install.cfg is left with a broken non-existent
    --gcc-install-dir value on LLVM-only profiles when the last installed GCC
    gets removed.
    
    Closes: https://bugs.gentoo.org/906040
    Signed-off-by: Sam James <sam@gentoo.org>

 eclass/toolchain.eclass | 6 ++++++
 1 file changed, 6 insertions(+)