Build from source fails (VulkanSDK)

I’m trying to build UE4 with Vulkan support from source, following the instructions on the Wiki but get the following errors:

1>------ Build started: Project: ShaderCompileWorker, Configuration: Development_Program x64 ------
1>  Creating makefile for ShaderCompileWorker (no existing makefile)
1>  Target is up to date
2>------ Build started: Project: UE4, Configuration: Development_Editor x64 ------
2>  Creating makefile for UE4Editor (no existing makefile)
2>  Performing 2 actions (4 in parallel)
2>  Module.VulkanRHI.cpp
2>C:\VulkanSDK\1.0.26.0\Include\vulkan/vulkan.h(4084): error C2872: 'DWORD': ambiguous symbol
2>  C:\Program Files (x86)\Windows Kits\8.1\include\shared\minwindef.h(156): note: could be 'unsigned long DWORD'
2>  c:\unrealengine\engine\source\runtime\core\public\Misc/DisableOldUETypes.h(34): note: or       'DoNotUseOldUE4Type::DWORD'
2>ERROR : UBT error : Failed to produce item: C:\UnrealEngine\Engine\Binaries\Win64\UE4Editor-VulkanRHI.dll
2>  Total build time: 53,64 seconds
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(41,5): error MSB3075: The command "..\..\Build\BatchFiles\Build.bat UE4Editor Win64 Development -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 1 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

Hey TK3D,

The master branch on GitHub is not guaranteed to compile. It has many changes a day that could (and will) fail to compile.

If you are developing seriously, I highly recommend that you use the latest stable branch, which is 4.13.

If this compiling issue happens to you when using a stable release, please make another thread in Bug Reports.

Hi,

Had the same problem when trying to compile 4.13 and 4.13.1 from the release branch. The problem is that there is a DWORD type variable in the vulkan.h file. However UE4 declares the DWORD type inside the DoNotUseOldUE4Type namespace thus causing the ambiguity.

In the comment :

/// Trick to prevent people from using
old UE4 types (which are still defined
in Windef.h on PC

As a dirty hack, I replaced the line n° 4084 in vulkan.h with

#ifdef __cplusplus
	::DWORD                         dwAccess;
#else
	DWORD                         dwAccess;
#endif

This allowed me to compile without any error.

Hope that helps.

I just now got the chance to try out the release branch to see if the compiling errors would persist and this was the case. Thank you very much for sharing your fix, it worked.

Had this error too. For me it was, that I seemed to have a Vulkan SDK installed on my machine, that was not the version that Unreal Engine needs. I Removed the VULKAN_SDK environment variable and now the build works.

Alternatively, you could just change “bSDKInstalled = false” in Source/Runtime/VulkanRHI/VulkanRHI.Build.cs

What exactly would setting “bSDKInstalled = false” result in? Will UE still compile with Vulkan support, if you have the right version of the SDK installed? Or just skip the Vulkan integration and compile without it?

Then this line is used “AddEngineThirdPartyPrivateStaticDependencies(Target, “Vulkan”);” which will add the Vulkan source from Engine/Source/ThirdParty/Vulkan. So yes, it will still compile with vulkan support, but not use your locally installed SDK, but the one that is delivered in the engine’s ThirdParty folder

Thanks, much appreciated.