# Cross-Compiling for Linux (Legacy)

## For engine versions older than 4.14, this page shows users how to set up cross-compilation for the Linux platform.

This reference is an archive for users who need to set up their cross-compilation toolchains in Unreal Engine 4 (UE4) versions that were released prior to 4.14.

If you're developing your project with Unreal Engine, version 4.14 (or newer), you'll want to refer to our Cross-Compiling for Linux documentation.

## Why Cross-Compilation

Cross-compilation makes it possible for game developers, working in a Windows-centric workflow, to target Linux. At this time, cross-compilation is only supported for Windows. Mac users currently have to resort to native compilation . We support, test, and provide the libraries and toolchains for the Linux-x86_64 platform.

## Getting the Toolchain

UE4 Version

Toolchain

4.26

4.25

4.23 and 4.24

4.22

4.21

4.19 and 4.20

4.18

4.16 and 4.17

4.14 and 4.15

4.11 thru 4.13

4.9 and 4.10

4.8 and earlier

• For toolchains -v8 through -v13 , there is no need to extract files or set the environment variable — just run the installer package.

• For toolchains -v4 through -v7, we also provide the libraries and toolchains that enable you to compile for Linux ARM (original Raspberry Pi and up).

• Note that this will require you to make a (minor) code change in UnrealBuildTool (UBT).

• We currently have driver support for AMDGPU-PRO (not RADV) for users running Unreal Engine on CentOS.

From this point on, we assume that you are targeting x86_64 Linux, though most of the following information will apply to compiling for ARM as well (except for the different toolchain). Note that you can build your own toolchain if you want different versions of the tools, or if you want to target a different architecture.

## Setting up the Toolchain

Add an environment variable named LINUX_ROOT, the value of which is the absolute path to your toolchain (without a trailing backslash):

Control Panel->System->Advanced system settings->Advanced->Environment variables 

After you make sure that the environment variable is set, regenerate UE4 project files (using GenerateProjectFiles.bat) and restart Visual Studio. After this, you should have "Linux" available for Win32/Win64 configurations, and you should now be able to cross-compile for it.

## Packaging for Linux

The easiest way to package a project is to open it in the editor and then select File > Package To > Linux. This assumes that you have a cross-toolchain installed in the previous step, and Linux target modules are built for the editor in question. If you don't see Linux in the list, then it's likely that one of the former is not true, in which case see above. After some time (which depends on the project in question and is rather short for a sample project) you will have game assets and binaries in the directory you chose to package to.

The details of the packaging process can be seen by clicking the Show Output Log link. If this process fails with the error message, "unable to find UnrealPak or ShaderCompileWorker" see above about building them for the host (Windows) platform.

Secure copy (scp) or otherwise copy it to a target machine (mounting a Samba share - if you know how to do that - may be better if the target machine is low on disk space, which also reduces iteration times). Change mode (chmod +x) for the target executable, (which will be located in the LinuxNoEditor/<ProjectName>/Binaries/Linux/ directory) and run it.

### Changes for Linux-ARM Platforms

With the release of Unreal Engine, version 4.14, there is a new (and easy to follow) way of packaging projects for the ARM platform. Check out our recently updated

[](SharingAndReleasing/Linux/Basics/GettingStarted)

If you are using the Linux-ARM cross compile toolchain before running GenerateProjectFiles.bat below, edit the following file in the UE4 source code:

.../UnrealEngine/Engine/Source/Programs/UnrealBuildTool/Linux/UEBuildLinux.cs 

by commenting out the following line:

static private string DefaultArchitecture = "x86_64-unknown-linux-gnu"; 

and un-commenting the linux-arm architecture line just below it:

//static private string DefaultArchitecture = "arm-unknown-linux-gnueabihf";

An additional step is required for the packaged project to be runnable on Linux-ARM platforms. Assuming the packaged project is located at \foo\bar\SunTemple_Linux, open the following location:

\foo\bar\SunTemple_Linux\LinuxNoEditor\Engine\Binaries\Linux

and replace libopenal.so.1 with the version from:

...\UnrealEngine\Engine\Source\ThirdParty\OpenAL\1.15.1\lib\Linux\arm-unknown-linux-gnueabihf\libopenal.so

where ...\UnrealEngine is the location of the UE4 source code. Please be sure to rename libopenal.so to libopenal.so.1.

Now the project can be copied over to the target machine, chmod+x the target executable and run it as instructed above.

Tags
Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.