Mailing List Archive

[PATCH] toolchain-funcs.eclass: Set CHOST within econf_build to fix config.site
We were setting CBUILD within econf_build but not CHOST. crossdev's
/usr/share/config.site relies on both of these to decide whether to load
configure overrides needed when cross-compiling. Using the wrong
overrides leads to packages such as Python failing.

Doing this also avoids the need to duplicate the --build and --host
configure arguments.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
eclass/toolchain-funcs.eclass | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index a184887ad3b9..61a29d1b6ea6 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -442,7 +442,8 @@ tc-env_build() {
# @CODE
econf_build() {
local CBUILD=${CBUILD:-${CHOST}}
- tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
+ econf_env() { CHOST=${CBUILD} econf "$@"; }
+ tc-env_build econf_env "$@"
}

# @FUNCTION: tc-ld-is-gold
--
2.38.1
Re: [PATCH] toolchain-funcs.eclass: Set CHOST within econf_build to fix config.site [ In reply to ]
> On 6 Dec 2022, at 09:03, James Le Cuirot <chewi@gentoo.org> wrote:
>
> We were setting CBUILD within econf_build but not CHOST. crossdev's
> /usr/share/config.site relies on both of these to decide whether to load
> configure overrides needed when cross-compiling. Using the wrong
> overrides leads to packages such as Python failing.
>
> Doing this also avoids the need to duplicate the --build and --host
> configure arguments.
>
> Signed-off-by: James Le Cuirot <chewi@gentoo.org>
> ---
> eclass/toolchain-funcs.eclass | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
> index a184887ad3b9..61a29d1b6ea6 100644
> --- a/eclass/toolchain-funcs.eclass
> +++ b/eclass/toolchain-funcs.eclass
> @@ -442,7 +442,8 @@ tc-env_build() {
> # @CODE
> econf_build() {
> local CBUILD=${CBUILD:-${CHOST}}
> - tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
> + econf_env() { CHOST=${CBUILD} econf "$@"; }
> + tc-env_build econf_env "$@"
> }
>
> # @FUNCTION: tc-ld-is-gold
> --

Lgtm provided you've tested it in the relevant envs (which I'm sure you have).

Curious how this didn't come up as a problem before, but it
seems fine!

Thanks!

Best,
sam
Re: [PATCH] toolchain-funcs.eclass: Set CHOST within econf_build to fix config.site [ In reply to ]
On Tue, 2022-12-06 at 10:12 +0000, Sam James wrote:
>
> > On 6 Dec 2022, at 09:03, James Le Cuirot <chewi@gentoo.org> wrote:
> >
> > We were setting CBUILD within econf_build but not CHOST. crossdev's
> > /usr/share/config.site relies on both of these to decide whether to load
> > configure overrides needed when cross-compiling. Using the wrong
> > overrides leads to packages such as Python failing.
> >
> > Doing this also avoids the need to duplicate the --build and --host
> > configure arguments.
> >
> > Signed-off-by: James Le Cuirot <chewi@gentoo.org>
> > ---
> > eclass/toolchain-funcs.eclass | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
> > index a184887ad3b9..61a29d1b6ea6 100644
> > --- a/eclass/toolchain-funcs.eclass
> > +++ b/eclass/toolchain-funcs.eclass
> > @@ -442,7 +442,8 @@ tc-env_build() {
> > # @CODE
> > econf_build() {
> > local CBUILD=${CBUILD:-${CHOST}}
> > - tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
> > + econf_env() { CHOST=${CBUILD} econf "$@"; }
> > + tc-env_build econf_env "$@"
> > }
> >
> > # @FUNCTION: tc-ld-is-gold
> > --
>
> Lgtm provided you've tested it in the relevant envs (which I'm sure you have).
>
> Curious how this didn't come up as a problem before, but it
> seems fine!

econf_build is not widely used, and you only added it to Python in June. It's
been used in other packages for much longer, but Python explicitly checks that
the size of a long is what it expects. I didn't see it with m68k because we
don't have any overrides for that. You also might not see it going from amd64
to arm64 either with them both being 64-bit. The lack of m68k overrides makes
me wonder if some of these are even needed any more. ac_cv_sizeof_* can
seemingly be determined when cross-compiling now.

Since we've already had some reports of success, I'm merging this now.
Re: [PATCH] toolchain-funcs.eclass: Set CHOST within econf_build to fix config.site [ In reply to ]
> On 6 Dec 2022, at 21:47, James Le Cuirot <chewi@gentoo.org> wrote:
>
> On Tue, 2022-12-06 at 10:12 +0000, Sam James wrote:
>> [snip]
>> Lgtm provided you've tested it in the relevant envs (which I'm sure you have).
>>
>> Curious how this didn't come up as a problem before, but it
>> seems fine!
>
> econf_build is not widely used, and you only added it to Python in June. It's
> been used in other packages for much longer, but Python explicitly checks that
> the size of a long is what it expects. I didn't see it with m68k because we
> don't have any overrides for that. You also might not see it going from amd64
> to arm64 either with them both being 64-bit. The lack of m68k overrides makes
> me wonder if some of these are even needed any more. ac_cv_sizeof_* can
> seemingly be determined when cross-compiling now.
>
> Since we've already had some reports of success, I'm merging this now.

Thank you for explaining! That makes sense now.