Compiling the engine from source on Linux and getting a error of "make*** Error 6"

Hi there, I’d like to run Unreal Editor on my machine which is running Fedora 34, everything is fine when I was running ./Setup.sh and ./GenerateProjectFiles.sh, but after I started to run the make command, I got this error :

Performing 7 actions (8 in parallel)
[1/7] Compile Module.ShaderCompilerCommon.cpp
In file included from /home/airrinascimento/文件/Unreal Engine/UnrealEngine-ue5-early-access/Engine/Intermediate/Build/Linux/B4D820EA/ShaderCompileWorker/Development/ShaderCompilerCommon/Module.ShaderCompilerCommon.cpp:6:
In file included from /home/airrinascimento/文件/Unreal Engine/UnrealEngine-ue5-early-access/Engine/Source/Developer/ShaderCompilerCommon/Private/HlslUtils.cpp:11:
In file included from Developer/ShaderCompilerCommon/Public/ShaderCompilerCommon.h:6:
In file included from Runtime/RenderCore/Public/UniformBuffer.h:9:
In file included from Runtime/RenderCore/Public/ShaderParameterMacros.h:10:
In file included from Runtime/RenderCore/Public/ShaderParameterMetadata.h:12:
In file included from Runtime/RHI/Public/RHI.h:2390:
/home/airrinascimento/文件/Unreal Engine/UnrealEngine-ue5-early-access/Engine/Source/Runtime/RHI/Public/RHIResources.h:2910:5: error: expected class member or base class name
                , ArraySize(InArraySize)
                  ^
/home/airrinascimento/文件/Unreal Engine/UnrealEngine-ue5-early-access/Engine/Source/Developer/ShaderCompilerCommon/Private/HlslLexer.cpp:13:26: note: expanded from macro 'ArraySize'
#define ArraySize(array) (sizeof(ArraySizeHelper(array)))
                         ^
1 error generated.
make: *** [Makefile:763:ShaderCompileWorker] Error 6

Is there anyone who knows how to deal with this problem?
I’ve just searched google, but it doesn’t help.

1 Like

could you please try compiling some parts to see if it succeeds, thus making sure that everything is working.
make ARGS="-clean" UnrealLightmass && make UnrealLightmass
make ARGS="-clean" ShaderCompileWorker && make ShaderCompileWorker

if any of the above steps fails could you link more log with something like to pastebin.
I too have a fedora 34 setup on another ue5 branch.
Also for every cpu thread you should have around 2gb of ram.

Try these also:

  1. do you have full folder permissions the source directory
  2. change Unreal Engine to UnrealEngine
  3. redownload the sdk (here)

Hope that you are not on the ue5-main branch as this is too bleeding edge to work on linux unless you know to work in engine source.

Hi! Have you find a way to fix this bug, I just meet same bug with you. If you fixed this. Can you tell me how to do thank you!

I finally change source code of HlslLexer.cpp. because of the stupid compiler.image|568x330
The initialize function of FRHITextureCreateInfo that init “ArraySize” member.
I just wander why does this compiler will treat class member as macro.

Morning :slight_smile:

I have the exact same issue, but I don’t understand how to fix it. I went to HlslLexer.cpp and try few things but none of them work… would you mind explaining to me how you fixed it? (I am using Debian 11)

Running command : Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool ShaderCompileWorker Linux Development
Linux using Manual SDK v17_clang-10.0.1-centos7
Using 'git status' to determine working set for adaptive non-unity build (/xxx/UnrealEngine-5.0.0-early-access-1).
Building ShaderCompileWorker...
Performing 7 actions (16 in parallel)
[1/7] Compile Module.ShaderCompilerCommon.cpp
In file included from /xxx/UnrealEngine-5.0.0-early-access-1/Engine/Intermediate/Build/Linux/B4D820EA/ShaderCompileWorker/Development/ShaderCompilerCommon/Module.ShaderCompilerCommon.cpp:6:
In file included from /xxx/UnrealEngine-5.0.0-early-access-1/Engine/Source/Developer/ShaderCompilerCommon/Private/HlslUtils.cpp:11:
In file included from Developer/ShaderCompilerCommon/Public/ShaderCompilerCommon.h:6:
In file included from Runtime/RenderCore/Public/UniformBuffer.h:9:
In file included from Runtime/RenderCore/Public/ShaderParameterMacros.h:10:
In file included from Runtime/RenderCore/Public/ShaderParameterMetadata.h:12:
In file included from Runtime/RHI/Public/RHI.h:2390:
/xxx/UnrealEngine-5.0.0-early-access-1/Engine/Source/Runtime/RHI/Public/RHIResources.h:2910:5: error: expected class member or base class name
                , ArraySize(InArraySize)
                  ^
/xxx/UnrealEngine-5.0.0-early-access-1/Engine/Source/Developer/ShaderCompilerCommon/Private/HlslLexer.cpp:15:26: note: expanded from macro 'ArraySize'
#define ArraySize(array) (sizeof(ArraySizeHelper(array)))
                         ^
1 error generated.
make: *** [Makefile:763 : ShaderCompileWorker] Erreur 6

