Cross Compiling

Cross compiling is the act of the building source code on one system, the build host, into executables or libraries to be run on a different host, the target host. The build host and the target host may differ in operating system and/or processor type.

Cross compiling is much trickier than building on the native host. There are a whole new class of problems that can happen when cross compiling that are simply not an issue when building on Cygwin. You should be familiar with building Cygwin/X on Cygwin, as described in the Section called Native Compiling, before attempting to cross compile Cygwin/X.

See Appendix A for notes on building a cross compiler.

Building Cygwin/X

Building the source code when cross compiling X Window System is nearly identical to the process described below in the Section called Native Compiling of the Native Compiling section. One divergence from the aforementioned instructions is that you will be using a bash shell on your cross compiling host, rather than on your native Cygwin host.

  1. When configuring, you must pass --cross-file=crossfile , pointing to a suitable cross file, to meson, to cause the build system to build for the target, Cygwin, platform:

  2. When installing a build, you must use DESTDIR=/stagingdir with ninja install to install the target platform build into /stagingdir.

    Tip: Never run ninja install on your host platform without the DESTDIR, as that will cause the Cygwin build of X Window System to be installed over top of your local X Window System installation, which would completely destroy your host system's X Window System installation.

    OR, when configuring, you can pass --prefix=/stagingdir to cause the build system to be configured to install the target platform build into /stagingdir. This avoids the possibilty of installing over the native installation, at the cost of baking the prefix /stagingdir into the target binaries.