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.
Created attachment 644334 [details, diff] make.conf: set BUILD_CC and CC_FOR_BUILD
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 https://lists.gnu.org/archive/html/autoconf-archive-maintainers/2020-06/msg00000.html (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.
at this point, should delete the HOSTCC option wrt BUILD_CC/etc..., toolchain-funcs has long provided APIs for this, and we expect ebuilds to leverage them. once they do, the need for crossdev to specify is a bit redundant. plus, crossdev would only be able to record the build setting as it existed at initial run time. it wouldn't be able to react to changing values.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=9ecff85d0909d3e576b1388b48da03cfc824516b commit 9ecff85d0909d3e576b1388b48da03cfc824516b Author: Mike Frysinger <vapier@gentoo.org> AuthorDate: 2021-10-27 08:52:22 +0000 Commit: Mike Frysinger <vapier@gentoo.org> CommitDate: 2021-10-27 08:52:22 +0000 wrappers: drop HOSTCC setting This is a bit obsolete. Few packages every used this setting, and toolchain-funcs.eclass provides a suite of BUILD_xxx helpers that ebuilds can leverage directly. Closes: https://bugs.gentoo.org/727900 Signed-off-by: Mike Frysinger <vapier@gentoo.org> wrappers/etc/portage/make.conf | 2 -- 1 file changed, 2 deletions(-)