Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 582822 - toolchain-funcs.eclass: gcc-*-version / tc-getCPP does not respect CC/CXX (without CPP)
Summary: toolchain-funcs.eclass: gcc-*-version / tc-getCPP does not respect CC/CXX (wi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-12 12:15 UTC by Michał Górny
Modified: 2016-10-03 09:29 UTC (History)
4 users (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 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-05-12 12:15:25 UTC
So gcc-*-version stuff uses tc-getCPP to find the preprocessor to get the version from, and tc-getCPP relies on CPP being set. However, it is common to set CC and CXX without setting CPP (in fact, setting CPP breaks some programs...). As a result, gcc version functions return version of active gcc while another version is actually being used.

Please either make version getters use CC/CXX (i.e. the thing actually used to compile stuff), or make tc-getCPP default to something like "$CC -E" when CPP is not set explicitly.
Comment 1 eroen 2016-06-17 07:56:32 UTC
Note that clang's prepocessor will report as gcc version 4.2.1 to enable compatibility code paths in glibc.

Many ebuilds currently in gentoo have checks that abort if it detects recent enough gcc versions, for example the widely used kde4-base_pkg_setup() from kde4-base.eclass will die if it detect gcc versions prior to 4.6 without considering clang.

In these cases, the packages/eclasses are clearly at fault, but fixing tc-getCPP() now will expose this issue to any clang users.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-06-22 20:09:45 UTC
eroen, I've sent new set of patches that also introduce helpful checks for gcc & clang to be used in ebuilds.
Comment 3 Franz Trischberger 2016-07-06 06:17:44 UTC
(In reply to eroen from comment #1)
> Many ebuilds currently in gentoo have checks that abort if it detects recent
> enough gcc versions, for example the widely used kde4-base_pkg_setup() from
> kde4-base.eclass will die if it detect gcc versions prior to 4.6 without
> considering clang.

I'm currently running into this with webkit-gtk. I need to use clang because gcc eats all my memory and then fails.
I wonder why one wants to limit itself to a certain version of a compiler. The only reason I can think of is support for certain language features or a minimum required c[++]-standard. Wouldn't it be better to directly support checks for those checks?
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-06 09:38:50 UTC
Yes, it would be better. However, there's really no need to check for c++11 as sufficiently new gcc versions support it.
Comment 5 Franz Trischberger 2016-07-08 05:55:01 UTC
In case of clang + C++ things might be trickier: clang doesn't ship a libstdc++/STL but it uses the one from gcc (as long as sys-libs/libcxx isn't installed and configured to be used). I don't know if it is possible with the current implementation to check for a given gcc version even if CC/CXX is set to clang*. If the package relies on c++-lib specific features (and not only on language-stuff) we definitely should also check the gcc-version.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-08 06:39:39 UTC
Add to that the fact that at runtime we are using the newest libstdc++ installed (i.e. not gcc-config), and GNU people don't care the slightest bit about ABI stability.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-10-03 09:29:43 UTC
This is done for a while now.