Cross-Compiling Ioto
Building Ioto for platform different to that of the local system is called cross compiling. Sometimes this compiling is just for a different instruction set (say x64 instead of x86). Other times, it is for a completely different operating system and/or CPU architecture. In such cases, a cross-compiler is typically required to build for the target platform.
To cross compile, you will typically need to install a cross-compiler tool chain for your target architecture. Once installed and before you attempt to build Ioto, it is best to test compiling a simple, stand-alone HelloWorld program to ensure the cross compiler is working correctly.
If you are targeting the popular ESP32 Architecture please read the dedicated instructions Building for ESP32.
If you are interested in porting Ioto to a new platform, please read Porting Ioto.
Invoking Make
To cross-compile Ioto, invoke make and pass the required cross-compiler via make variables. For example, to cross compile for ARM Linux:
$ make CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-gcc OPTIMIZE=releaseBuild output (executables, libraries and objects) is placed in the build/ directory. Some of the supported CPU architectures are:
arm, arm64, mips, mips64, ppc, ppc64, riscv, riscv64, sh, sparc, x64, x86 and xtensa.Specifying a Tool Chain
You may need to specify where make can locate your cross-compiler and other tools. You can supply these via the make variables: CC, CFLAGS, DFLAGS, IFLAGS, LD and LDFLAGS. For example:
$ make CC=/opt/bin/ccarm LD=/opt/bin/ccarm OPTIMIZE=release