Unity - Manual: Linux IL2CPP cross-compiler (original) (raw)
Handling platform specific settings for IL2CPP additional arguments
Managed stack traces with IL2CPP
The Linux IL2CPPA Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. More info
See in Glossary cross-compiler is a set of sysroot and toolchain packages that allow you to build Linux IL2CPP Players on any Standalone platform without needing to use the Linux Unity Editor or rely on Mono.
If you meet the prerequisites, Unity automatically installs these packages for you when you choose the Linux build target. If you want to opt out of this process and use your own sysroot and toolchain packages, go to Edit > Project Settings > Toolchain Management and disable the Install Toolchain package automatically checkbox. If you already have these installed, you also need to remove them from the Package Manager.
Warning: Setting additional IL2CPP arguments might affect your project compilation. For more information, refer to Handling platform specific settings for IL2CPP additional arguments.
Prerequisites
Unity needs the following to install the IL2CPP cross-compiler packages:
- Unity 2019.4 or above.
- Enough available disk space for your chosen Linux toolchain package. For further information, refer to the Required disk space for Linux toolchain packages.
- Scripting backend set to IL2CPP. To set the scripting backend to IL2CPP: Go to Edit > Project Setting > Player Settings for Linux > Other Settings > Configuration. Set the Scripting Backend to IL2CPP.
- IL2CPP module. For information on how to install the IL2CPP module, follow the steps documented on Adding modules.
Linux sysroot package
A Linux sysroot package is a directory which includes all the headers and libraries you need to build for Linux.
Every operating system (OS) has its own build systems which vary from one to another. If you build using the headers and libraries of a particular OS, the built Player might not run on other operating systems. To address this, Unity provides a sysroot to build with which works on all supported Linux platforms.
Linux toolchain packages
Unity provides toolchain packages for macOS, Windows, and Linux. Each of these platforms builds for Linux in a unique way.
A Linux toolchain package is a set of tools (including the compiler and linker) that Unity needs to build for Linux from each of these operating systems.
Required disk space for Linux toolchain packages
Make sure you have enough disk space to account for the package download, decompression, and use.
In the rare instances where you are unsure whether you have enough space, define a UNITY_SYSROOT_CACHE environment variable and use it to store the uncompressed sysroots and toolchain packages. An environment variable is a variable that you set outside of Unity which is available for Unity to reference. In this case, you set a cache that Unity can reference when decompressing the sysroot and toolchain packages. Environment variables are specific to your operating system, so you need to follow your system’s guidelines to set them.
The table below shows the total disk space requirements for each toolchain package.
Toolchain package | Required disk space |
---|---|
com.unity.toolchain.linux-x86_64 | 462 MB |
com.unity.toolchain.macos-x86_64-linux-x86_64 | 2 GB |
com.unity.toolchain.win-x86_64-linux-x86_64 | 2 GB |
Using the Linux IL2CPP cross-compiler
If you meet all the prerequisites on this page, you can build your project as a Linux Player. Unity automatically uses the Linux IL2CPP cross-compiler at build time.
To build a Linux Player, follow these steps:
- Open the Build Profiles window (menu: File > Build Profiles).
- From the list of platforms in the Platforms panel, select Linux or create a build profile for the Linux platform.
- Select Switch Platform.
- Select Build or Build And Run.
Additional resources
- How to add modules in the Unity Editor
- Linux build settings reference platform docs.
- Linux Player settings
Handling platform specific settings for IL2CPP additional arguments
Managed stack traces with IL2CPP