Compiling Unreal Engine 4 from source on Windows and Linux
May 2, 2019
Compiling Unreal from source is far easier than people may think. I will be showing you how to compile from source on both Windows and Ubuntu, although it should work on any Linux OS. The process is nearly identical on both systems.
We will be compiling Unreal Engine 4.22 which is, at the time of writing this, the latest version of Unreal and the first to include Ray Tracing support.
Before we begin, make sure to have installed Visual Studio 2017 or 2019 with the tools needed to compile C++ code. Since you're reading this I assume you've already VS installed with the necessary tools.
1) Now you've got your Epic Games and GitHub accounts connected, clone the engine into a folder of your choosing by opening a Git terminal and typing:
2) Enter the folder and run Setup.bat. This might take a few minutes so sit back and chill for a bit, make yourself a cuppa while you wait.
3) After that's complete you'll need to run GenerateProjectFiles.bat and you'll see a new UE4 Visual Studio solution in the directory.
4) Open the UE4 solution file in Visual Studio. Then, all you need to do is click on the UE4 project and then click Run. It will take a few hours to compile, after which the Editor will launch automatically.
1) After you have connected your Epic Games and GitHub accounts, open your terminal and type:
3) Then prepare Unreal to be built using Setup.sh which will download, update and install any needed dependencies. This could take a while.
During this process you'll see a box asking to register Unreal Engine file types. You want to select "Yes".
Once its complete you should see a Success message.
4) Next you need to run:
This will generate the project files needed to compile the engine and shouldn't take too long.
5) And now for the last part, run:
This will take a while from a couple of hours to a few depending on your system specs so go make a cup of tea and watch a movie.
Once that's complete you're ready to run the Editor. Just type:
Unreal now also defaults to use Vulkan as of 4.21 which may not work on older systems. If you're getting any errors about Vulkan such as "Cannot find a compatible Vulkan device or driver." just add -opengl4 as a launch parameter like so:
I have another guide here that goes through overriding Unreal to default back to opengl4 rather than Vulkan. You can read that here:
It'll also be added to your application menu for easier access but I prefer to run it from the command line to see what the engine is actually doing.
The first launch will take a while as the engine verifies and compiles needed shaders. It only has to do this once so future launches will be much quicker.
Congratulations! You've now built Unreal Engine from source!