Download

UnrealBuildTool.exe read only build issue for UE5 from Perforce

During my upgrade of a UE4 source build from Perforce project to UE5 I encountered an error at the very first step during GenerateProjectFiles.bat because the UnrealBuildTool.exe was read only and could not be modified in the /Engine/Source/Prrograms/UnrealBuildTool/obj folder where it looks like it’s created. This happens only when using the bootstrap scripts, I can open the project and build it manually in DevStudio just fine.

It turns out that the UnrealBuildTool.exe in that folder starts its life as a renamed copy of apphost.exe from the Binaries folder and the bootstrap scripts assume this is writable, which is not the case unless you have a always writable workspace or the filetype of these are set to writable in Perforce by either global typemap or an individual setting on the file.

The solution is to make the apphost.exe files writable, which mirrors what Epic does in their own Perforce depot with these files.

I am pasting the errors how this manifests itself for others that might encounter this in the future. It would be nice if Epic could provide an update to date filetype “map” of their Perforce depot so users of it could mirror their Perforce setup.

2021.07.02 11:38:38    INFO  Running AutomationTool...
2021.07.02 11:38:38    INFO  Using bundled DotNet SDK
2021.07.02 11:38:38    INFO  Building UnrealBuildTool...
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Platforms\XboxOneGDK\Source\Programs\UnrealBuildTool\XboxOneGDKDeploy.cs(36,25): warning CS8600: Converting null literal or possible null value to non-nullable type. [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Platforms\XboxOneGDK\Source\Programs\UnrealBuildTool\XboxOneGDKDeploy.cs(55,55): warning CS8602: Dereference of a possibly null reference. [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Platforms\XboxOneGDK\Source\Programs\UnrealBuildTool\XboxOneGDKDeploy.cs(55,103): warning CS8602: Dereference of a possibly null reference. [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018: The "CreateAppHost" task failed unexpectedly. [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018: System.AggregateException: One or more errors occurred. (Access to the path 'E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\obj\Development\UnrealBuildTool.exe' is denied.) (Access to the path 'E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\obj\Development\UnrealBuildTool.exe' is denied.) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:  ---> System.UnauthorizedAccessException: Access to the path 'E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\obj\Development\UnrealBuildTool.exe' is denied. [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile(String path, FileMode mode, String mapName, Int64 capacity, MemoryMappedFileAccess access) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile(String path) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.<>c__DisplayClass2_0.<CreateAppHost>g__RewriteAppHost|0() [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.HostModel.RetryUtil.RetryOnIOError(Action func) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost(String appHostSourceFilePath, String appHostDestinationFilePath, String appBinaryFilePath, Boolean windowsGraphicalUserInterface, String assemblyToCopyResorcesFrom) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    --- End of inner exception stack trace --- [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost(String appHostSourceFilePath, String appHostDestinationFilePath, String appBinaryFilePath, Boolean windowsGraphicalUserInterface, String assemblyToCopyResorcesFrom) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore() [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:  ---> (Inner Exception #1) System.UnauthorizedAccessException: Access to the path 'E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\obj\Development\UnrealBuildTool.exe' is denied. [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at System.IO.FileSystem.DeleteFile(String fullPath) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at System.IO.File.Delete(String path) [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost(String appHostSourceFilePath, String appHostDestinationFilePath, String appBinaryFilePath, Boolean windowsGraphicalUserInterface, String assemblyToCopyResorcesFrom)<--- [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  E:\Dev\Magellan-UE5\Unreal\Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:  [E:\Dev\Magellan-UE5\Unreal\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
2021.07.02 11:38:42    INFO  RunUAT.bat ERROR: AutomationTool failed to compile.
1 Like