Summary: | Detect ignorance of CC & CXX (and other tools, like pkg-config?) through provision of gcc/g++/etc wrappers | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Michał Górny <mgorny> |
Component: | Enhancement/Feature Requests | Assignee: | Portage team <dev-portage> |
Status: | CONFIRMED --- | ||
Severity: | enhancement | CC: | chutzpah, floppym, gyakovlev, sam |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=243502 https://bugs.gentoo.org/show_bug.cgi?id=724454 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | Initial patch |
Description
Michał Górny
2012-07-22 19:04:19 UTC
what if CC="gcc -m64"? Shouldn't it be "$CHOST-gcc -m64"? (In reply to comment #1) > what if CC="gcc -m64"? Quick guess: disable it if CC.split()[0] == 'gcc'? ok, put differently: CC=clang CC=icc In that case, the gcc wrapper would not be called. so that is how you detect it's not respected? isn't really full proof to me but in that optimistic mode, you'll need 'cc' then too perhaps you better make dev feature that adds a directory to PATH containing dying scripts with the names cc, gcc, c++, g++, ld, gld, as, gas instead no point in bothering non-cross-compiling users with this stuff, does it? (In reply to comment #6) > so that is how you detect it's not respected? isn't really full proof to me > but in that optimistic mode, you'll need 'cc' then too It is a simple way to trigger a QA check that should work in most situations. If gcc is called in an ebuild where CC=clang, this will catch that. It would not detect if $CHOST-gcc is called instead of clang. > perhaps you better make dev feature that adds a directory to PATH containing > dying scripts with the names cc, gcc, c++, g++, ld, gld, as, gas instead I already have that for gcc and g++. Making it a QA warning is a bit more polite, and allows broader coverage. > no point in bothering non-cross-compiling users with this stuff, does it? Huh? I think it is intended for ebuild maintainers, not users. Created attachment 319074 [details, diff]
Initial patch
It's not perfect and not very complete but it works. We can add more variables in next patches if the approach is fine.
this would also fail for packages that want to execute the native gcc because they're building helpers that get run during build time and never installed (In reply to comment #9) > this would also fail for packages that want to execute the native gcc > because they're building helpers that get run during build time and never > installed Shouldn't those packages use some prefix as well? CBUILD? yes, we have tc-getBUILD_CC people can use. but it'll take time to deploy as not all packages have a way to configure that -- they just execute `cc` and be done. it is not something we've been diligent about at all. along those lines, the warning from the current wrappers are misleading to be bad since it might not be a target issue, but a build one. it also incorrectly warns if someone were to do CC=gcc. further, you *cannot* write to std{out,err} ever. some packages test the output of the compiler for feature availability and this would break it (we've seen this before with wrappers, and even the sandbox itself). *** Bug 684894 has been marked as a duplicate of this bug. *** From bug 684894: (In reply to Patrick McLean from comment #0) > We could easily catch ebuilds that don't respect CC (and LD and other system > programs) by adding shell scripts (or a single script with a bunch of > symlinks) to portage's PATH that record when they are called. then exec the > "proper" program (like "cc" would 'exec "${CC}"''. If the scripts ever get > called during a phase, then we could trigger a QA warning for that phase. > > The standard portage install should include wrappers for all common programs > that build systems often call that should be overridden. > > We could even make a FEATURE (say call it strict-progs) that makes these > shell scripts simply "exit 1" so the build will fail if a package doesn't > respect one of the program variables. Developers could be encouraged to > enable this feature so they catch any ebuilds that aren't respecting > variables such as CC. |