Errors Building UE5.2 and 5.2 Preview-1

Hello, am getting two FAILS at building the source for 5.2.
Mainly Unsync and UE5ProgramRules.

Unsync.vcxproj
Fails like this:

Build started...
16>Building Unsync...
6>Using Visual Studio 2022 14.34.31942 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933) and Windows 10.0.22000.0 SDK (C:\Program Files (x86)\Windows Kits\10).
6>Determining max actions to execute in parallel (8 physical cores, 16 logical cores)
6>  Executing up to 8 processes, one per physical core
6>Building 3 actions with 3 processes...
6>[1/3] Link [x64] unsync.exe cancelled
6>[2/3] WriteMetadata unsync.target cancelled
6>[3/3] Compile [x64] UnsyncCore.cpp
6>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "..\..\Build\BatchFiles\Build.bat Unsync Win64 Development -WaitMutex -FromMsBuild" exited with code 6.
6>Done building project "Unsync.vcxproj" -- FAILED.

And UE5ProgramRules reports an error in ShaderCompileWorker.Build.cs line 35:
RuntimeDependencies.Add(DirectX.GetDllDir(Target) + “d3dcompiler_47.dll”);
as the name "DirectX"does not exist in current content.

I have been building UE5 source since 5.0 and this is the first time I get this, can someone please help me?

Am wondering if it is VS 2022 Version 17.4.5?
Ohh and am trying to build in Win11

1 Like

I am having the exact same build error on the current 5.1.1 release branch using VS 2022 Version 17.4.4 and using Win10. Every other project compiled successfully. I’m going to try and start commenting out function bodies to see if I can track it down.

We tried to build UE5.2 and got the same errors.

  • OS: Win10 and Win11
  • Visual Studio Enterprise 2022 17.5.1
  • Windows 10.0.22621.0 SDK

For the DirectX error we used the hotfix reverting Engine\Source\Programs\ShaderCompileWorker\ShaderCompilerWorker.Build.cs. Otherwise replace line 34 with
RuntimeDependencies.Add(Path.Combine(Target.RelativeEnginePath, "Binaries/ThirdParty/Windows/DirectX/x64/d3dcompiler_47.dll"));
Somehow Engine\Source\ThirdParty\Windows\DirectX\DirectX.Build.cs is not loaded.

For Unsync we could track it down to Engine\Source\Programs\Unsync\Private\UnsyncCore.cpp. You can either comment lines 486-489, which removes all uses of the template ComputeBlocksVariableT and obviously functionality

UnsyncCore.cpp:486-489
		//case EWeakHashAlgorithmID::Naive:
		//	return ComputeBlocksVariableT<FRollingChecksum>(Reader, BlockSize, StrongHasher, OutMacroBlocks);
		//case EWeakHashAlgorithmID::BuzHash:
		//	return ComputeBlocksVariableT<FBuzHash>(Reader, BlockSize, StrongHasher, OutMacroBlocks);

or inside ComputeBlocksVariableT you can comment lines 301, 306-376.

