Clang fails to build Unreal engine 4.12 preview 2 on Fedora Linux 23

I’m trying to use the unreal engine under linux. As building is the only option for fedora, that’s what I do. However despite installing all required dependencies and claims of people successfully building unreal engine on Linux, I have trouble with it myself.

Specifically, clang 3.7 fails to build. The log is very long, but the first error message is pasted here : UE4.12 pre 2 Building Error - Pastebin.com Basically the compiler itself make a segfault ? And if I believe the word “InstantiateFunctionDefinition”, it crashes while trying to instantiate a function. Either UE4 has very weird functions or clang was given very weird option. But actually I don’t really understand.

I’ve seen this question , but the accepted (and only) answer simply repeats what is said on the wiki which is not helpful. I tried to build 4 times. Thank you for any help to successfully build this marvellous piece of software !

Oh, and just to be clear :

%uname -r
4.4.9-300.fc23.x86_64
%clang --version
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-redhat-linux-gnu
Thread model: posix
% git log -1 --oneline --decorate
ab237f4 (tag: 4.12.0-release) Merging final 4.12.0 release

Hey laerne-

It appears that clang 3.7.x that’s shipped with Fedora is causing the crash during compile. Can you let me know if you’re able to install a different version of clang and then install the engine?

Thank you. I tried to install clang, 3.5.1, but it conflicts with the runtime llvm 3.7, of which many packages depend, including qtcreator and steam. For clear development reasons, I’d like them to be installed alongside UE4. I’ll try to install a version outside of the package manager, when I find out every single environment variable I must tweak in order to do so.

Okay, finally got it working. I had to build clang 3.5.2 and use environment variables. Here are the steps :

  • Go here : LLVM Download Page, scroll to LLVM 3.5.2 and download the source. That implies at least files llvm-3.5.2.src.tar.xz and cfe-3.5.2.src.tar.xz. I also downloaded libcxx, libcxxabi clang-tools-extra compiler-rt to have a full clang suite.

  • Follow the instruction here Clang - Getting Started to build clang. Buit instead of using SVN to checkout the latest clang version, use tar xf to extract them to the relevant places. For instance, assuming all you source archive are in the local folder archive do something like this :

    tar xf archives/llvm-3.5.2.src.tar.xz
    mv llvm-3.5.2.src llvm
    tar xf archives/cfe-3.5.2.src.tar.xz
    tar xf archives/clang-tools-extra-3.5.2.src.tar.xz
    tar xf archives/compiler-rt-3.5.2.src.tar.xz
    tar xf archives/libcxx-3.5.2.src.tar.xz
    tar xf archives/libcxxabi-3.5.2.src.tar.xz
    mv cfe-3.5.2.src llvm/tools/clang
    mv clang-tools-extra-3.5.2.src llvm/tools/clang/tools/extra
    mv compiler-rt.3.5.2.src llvm/projects/compiler-rt
    mv libcxx-3.5.2.src llvm/projects/libcxx
    mv libcxxabi-3.5.2.src llvm/projects/libcxxabi

Then,

mkdir llvm/build
cd llvm/build
cmake ..
make

Now compiling the project do work, I won’t repeat what the wiki says, just follow the instruction with the terminal with the correct environment variables set.