Cannot Compile Neural Network Project with NNI on MacOS (Missing UnrealEditor-D3D12RHI.dylib)

Hi all,

I’m new to UE, I was following this tutorial. When I was creating the new Neural Network class, Unreal Editor reports an error saying that a file named UnrealEditor-D3D12RHI.dylib is missing and told me to rebuild in XCode (error message displayed below)

My project is named “NNIStyleTransferTest” and I’m using MacOS 12.5 with UE 5.0.3. XCode version 13.4.1

After I quit the project (which was compiling fine before I added the new C++ class) cannot be opened anymore, displaying the following message:

The rebuilding does not fix the project, and it returns the following error code:

Setting up bundled DotNet SDK
Processing build for Target=NNIStyleTransferTestEditor Platform=Mac Configuration=Development -architecture=x86_64 /Users/xiangzhousun/Documents/Unreal Projects/NNIStyleTransferTest/NNIStyleTransferTest.uproject 
Log file: /Users/xiangzhousun/Library/Application Support/Epic/UnrealBuildTool/Log.txt
Creating makefile for ShaderCompileWorker (no existing makefile)
ERROR: Couldn't find target rules file for target 'ShaderCompileWorker' in rules assembly 'UE5Rules, Version=, Culture=neutral, PublicKeyToken=null'.
       Location: /Users/Shared/Epic Games/UE_5.0/Engine/Intermediate/Build/BuildRules/UE5Rules.dll
       Target rules found:
Running dotnet Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.dll NNIStyleTransferTestEditor Mac Development /Users/xiangzhousun/Documents/Unreal Projects/NNIStyleTransferTest/NNIStyleTransferTest.uproject -architecture=x86_64
Log file: /Users/xiangzhousun/Library/Application Support/Epic/UnrealBuildTool/Log.txt
Building NNIStyleTransferTestEditor...
[Adaptive Build] Excluded from NNIStyleTransferTest unity file: STNeuralNetwork.cpp, NNIStyleTransferTestGameMode.cpp, NNIStyleTransferTest.cpp, NNIStyleTransferTestCharacter.cpp
Determining max actions to execute in parallel (8 physical cores, 8 logical cores)
  Executing up to 8 processes, one per physical core
  Requested 1.5 GB free memory per action, 6.49 GB available: limiting max parallel actions to 4
Building 2 actions with 2 processes...
[1/2] Link UnrealEditor-NNIStyleTransferTest.dylib
ld: file too small (length=0) file '/Users/Shared/Epic Games/UE_5.0/Engine/Binaries/Mac/UnrealEditor-D3D12RHI.dylib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Command /Users/Shared/Epic Games/UE_5.0/Engine/Build/BatchFiles/Mac/ failed with exit code 6

Can someone explain why this dylib file is missing or what I could do to add it back?
Any help would be greatly appreciated, thank you!

Having the exact same issue. I’m able to confirm that in my ProjectName.Build.cs file, this package is causing the error: “D3D12RHI”. Please see full function below:
PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “InputCore”, “HeadMountedDisplay”, “EnhancedInput”,
// Rendering dependencies
// OpenCV dependencies