Autoconf does not support cross compilation.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Autoconf does not support cross compilation.

R0b0t1
Hello,

Others as well as myself have encountered issues with cross compiling
various programs making use of configuration scripts created with
autoconf. The main issue is that the cross compilation environment
causes configuration scripts to produce feature detection binaries
matching the architecture of the compilation target, not the
compilation host. E.g. the script will try to run an ARM binary on an
x86 processor.

Here are two example bugs, filed with the respective project in the
hopes of an interim solution:

https://savannah.gnu.org/bugs/?50385
https://gitlab.com/jas/libidn2/issues/6

Per my reasoning in those bug reports, my suggestion is to provide
another way to pass information to the configuration script. While it
seems possible to make configuration scripts compile and run binaries
of the proper architecture any results they obtain are irrelevant as
they reflect the capabilities of the host, not the target.

R0b0t1.

Reply | Threaded
Open this post in threaded view
|

Re: Autoconf does not support cross compilation.

Eric Blake-3
On 03/09/2017 09:20 PM, R0b0t1 wrote:
> Per my reasoning in those bug reports, my suggestion is to provide
> another way to pass information to the configuration script.

Such a mechanism already exists: cache variables, that you can override
either on the command line (./configure xx_foo=value) or in config.site,
assuming that the configure script is properly written to honor the
cached variable values, particularly when cross-compiling.

--
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


signature.asc (617 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Autoconf does not support cross compilation.

Basin Ilya
In reply to this post by R0b0t1
Hi.
Some authors indeed forget about cross compilation when they publish
their m4 to autoconf-archive.

Good example is byte order check aka endianness. Before endian.h one way
to check it was to run a program. But the cross-compile alternative was
to grep the binary for a magic byte sequence without running.

Sometimes running is the only option though. There are two possible
behaviors in case of cross compile I think: 1) to assume some result or
2) to fail configure unless some explicit result is provided on
configure command line.

10.03.2017 8:50, R0b0t1 пишет:

> Hello,
>
> Others as well as myself have encountered issues with cross compiling
> various programs making use of configuration scripts created with
> autoconf. The main issue is that the cross compilation environment
> causes configuration scripts to produce feature detection binaries
> matching the architecture of the compilation target, not the
> compilation host. E.g. the script will try to run an ARM binary on an
> x86 processor.
>
> Here are two example bugs, filed with the respective project in the
> hopes of an interim solution:
>
> https://savannah.gnu.org/bugs/?50385
> https://gitlab.com/jas/libidn2/issues/6
>
> Per my reasoning in those bug reports, my suggestion is to provide
> another way to pass information to the configuration script. While it
> seems possible to make configuration scripts compile and run binaries
> of the proper architecture any results they obtain are irrelevant as
> they reflect the capabilities of the host, not the target.
>
> R0b0t1.
>

Reply | Threaded
Open this post in threaded view
|

Re: Autoconf does not support cross compilation.

Mike Frysinger
On 10 Mar 2017 09:03, Basin Ilya wrote:
> Some authors indeed forget about cross compilation when they publish
> their m4 to autoconf-archive.
>
> Good example is byte order check aka endianness. Before endian.h one way
> to check it was to run a program. But the cross-compile alternative was
> to grep the binary for a magic byte sequence without running.

there is no reason to do any ad-hoc detecting of endianness anymore.
use the standard autoconf AC_C_BIGENDIAN macro.
-mike

signature.asc (849 bytes) Download Attachment