Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 727900 - sys-devel/crossdev - set CC_FOR_BUILD and BUILD_CC in make.conf
Summary: sys-devel/crossdev - set CC_FOR_BUILD and BUILD_CC in make.conf
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Crossdev team
Depends on:
Reported: 2020-06-11 02:16 UTC by Mike Gilbert
Modified: 2020-06-11 06:42 UTC (History)
1 user (show)

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

make.conf: set BUILD_CC and CC_FOR_BUILD (0001-make.conf-set-BUILD_CC-and-CC_FOR_BUILD.patch,775 bytes, patch)
2020-06-11 02:20 UTC, Mike Gilbert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Gilbert gentoo-dev 2020-06-11 02:16:41 UTC
crossdev currently sets HOSTCC to "${CBUILD}-gcc" in make.conf.

It would make sense to set CC_FOR_BUILD and BUILD_CC as well, since these are commonly used in various packages.
Comment 1 Mike Gilbert gentoo-dev 2020-06-11 02:20:33 UTC
Created attachment 644334 [details, diff]
make.conf: set BUILD_CC and CC_FOR_BUILD
Comment 2 Sergei Trofimovich gentoo-dev 2020-06-11 06:42:24 UTC
I think overriding `CC_FOR_BUILD` for a cross-compiler and setting sensible `CC_FOR_BUILD` by default are two orthogonal things that happen to have the same fix in ebuild.

Normally `./configure --build=foo --host=foo --target=foo` assumes that tools used will be `CC_FOR_BUILD=foo-gcc`, `CC=foo-gcc`, `CC_FOR_TARGET=foo-gcc` without any extra variables passed.

The fact that AX_PROG_CC_FOR_BUILD derives CC_FOR_BUILD=gcc is arguably a bug of of AX_PROG_CC_FOR_BUILD. More details are at (no answers yet).

This has the following consequence:
on a native system overriding CC= is not enough to avoid use of 'gcc'. You have to override CC_FOR_BUILD as well. I think it's an ebuild bug if user is expected to to set that variable manually. 'tc-getCC_FOR_BUILD' specifically tries to derive a toolchain by inspecting CC_FOR_BUILD and then uses CC if CC_FOR_BUILDif not set.

HOSTCC should not bet set by crossdev's make'conf as well. Ebuilds should specify HOSTCC=$(tc-getBUILD_CC) to avoid user from setting yet another vlavour CC variable.

We can apply a workaround to crossdev but I would rather remove HOSTCC= assignment.