You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
271 lines
10 KiB
Plaintext
271 lines
10 KiB
Plaintext
Availability:Public
|
|
Title: Cross-Compiling for Linux
|
|
Crumbs:%ROOT%
|
|
Description:Learn how to set up a cross-compilation toolchain in Windows, targeting the Linux platform.
|
|
Version: 4.15
|
|
SkillLevel: Advanced
|
|
type:overview
|
|
parent:Platforms/Linux
|
|
tags:Linux
|
|
related:Programming/Development/CompilingProjects
|
|
related:Programming/Development/BuildConfigurations
|
|
related:Engine/Basics/Projects/Packaging
|
|
related:Platforms/Linux/AdvancedLinuxDeveloper/LinuxCrossCompileLegacy
|
|
related:Programming/Basics/ConfigurationFiles
|
|
topic-image:GettingStarted_Topic.png
|
|
prereq:Platforms/Linux/BeginnerLinuxDeveloper/SettingUpAnUnrealWorkflow
|
|
|
|
|
|
[TOC(start:2 end:3)]
|
|
|
|
(w:1200)
|
|
|
|
Recent improvements to the cross-compile toolchain make it possible for Unreal Engine 4 (UE4) developers to target a variety of platforms from their Windows
|
|
development environment. This guide tells you which platforms you can target with the cross-compilation toolchain, providing a link
|
|
to download the toolchain, and ultimately showing you how to set it up to cross-compile a UE4 project for Linux. If you're developing a project in Unreal Engine, version 4.15, you'll also
|
|
learn how to switch between target platforms.
|
|
|
|
[REGION:note]
|
|
If you're developing your project with Unreal Engine, version 4.13 (or older), you'll want to refer to our [](Platforms/Linux/AdvancedLinuxDeveloper/LinuxCrossCompileLegacy) documentation.
|
|
[/REGION]
|
|
|
|
[INCLUDE:Platforms/Linux/AdvancedLinuxDeveloper/LinuxCrossCompileLegacy#Why_XC]
|
|
|
|
## Setting up the Toolchain
|
|
|
|
If you want to set up a toolchain from your Windows (host) computer to target any of the aforementioned platforms, you'll have to download the toolchain and
|
|
set your system's environment variable to package your application for Linux and ARM based environments. If this is your first time packaging UE4 projects for the
|
|
Linux platform, you'll also have to build the engine in Visual Studio for Linux. After working through the following steps, your host environment will be set up
|
|
to target any of the currently supported platforms.
|
|
|
|
[REGION:note]
|
|
Please make sure that you have a reliable Internet connection prior to following these steps. Depending on the speed of your
|
|
Internet connection, downloading the toolchain can take anywhere from a few minutes to a few hours.
|
|
[/REGION]
|
|
|
|
### Downloading the Toolchain
|
|
|
|
1. Please download the cross-toolchain appropriate for your engine version.
|
|
|
|
1. Now, create a new folder, naming it `Linux_CrossCompileToolChain`.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_Step2.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
[REGION:note]
|
|
If you're using a different naming convention, substitute your preferred folder name with the one we've chosen for illustrative purposes.
|
|
[/REGION]
|
|
|
|
1. **Extract** the toolchain, being sure to set the extracted file's destination to the folder that you created in the previous step.
|
|
|
|
(w:600)
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
1. Open the `[ROOT]/Linux_CrossCompileToolChain/v11_clang-5.0.0-centos7` folder to view the extracted files.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_Step4.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
#### Supported Platforms
|
|
|
|
Refer to the following table to download the appropriate toolchain for your version of UE4:
|
|
|
|
| **Architecture** | **Sub-Architecture** | **Vendor** | **System** | **Application Binary Interface (abi)** |
|
|
| ------------------------------------------------------------------- | -------------------- | ---------- | ---------- | -------------------------------------- |
|
|
| **[AArch64](https://fedoraproject.org/wiki/Architectures/AArch64)** | N/A | Unknown | Linux | gnueabi |
|
|
| **[ARM](https://developer.arm.com/)** | N/A | Unknown | Linux | gnueabihf |
|
|
| **[i686](https://software.intel.com/en-us/)** | N/A | Unknown | Linux | gnu |
|
|
| **[x86_64](http://developer.amd.com/)** | N/A | Unknown | Linux | gnu |
|
|
|
|
[REGION:note]
|
|
Please note that we haven't yet added Engine libraries for the i686 platform.
|
|
[/REGION]
|
|
|
|
### Setting the Environment Variable
|
|
|
|
1. Prior to setting the `LINUX_MULTIARCH_ROOT` environment variable, double-click the **Setup** batch file (`Setup.bat`) to output the appropriate environment variable settings for your computer.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_Step5.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
1. At this point, a new **OutputEnvVars** text file should be located inside of the `v11_clang-5.0.0-centos7` folder.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_Step6.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
[REGION:tip]
|
|
The `OutputEnvVars.txt` file contains useful information for setting your system's environment variable.
|
|
[/REGION]
|
|
|
|
1. Press the **Windows Key** together with the **Pause Break Key** to open the **System Information** menu.
|
|
Now, click the **Advanced System Settings** link to open the **Advanced** sub-menu, which is located in the **System Properties** menu.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_Step8.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
1. Now, click the **Environment Variables...** button.
|
|
|
|

|
|
|
|
1. To add a new **System Variable**, click the **New...** button under the **System variables** list.
|
|
|
|

|
|
|
|
[REGION:note]
|
|
If you haven't opened `OutputEnvVars.txt` yet, please do so before moving onto the next step.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_Step10Note.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
[/REGION]
|
|
|
|
1. After the **New System Variable** dialog menu opens, copy the `LINUX_MULTIARCH_ROOT` environment variable setting into the text boxes for the **New System Variable** dialog.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_Step11.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
1. After returning to the **Evironment Variables** menu, click the **Ok** button to save the `LINUX_MULTIARCH_ROOT` environment variable.
|
|
|
|

|
|
|
|
[REGION:note]
|
|
Please note that if you already have the `LINUX_ROOT` environment variable set, you don't need to delete it because the engine will prioritize `LINUX_MULTIARCH_ROOT` over `LINUX_ROOT` during the packaging process.
|
|
[/REGION]
|
|
|
|
1. Now, click the **OK** button to close the **System Properties** menu.
|
|
|
|

|
|
|
|
[REGION:note]
|
|
Now that you've added a new Environment Variable to your system, you'll need to close and restart all currently running instances of **Visual Studio** and **Command Prompt**.
|
|
[/REGION]
|
|
|
|
### Setting up the Linux Build Configuration
|
|
|
|
If you've never packaged a project for Linux before, you'll want to follow these steps.
|
|
|
|
1. Opening the **Command Prompt**, run `[UE4 ROOT]/Setup.bat` to check for, update, and install prerequisite dependencies for building UE4 from **Visual Studio**.
|
|
|
|

|
|
|
|
1. Run `[UE4 ROOT]/GenerateProjectFiles.bat` to set up the project files for UE4.
|
|
|
|

|
|
|
|
[REGION:warning]
|
|
`GenerateProjectFiles.bat` must be run inside of the root folder that UE4 resides in (`[UE4 ROOT]`). If you run the batch file with [Unreal Game Sync](https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Programs/UnrealGameSync/Deployment.txt), Linux won't show up as a valid **Build Configuration** inside of **Visual Studio**.
|
|
[/REGION]
|
|
|
|
1. Navigating to `[UE4 ROOT]`, double-click **UE4.sln** to open the UE4 solution in **Visual Studio**.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_Step19.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
1. If you haven't built UE4, go ahead and press the **F5** key to build and run UE4 from Visual Studio.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_Step20.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
1. Now, stop running the engine, and go back to **Visual Studio** to select the **Linux** solution platform in Visual Studio. You can build for Linux by pressing the following keyboard combination: **Ctrl+Shift+B**.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_Step21.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
[REGION:note]
|
|
At this point, you should see the toolchain being displayed inside of Visual Studio's **Output Window**.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_Step21Note.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
[/REGION]
|
|
|
|
## Targeting Specific Platforms
|
|
|
|
[REGION:note]
|
|
Because version 4.14 can only target the x86_64 platform, the following section is intended for developers working with version 4.15.
|
|
[/REGION]
|
|
|
|
If you'd like your project to target a specific platform, you'll need to edit your project's [Default Engine Configuration File](Programming/Basics/ConfigurationFiles) file. To do so, navigate to the
|
|
file's location (`[Project Directory]\Config`) and open `DefaultEngine.ini` to add the following lines:
|
|
|
|
[/Script/LinuxTargetPlatform.LinuxTargetSettings]
|
|
TargetArchitecture=X86_64UnknownLinuxGnu
|
|
|
|
Feel free to set `TargetArchitecture` to any of the following values:
|
|
|
|
* X86_64UnknownLinuxGnu
|
|
* ArmUnknownLinuxGnueabihf
|
|
* AArch64UnknownLinuxGnueabi
|
|
|
|
## End Result
|
|
|
|
Congratulations! Moving forward, you should be able to see the cross-compile toolchain being used while packaging your project for Linux.
|
|
|
|
[REGION:lightbox]
|
|
[(w:600)](LinuxXC_EndResult.png)
|
|
[/REGION]
|
|
|
|
[REGION:caption]
|
|
Click for full image.
|
|
[/REGION]
|
|
|
|
Now, you're ready to [compile](Programming/Development/CompilingProjects), [build](Programming/Development/BuildConfigurations), and [package](Engine/Basics/Projects/Packaging) projects for a variety of Linux platforms from your Windows (host) computer.
|
|
|