- Linux IL2CPP cross-compiler
- Prerequisites
- Linux sysroot package
- Linux toolchain packages
- Required disk space for Linux toolchain packages
- Using the Linux IL2CPP cross-compiler
- Additional resources
- Linux IL2CPP cross-compiler
- Prerequisites
- Linux sysroot package
- Linux toolchain packages
- Required disk space for Linux toolchain packages
- Using the Linux IL2CPP cross-compiler
- Additional resources
- Unity IL2CPP Build Support for Linux
- Prerequisites
- Unity toolchain packages
- Installing a Unity toolchain package
- Using a Unity toolchain package:
- Technical Details
Linux IL2CPP cross-compiler
The Linux IL2CPP A 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, see Handling 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, see the Required disk space for Linux toolchain packages.
- Scripting backend set to IL2CPP. To set the scripting backend to IL2CPP: Go to Edit >ProjectSetting >PlayerSettings >SettingforPC, Mac and Linux Standalone >Other Settings >Configuration. Set the Scripting Backend toIL2CPP.
- 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 | 462MB |
com.unity.toolchain.macos-x86_64-linux-x86_64 | 2GB |
com.unity.toolchain.win-x86_64-linux-x86_64 | 2GB |
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 Settings (menu: File >Build Settings).
- Select the PC, Mac and Linux Standalone option.
- Set the Build Target option to Linux.
- Click the Switch Platform button.
- Build your Player. From Unity’s main menu, go to File and select either Build or Build and Run.
Additional resources
For information on Linux build settings and Player settings Settings that let you set various player-specific options for the final game built by Unity. More info
See in Glossary , see the Linux platform docs.
Linux IL2CPP cross-compiler
The Linux IL2CPP A 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, see Handling 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 >ProjectSetting >PlayerSettings >SettingforPC, Mac and Linux Standalone >Other Settings >Configuration. Set the Scripting Backend toIL2CPP.
- 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 | 462MB |
com.unity.toolchain.macos-x86_64-linux-x86_64 | 2GB |
com.unity.toolchain.win-x86_64-linux-x86_64 | 2GB |
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 Settings (menu: File >Build Settings).
- Select the Windows, Mac, Linux option.
- Set the Build Target option to Linux.
- Click the Switch Platform button.
- Build your Player. From Unity’s main menu, go to File and select either Build or Build and Run.
Additional resources
Unity IL2CPP Build Support for Linux
Support for Linux players using IL2CPP is available from 2019.3 onwards.
Operating systems (OS) have their own build systems which vary from one another. If you build using the headers and libraries on a particular OS, this might result in the built player not running on a different one. To address this, Unity provides a sysroot to build against which works on all supported Linux platforms.
The sysroot also allows cross-compilation support which enables you to build Linux IL2CPP from Linux, macOS and Windows.
Prerequisites
To use the following packages, you need to install the Linux Build Support (IL2CPP) module in your Unity Editor version. Use the Unity Hub to do this. For further information, see Adding Modules to the Unity Editor.
Unity toolchain packages
Unity provides a toolchain package, which installs the sysroot and a toolchain, for building binaries for the target. The naming convention for these packages is:
“host platform and architecture” followed by “target platform and architecture”
If the host platform and architecture are the same as the target platform and architecture, the name is shortened to the platform and architecture.
Installing a Unity toolchain package
Go to Window > Package Manager. Use the search bar to find the package, and click **Install **in the bottom right corner of the Package Manager window. Choose the package based on the host platform:
Host | Package |
---|---|
Linux | com.unity.toolchain.linux-x86_64 |
macOS | com.unity.toolchain.macos-x86_64-linux-x86_64 |
Windows | com.unity.toolchain.windows.x86_64-linux-x86_64 |
Using a Unity toolchain package:
When you have installed your toolchain package, go to Project Settings >Player > Configuration and set the ScriptingBackend to IL2CPP.
To build your project go to File>Build Settings, in the Target Platform dropdown select Linux, then click Build or Build and Run.