UnsyncCore.cpp:299-376
			FGenericBlock CurrentMacroBlock;
			CurrentMacroBlock.HashStrong.Type = EHashType::Blake3_160;
			//CurrentMacroBlock.Offset		  = Task.Offset;

			blake3_hasher MacroBlockHasher;
			blake3_hasher_init(&MacroBlockHasher);

			/*auto ScanFn =
				[MacroBlockHashThreshold,
						   MaximumMacroBlockSize,
						   MaximumBlockSize,
						   MinimumMacroBlockSize,
						   DataEnd,
						   &LastBlockEnd,
						   &Task,
						   DataBegin,
						   StrongHasher,
						   TargetMacroBlockSize,
						   &MacroBlockHasher,
						   &CurrentMacroBlock](const uint8* WindowBegin, const uint8* WindowEnd, uint32 WindowHash)
							  UNSYNC_ATTRIB_FORCEINLINE {
								  // WARNING: Changing this invalidates some of the previously cached blocks.
								  // TODO: compute based on target average block size
								  const uint32 ChunkWindowHashThreshold = 0x20000;

								  const bool   bLastBlock	 = WindowEnd == DataEnd;
								  const uint64 ThisBlockSize = uint64(WindowEnd - LastBlockEnd);

								  if (ThisBlockSize >= MaximumBlockSize || WindowHash < ChunkWindowHashThreshold || bLastBlock)
								  {
									  FGenericBlock Block;
									  Block.Offset	   = Task.Offset + uint64(LastBlockEnd - DataBegin);
									  Block.Size	   = CheckedNarrow(ThisBlockSize);
									  Block.HashWeak   = WindowHash;
									  Block.HashStrong = ComputeHash(LastBlockEnd, ThisBlockSize, StrongHasher);

									  if (TargetMacroBlockSize)
									  {
										  blake3_hasher_update(&MacroBlockHasher, LastBlockEnd, ThisBlockSize);
										  CurrentMacroBlock.Size += Block.Size;

										  uint32 HashStrong32 = 0;
										  memcpy(&HashStrong32, Block.HashStrong.Data, 4);

										  if ((CurrentMacroBlock.Size >= MinimumMacroBlockSize && HashStrong32 < MacroBlockHashThreshold) ||
											  (CurrentMacroBlock.Size + Block.Size > MaximumMacroBlockSize) || bLastBlock)
										  {
											  // Commit the macro block
											  blake3_hasher_finalize(&MacroBlockHasher,
																	 CurrentMacroBlock.HashStrong.Data,
																	 sizeof(CurrentMacroBlock.HashStrong.Data));
											  Task.MacroBlocks.push_back(CurrentMacroBlock);

											  // Reset macro block state
											  blake3_hasher_init(&MacroBlockHasher);
											  CurrentMacroBlock.Offset += CurrentMacroBlock.Size;
											  CurrentMacroBlock.Size = 0;
										  }
									  }

									  if (!Task.Blocks.empty())
									  {
										  UNSYNC_ASSERT(Task.Blocks.back().Offset + Task.Blocks.back().Size == Block.Offset);
									  }

									  Task.Blocks.push_back(Block);

									  LastBlockEnd = WindowEnd;

									  return true;
								  }
								  else
								  {
									  return false;
								  }
							  };

			HashScan<WeakHasher>(DataBegin, ThisTaskSize, MinimumBlockSize, ScanFn);*/

Maybe it helps to identify the real issue.

EDIT:

It’s a name conflict between struct Task (line 245) and the local variable task (lines 293ff). You can either rename the structure to i.e. struct TaskBlocks (lines 245, 252, 392, 403), or rename the local variable to i.e. _Task (lines 293-364).

EDIT2:

Since Feb 21 2023 it’s already fixed in ue5-main branch: https://github.com/EpicGames/UnrealEngine/commit/f89d532f0845007b8cf0d2d3d71b8fb9eccfebc4.

7 Likes

Both errors still exist as of 5.2.0 Release and commit 407acc04a93f09ecb42c07c98b74fd00cc967100.

But thanks for the fixes, it took a while before I found this thread and I now have 5.2.0 release working.

I choose to rename the local variable (Ctrl-R-R is such a beautiful thing).

1 Like

The 5.2.0 release is missing the DirectX project build file.
Get it from Github and place in:

.../Engine/Source/ThirdParty/Windows/DirectX/DirectX.Build.cs
1 Like

Get it from where?

If you’re missing that file (I wasn’t) you’ll need to get access to the Epic Games GitHub, as described here. You can then download the source as a ZIP file, or clone it locally. You’ll then have the missing file.

@PhDittmann Thank you for the edits! This issue made it to the 5.2.0 Release, so I’m trying those changes now!

Excellent, thank you for pointing out the solutions.

Thanks for the fixes. These errors still exists in 5.2.1

1 Like

Thank you!