Linux - Specify clang version?

Hi all,

Is there a way to specify which clang version (binaries) UE4 should use to build the engine? I’m using openSUSE Tumbleweed, which only has clang 3.7, and UE 4.10 cannot be built with it.

I downloaded the prebuilt binaries for 3.6.2 from clang’s official website, but I don’t know how to instruct UE4 to use those binaries, to build the engine. I do not want to remove clang 3.7 from my system.

Thanks for any help you can provide.

Notes:

  • I tried setting the CC and CXX environment variables to point to the prebuilt binaries (clang & clang++, respectively), but this did not work.

Hi,
I just run into that problem and I think I found a way out (at least it began to compile. I let you know if it do the job)
So you need to :

  • edit Engine/Build/BatchFiles/Linux/Setup.sh and replace clang-3.5 by clang-3.7

  • edit Engine/Build/BatchFiles/Linux/BuildThirdParty.sh and replace :

    • CLANG_TO_USE=clang-3.5 by CLANG_TO_USE=clang-3.7
    • CLANGXX_TO_USE=clang+±3.5 by CLANGXX_TO_USE=clang+±3.7
  • edit Engine/Source/Programs/UnrealBuildTool/Linux/LinuxToolChain.cs and replace
    string[] ClangNames = { “clang++”, “clang+±3.5”, “clang+±3.3” };
    by
    string[] ClangNames = { “clang++”, “clang+±3.5”, “clang+±3.3”, “clang+±3.7”};

  • in the same file comment 4 lines by replacing :

    throw new BuildException(
    string.Format(“This version of the Unreal Engine can only be compiled with clang 3.6 and 3.5. clang {0} may not build it - please use a different version.”,
    CompilerVersionString)
    );

by

//throw new BuildException(
				          //string.Format("This version of the Unreal Engine can only be compiled with clang 3.6 and 3.5. clang {0} may not build it - please use a different version.",
				          //CompilerVersionString)
				          //);
  • (Edit) same file again line 343, add the following lines :

    if (CompilerVersionGreaterOrEqual(3, 7, 0))
    {
    Result += " -Wno-shift-negative-value"; // Triggered by ThirdParty/libJPG due to usage of: (-1) << …
    }

Then you can follow the normal build instruction.

Ok doing that, I get the error quote here here so it seems you also need to edit again “./Engine/Source/Programs/UnrealBuildTool/Linux/LinuxToolChain.cs” and add this at the line 343

if (CompilerVersionGreaterOrEqual(3, 7, 0))
 {
     Result += " -Wno-shift-negative-value"; // Triggered by ThirdParty/libJPG due to usage of: (-1) << ...
 }

now I need do run GenerateProjectFiles.sh and recompile again so lets go for a few hours again. I’ll edit my answer if it works.

Ok it worked. I updated my above answer.

Ty for the help :slight_smile: