Cross Compile

By default, Tigress will generate code for the machine you're currently on, using a compiler that makes sense for your target. I.e., if you're on MacOS, Tigress will use Clang, if you're on Linux, Gcc, on Windows, cl:

However, it is common to use Tigress in a cross-compilation scenario. For example, your development machine might run Linux/X86_64, but your target machine could be Android/Arm. Tigress is, in fact, designed for this scenario. You can set target using the --Compiler and --Environment options:

The reason for these machinations is that, even though Tigress is a source-2-source translator, it relies on knowing the sizes and alignments of all types. This information is encoded in "machdep" files in the TIgress distribution directory:

If your target is not one of the ones provided, you can easily create your own machdep file and add it to the machdeps_json directory. Simply compile and run the machdep-ml.c file (also found in the Tigress distribution directory) on your target machine:

> gcc-11 -D_GNUCC -o machdep-ml.exe machdep-ml.c
> machdep-ml.exe --json > `uname -s`_`uname -m`_Gcc_0.json
> head Darwin_x86_64_Gcc_0.json
{
	 "version_major"    : 11,
	 "version_minor"    : 3,
	 "version"          : "11.3.0",
	 "sizeof_short"               : 2,
	 "sizeof_int"                 : 4,
	 "sizeof_bool"                : 1,
	 "sizeof_long"                : 8,
	 "sizeof_longlong"            : 8,
	 "sizeof_ptr"                 : 8,