Difference between revisions of "Cross-Compile"

From UFO:AI
Jump to navigation Jump to search
(Created page with "= Cross-Compile from Linux to Windows = In this article we will cross-compile UFO:AI in a Debian chroot environment to Windows, using MingW64_64 (64bit). I chose a chroot en...")
 
m
Line 32: Line 32:
 
  mycomputer ~ # mount --bind /proc /ufoai.xcompile/proc
 
  mycomputer ~ # mount --bind /proc /ufoai.xcompile/proc
 
  mycomputer ~ # mount --bind /sys /ufoai.xcompile/sys
 
  mycomputer ~ # mount --bind /sys /ufoai.xcompile/sys
```
+
 
  
 
If you plan to keep this environment permanent you can also move these mountings to `etc/fstab`.
 
If you plan to keep this environment permanent you can also move these mountings to `etc/fstab`.

Revision as of 11:58, 15 August 2024

Cross-Compile from Linux to Windows

In this article we will cross-compile UFO:AI in a Debian chroot environment to Windows, using MingW64_64 (64bit).

I chose a chroot environment, as it kind of standardizing the build environment and fairly cheap to build. You can achieve the same in Docker or other containerization techniques, but chroot just does its job.


Building the chroot

Prerequisites

For this step you will need:

  1. Debootstrap: Debootstrap is a program that can fetch and construct a Debian-like filesystem. This is the only software you need to install on your system. It is available on all major distributions, if you are unsure, check it on Repology.
  2. Root access: You will need to be able to run commands as system administrator (`su` or `sudo`).
  3. Disk space: You will need around 7-10GiB free space for the cross-compilation.
  4. Internet access: You will need to download packages and libraries from the Internet.


Build

As root user, create a directory and call `debootstrap` to build the root filesystem into that:

mycomputer ~ # mkdir /ufoai.xcompile
mycomputer ~ # debootstrap stable /ufoai.xcompile
...


Mount the pseudo-filesystems:

mycomputer ~ # mount --bind /dev /ufoai.xcompile/dev
mycomputer ~ # mount --bind /dev/pts /ufoai.xcompile/dev/pts
mycomputer ~ # mount --bind /proc /ufoai.xcompile/proc
mycomputer ~ # mount --bind /sys /ufoai.xcompile/sys


If you plan to keep this environment permanent you can also move these mountings to `etc/fstab`.


(to be continued)