Error while making Unreal Engine from github in Ubuntu Linux

I’m following the instructions on the Unreal “Building On Linux” page (https://wiki.unrealengine.com/Building_On_Linux#Getting_Started), but I’m coming to an error after typing in “make” in a Linux terminal.

BEHAVIOR
The terminal outputs with the following error in the beginning of the make:

Building UnrealLightmass…
Performing 4 actions (8 in parallel)
[3/4] Compile Module.UnrealLightmass.1_of_3.cpp
[1/4] Compile Module.UnrealLightmass.2_of_3.cpp
[2/4] Compile Module.UnrealLightmass.3_of_3.cpp
In file included from /media/jesse/Games/UnrealEngine-4.16.1-release/Engine/Intermediate/Build/Linux/B4D820EA/UnrealLightmass/Development/UnrealLightmass/Module.UnrealLightmass.1_of_3.cpp:2:
In file included from /media/jesse/Games/UnrealEngine-4.16.1-release/Engine/Source/Programs/UnrealLightmass/Private/CPUSolver/CPUSolver.cpp:4:
In file included from Programs/UnrealLightmass/Private/ImportExport/LightmassScene.h:8:
In file included from Programs/UnrealLightmass/Private/Lighting/Lighting.h:6:
In file included from Programs/UnrealLightmass/Private/LightmassCore/LMCore.h:12:
Programs/UnrealLightmass/Private/LightmassCore/Misc/LMStats.h:11:27: error: definition of builtin function ‘__rdtsc’
inline unsigned long long __rdtsc()
^
In file included from /media/jesse/Games/UnrealEngine-4.16.1-release/Engine/Intermediate/Build/Linux/B4D820EA/UnrealLightmass/Development/UnrealLightmass/Module.UnrealLightmass.2_of_3.cpp:2:
In file included from /media/jesse/Games/UnrealEngine-4.16.1-release/Engine/Source/Programs/UnrealLightmass/Private/Lighting/LightmapData.cpp:3:
In file included from Programs/UnrealLightmass/Private/Lighting/LightmapData.h:7:
In file included from Programs/UnrealLightmass/Private/ImportExport/LightmassScene.h:8:
In file included from Programs/UnrealLightmass/Private/Lighting/Lighting.h:6:
In file included from Programs/UnrealLightmass/Private/LightmassCore/LMCore.h:12:
Programs/UnrealLightmass/Private/LightmassCore/Misc/LMStats.h:11:27: error: definition of builtin function ‘__rdtsc’
inline unsigned long long __rdtsc()
^
In file included from /media/jesse/Games/UnrealEngine-4.16.1-release/Engine/Intermediate/Build/Linux/B4D820EA/UnrealLightmass/Development/UnrealLightmass/Module.UnrealLightmass.3_of_3.cpp:2:
In file included from /media/jesse/Games/UnrealEngine-4.16.1-release/Engine/Source/Programs/UnrealLightmass/Private/Lighting/VolumeDistanceField.cpp:5:
In file included from Programs/UnrealLightmass/Private/Lighting/LightingSystem.h:8:
In file included from Programs/UnrealLightmass/Private/Lighting/Cache.h:8:
In file included from Programs/UnrealLightmass/Private/Lighting/Lighting.h:6:
In file included from Programs/UnrealLightmass/Private/LightmassCore/LMCore.h:12:
Programs/UnrealLightmass/Private/LightmassCore/Misc/LMStats.h:11:27: error: definition of builtin function ‘__rdtsc’
inline unsigned long long __rdtsc()
^
1 error generated.
1 error generated.
1 error generated.

EXPECTED BEHAVIOR
For make to perform successfully and files to be created without error.

BUG DISCOVERED USING
Unreal Engine 4.16.1 source code from github
Ubuntu (GNOME) 17.04 x64
Linux kernel 4.10.0-21-generic

EDIT
I should have also added the steps to reproduce:
(1) Download & unzip Unreal Engine 4.16.1 from github
(2) Open a terminal and change directory to the unzipped directory
(3) Type “./Setup.sh” to run set-up
(4) Type “./GenerateProjectFiles.sh”
(5) Type “make” and hit ENTER.

OpenSuse, same error :
Ureal Engine 4 | Building version 4.16 with clang 4.0.0

Hi,
I also met the very same problem on Gentoo Linux.
gee…

But I just did a “git pull” from release channel instead of downloading a zip.
The rest to reproduce are the same.

Same on Manjaro

Release Branch

EDIT: clang v4.x was installed. I give it a try with v3.5.2

Yes. Using clang v3.5.2 libUnrealLightmass built successfully.

Build is not finished yet…but now it is. And it compiled successfully.

Solution for me on Manjaro Linux
**
Use clang v3.5.2 instead of v4.0.0**

The earliest version of the clang package that Ubuntu 17.04 has is 3.7.1. No 3.5.x at all… any suggestions?

Trying to make Unreal Engine 4.16.1 with clang 3.7.1 results in “Unhandled Exception” errors.

My build said clang 3.9.1 I had messaged the epic team at release. I was able to re make the executables after. I could start the UE4 Front end, but couldnt start editor.
After install I.
make ./UE4Editor
make ./UE4Frontend
etc.
Was only able to start front end. unable to load, and start project.
Stuck Hating Windows 10. Worst OS I have ever used in my life.
I absolutely cannot deal with Windows. Post XP. Things really disgust me.
I offered to mail a 50$ gift card to restaraunt of choice for an actual linux build.
At this point I would pay extra for a launcher, and built for linux, or Debian install package in UE4.
Maybe we can crowdfund a “for Linux” build on UE4 with launcher.

@thadkinsjr, that’d be AWESOME if they started offering distro support for popular Linux distros. In fact, that would kinda be the ideal support method, rather than just releasing source, IMHO. Unity offers .deb package builds for Ubuntu (unsure about Debian).

UPDATE:
Seems like I had four different clang versions installed on my PC? 3.7, 3.8, 3.9, and 4.0. I uninstalled 3.7, and it seems that “make” used clang 3.9.1 for the build… which seems to be getting past that error. Some relevant Terminal output, I believe:

Building UnrealLightmass…
Creating makefile for UnrealLightmass (no existing makefile)
Using clang version ‘3.9.1’ (string), 3 (major), 9 (minor), 1 (patch)
Using bundled libc++ standard C++ library.
Using fast way to relink circularly dependent libraries (no FixDeps).
Performing 46 actions (8 in parallel)
[3/46] Compile PCH.CoreUObject.h
[1/46] Compile PCH.Core.h
[5/46] Compile Module.UnrealLightmass.2_of_3.cpp
[2/46] Compile SharedPCH.Core.h
[6/46] Compile Module.UnrealLightmass.3_of_3.cpp
[4/46] Compile SharedPCH.CoreUObject.h
[7/46] Compile Module.UnrealLightmass.1_of_3.cpp
[8/46] Compile Module.Json.cpp

In short, for Ubuntu 17.04+ users, removing Clang 3.7 and making sure Clang 3.9 is installed could be a possible fix for make issues with 4.16.1.

I would rather use UE4 on Windows 10. Than Unity on Linux. That says a lot about the Epic team, and is the greatest compliment I could give any software developer. Because I dislike windows since almost forever. It takes so much work to use this with the mass load of distractions. I’m just patiently waiting for them to release notes that they made a fix. I need to create a very diabolical plan in motion in order to get the Epic team to build a core Linux distro.

Ok so if you are on an Ubuntu 17.04 you may have Clang 4.0 or more versions installed. Remove them all and install 3.9 and then compile.
apt-get install clang-3.9
Make sure you don’t compile as root unless you know what you are doing to your system.
Cheers
George

I found a guy that fixed the problem here: https://github.com/EpicGames/UnrealEngine/pull/3672

Thank you portaloffreedom!

If you have a local git checkout, here’s how to apply the fix yourself (While waiting for the PR to be merged):

That’s a great initative. If you can make Autodesk Maya make their install packages to be debs and not RPMs, count me in haha. Meanwhile I’m in team CentOS.
Crowfunding to motivate Developers to pay us more attention would be great, but instead of a deb, I would suggest a .run to be more Linux-wide.