Errors Building UE5.2 and 5.2 Preview-1

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