Adding some information:

  • RHI means “Rendering Hardware Interface”
  • The issue is in /Engine/Source/Runtime/RHI/Public/RHIResources.h
  • More precisely, in the constructor of the class FRHITextureCreateInfo
	FRHITextureCreateInfo() = default;
	FRHITextureCreateInfo(
		ETextureDimension InDimension,
		ETextureCreateFlags InFlags,
		EPixelFormat InFormat,
		FIntPoint InExtent,
		FClearValueBinding InClearValue,
		uint16 InDepth = 1,
		uint16 InArraySize = 1,
		uint8 InNumMips = 1,
		uint8 InNumSamples = 1)
		: ClearValue(InClearValue)
		, Dimension(InDimension)
		, Flags(InFlags)
		, Format(InFormat)
		, Extent(InExtent)
		, Depth(InDepth)
		, ArraySize(InArraySize) //line 2910 which cause the issue
		, NumMips(InNumMips)
		, NumSamples(InNumSamples)
	{}
  • The class FRHITextureCreateInfo does not exist in UE4 RHIResources.h
  • The ArraySize(InArraySize) is looking for its definition in /Engine/Source/Developer/ShaderCompilerCommon/Private/HlslLexer.cpp
namespace CrossCompiler
{
	template <typename T, size_t N>
	char (&ArraySizeHelper(T (&array)[N]))[N];
#define ArraySize(array) (sizeof(ArraySizeHelper(array)))
#define MATCH_TARGET(S) S, (int32)ArraySize(S) - 1
(...)
  • I’m still stuck in this ShaderCompileWorker building part…

Thanks in advance for any help

Ok, I got it…

#undef ArraySize

It needs to be added where the ArraySize macro is causing the issue: RHIResources.h
( path = …/Engine/Source/Runtime/RHI/Public/RHIResources.h)

// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "CoreTypes.h"
#include "Misc/AssertionMacros.h"
#include "HAL/UnrealMemory.h"
#include "Containers/Array.h"
#include "Misc/Crc.h"
#include "Containers/UnrealString.h"
#include "UObject/NameTypes.h"
#include "Math/Color.h"
#include "Containers/StaticArray.h"
#include "HAL/ThreadSafeCounter.h"
#include "RHIDefinitions.h"
#include "Templates/RefCounting.h"
#include "PixelFormat.h"
#include "Containers/LockFreeList.h"
#include "Misc/SecureHash.h"
#include "Hash/CityHash.h"
#include "Async/TaskGraphInterfaces.h"
#include "Serialization/MemoryImage.h"

#define DISABLE_RHI_DEFFERED_DELETE 0

#undef ArraySize //--------------------------------------------new line added

struct FClearValueBinding;
struct FRHIResourceInfo;
struct FGenerateMipsStruct;
enum class EClearBinding;

/** The base type of RHI resources. */
class RHI_API FRHIResource
{
public:
	FRHIResource(bool InbDoNotDeferDelete = false)
		: MarkedForDelete(0)
		, bDoNotDeferDelete(InbDoNotDeferDelete)
		, bCommitted(true)
	{
	}
(...)

I.T. is amazing.

Now I have:

make: *** [Makefile:1048 : UnrealEditor] Erreur 6

Line 1047 & 1048 of Makefile:

UnrealEditor:
	 $(BUILD) UnrealEditor Linux Development  $(ARGS)

Yay, new problem, new game. Trying this solution.

Doesn’t work… so the issue is:

Compile Module.DirectLink.cpp
In file included from .../UnrealEngine-ue5-early-access/Engine/Plugins/Experimental/GeometryProcessing/Intermediate/Build/Linux/B4D820EA/UnrealEditor/Development/GeometryAlgorithms/Module.GeometryAlgorithms.cpp:27:
.../UnrealEngine-ue5-early-access/Engine/Plugins/Experimental/GeometryProcessing/Source/GeometryAlgorithms/Private/ThirdParty/GTEngine/Mathematics/GteTetrahedronKey.cpp:78:27: error: explicit specialization of 'TetrahedronKey' after instantiation
    TetrahedronKey<true>::TetrahedronKey(int v0, int v1, int v2, int v3)
                          ^
.../UnrealEngine-ue5-early-access/Engine/Plugins/Experimental/GeometryProcessing/Source/GeometryAlgorithms/Private/ThirdParty/GTEngine/Mathematics/GteTSManifoldMesh.cpp:73:26: note: implicit instantiation first required here
    TetrahedronKey<true> skey(v0, v1, v2, v3);
                         ^
[871/2990] Compile Module.DMXProtocol.gen.cpp
[872/2990] Compile Module.MaterialBaking.gen.cpp
[873/2990] Compile Module.DatasmithContent.cpp
1 error generated.

Shouldn’t be that hard to fix…

Ok… the solution I found was… downloading the right version of UE5 through GitHub :sweat_smile:

git clone --branch 5.0 --single-branch git@github.com:<user>/UnrealEngine.git

Now it’s working! :smiley:

Weird, im trying to compile same branch and getting same error.

Got it working, i used InstalledBuild instead of normal make and it worked, not sure whats the difference. Looks like it gona work on ue5-main branch also.
My script:

./UnrealEngine/Engine/Build/BatchFiles/RunUAT.sh BuildGraph -target="Make Installed Build Linux" -script=./Engine/Build/InstalledEngineBuild.xml -set:WithAndroid=false -set:WithIOS=false -set:WithTVOS=false -set:WithLinuxArm64=false -set:WithDDC=false -set:WithFullDebugInfo=true -set:GameConfigurations=Development

Upd: confirmed works on ue5-main branch.