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.

If you haven’t already you will need to sign up for a GitHub account and link your account to your Epic Games account. Follow the instructions on this page to do it: https://www.unrealengine.com/en-US/ue4-on-github

Windows

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:

git clone https://github.com/EpicGames/UnrealEngine.git --branch 4.22

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.

Linux

1) After you have connected your Epic Games and GitHub accounts, open your terminal and type:

git clone https://github.com/EpicGames/UnrealEngine.git --branch 4.22

2) After that, enter into the folder with:

cd UnrealEngine

3) Then prepare Unreal to be built using Setup.sh which will download, update and install any needed dependencies. This could take a while.

./Setup.sh

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:

./GenerateProjectFiles.sh

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:

make

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:

./Engine/Binaries/Linux/UE4Editor

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:

./Engine/Binaries/Linux/UE4Editor -opengl4

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!

What I would suggest doing now is going over to my other post on speeding up the shader compile times. This requires a source built version of the engine so, why not?


3 Comments

Fixing Unreal Engine: Vulkan Device Not Available | Rhyce Smith · 16 May 2021 at 2:35 pm

[…] just spent a few hours waiting for Unreal to compile, if you haven’t done that, you can do it here, you go to launch it and you’re faced with this message thanks to […]

Enable OpenGL, and disable Vulkan, in Unreal Engine 4.25 | Rhyce Smith · 16 May 2021 at 2:59 pm

[…] If you’re reading this then you’ve probably already compiled the source for Unreal but if you haven’t, you can do that here: Compiling Unreal Engine 4 from source on Windows and Linux. […]

The Unreal Engine 5 Early Access Preview is here! · 28 May 2021 at 3:55 am

[…] see more posts at the bottom of this page and in the sidebar. A couple of suggestions are Compiling Unreal Engine 4 from source on Windows and Linux and Improving UE4 Shader Compile […]

Comments are closed.