Re: [sr #110846] cross-compilation is not entered when build_alias and host_alias are the same

Lang Daniel <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <VI1P190MB04935937FA2138B7EC32332F9FAD9@VI1P190MB0493.EURP190.PROD.OUTLOOK.COM>
> On 2023-03-01, anonymous <[email protected]> wrote:
>> This might be the desired use case, but when cross compiling with
>> systems like buildroot one might have the same architecture on
>> --build and --host.
>>
>> Example: Compile on Apple silicon (aarch64-unknown-linux-gnu) for a Cortex
>> A75 based system (aarch64-unknown-linux-gnu). Cross compiling isn't
>> automatically detected.
>
> By setting --host and --build to the same value, this explicitly forces
> non-cross-compilation mode in configure.
> 
> If you specify --host without also specifying --build, then configure will
> run the auto-detection which I expect will work properly for you.

Looking into configure setting --host without --build will trigger a test
where an executable is run to determine whether or not cross compiling is
happening. Which in this case may or may not fail.

The manual states:
"Therefore, whenever you specify --host, be sure to specify --build too."

> 
> Probably the "vendor" field of the host triplet should have been set to
> something different for these different systems, but I digress...

Buildroot adds itself as the vendor (aarch64-buildroot-linux-gnu) but
libgpg-error uses the host triplet to lookup a matching syscfg. Therefore
the it has to be changed to aarch64-unknown-linux-gnu.

> 
>> And there seems to be no way to force it if we know that we are cross
>> compiling.
>
> Nevertheless, you can always force cross compilation mode by explicitly
> setting cross_compiling=yes, for example:
> 
>   % ./configure cross_compiling=yes

Thanks for the tip. I tried --cross_compiling=yes which wasn't registered
leading me to believe that there is no way to force it.

> 
> Hope that helps,
>   Nick

Regards
Daniel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.