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
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Crossdev team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-11 02:16 UTC by Mike Gilbert
Modified: 2021-10-27 08:55 UTC (History)
1 user (show)

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


Attachments
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 (RETIRED) 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 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.
Comment 3 SpanKY gentoo-dev 2021-10-27 08:51:57 UTC
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.
Comment 4 Larry the Git Cow gentoo-dev 2021-10-27 08:55:19 UTC
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(-)