Building a cross-compiler

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

 



Dear all,

Sorry if what follows is unclear. I am writing because things are
unclear in my brain and I am looking for help to clarify them.

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).

Since the compiler itself is written in OCaml, we also assume that the
Linux box has a working "straight" Linux OCaml compiler installed.

I am trying to figure out in which way the build system needs to be
modified to support such a scheme.

I started with

./configure \
  --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu \
  --target=x86_64-w64-mingw32

Since this invocation does not detect the C compiler properly, I
switched to:

./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.

I assume that what's wrong here is that autoconf expects CC to point to
a C compiler that runs on the build system and produces code that runs
on the host system and my definition of CC breaks this assumption. So,
should I perhaps introduce a second variable to designate a compiler
that runs on the build system but produces code for the target system,
with a name like TARGETCC?
Or, since we will also need a C compiler running on host and producing
code for target, would it perhaps be better to introduce a HOSTCC
variable, which can also be used on the buildhost under the hypothesis
given above that build==host?

Any comment would be more than welcome.

Many thanks in advance,

Sébastien.




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

  Powered by Linux