Re: Building a cross-compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021-01-20, Sébastien Hinderer <Sebastien.Hinderer@xxxxxxxx> wrote:
> I am in charge of making cross-compilation possible for the OCaml
> language, given that the compiler's build system uses autoconf. The
> compiler is written in OCaml itself and has a runtime written in C.
>
> To start experimenting, I am trying to build a Linux to Windows64(MINGW)
> cross-compiler. So the compiler's build and host system types are Linux
> 64 and the target type is Windows64(MinGW).
[...]
> ./configure \
>   --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu \
>   --target=x86_64-w64-mingw32 \
>   CC=x86_64-w64-mingw32-gcc
>
> But that does not quite work because, since build and host system types
> are equal, autoconf assumes we are not in cross-compiling mode and thus
> tries to run the test programs it compiles, which is actually not
> possible.

One thing that might help you is to know that you can just add
cross_compiling=yes to the configure command line to force
configure into cross compilation mode.

If you only need the C compiler to produce code for the target system
(and never for the host system) then this might even be sufficient for
your use case.

Unfortunately Autoconf does not directly support detection of multiple
C compilers (e.g., to get a different compiler for each of the build,
host and target systems).  I think the Autoconf Archive has something
to get a compiler for the build system which might be adaptable for
target as well.

Cheers,
  Nick





[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux