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: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
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: 2023-05-28 18:14 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.