This repo contains a collection of scripts and instructions for compiling and running Unreal Engine 5 from source under Wine.
- Lutris
-
Setup Lutris
- Clone
wine-tkg
repo and compile with latest wine staging as wine branch - Copy built
wine-tkg
package to lutris runners directory - Create new application entry in Lutris
- Set runner to
wine-tkg
- Disable Esync but keep Fsync enabled (if supported by kernel)
- Clone
-
Setup Wine Prefix
- Use winetricks uninstaller to uninstall wine mono if present in prefix
- Use winetricks to install
dotnet48
in prefix - Download
msbuild tools 2022
installer - Run
<msbuild tools installer>.exe --add Microsoft.NetCore.Component.Runtime.3.1 --add Microsoft.NetCore.Component.SDK --add Microsoft.Net.Component.4.6.2.TargetingPack --add Microsoft.VisualStudio.Component.Windows10SDK.18362 --quiet --wait
- Run
<msbuild tools installer>.exe --includeRecommended --includeOptional --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.MSBuildTools --quiet --wait
-
Setup UE5 source code
- Clone unreal engine 5 repo on host system (not in wine prefix)
- Apply patches to UE5 source code
git apply --ignore-space-change --ignore-whitespace fix_*
- Make sure wine prefix is in windows 10 mode
- Run
Engine\Binaries\DotNET\GitDependencies\win-x64\GitDependencies.exe
- Run
Setup.bat
-
Compile UnrealBuildTool
- Fixes
- Set
ncrypt
dll override tonative
in winecfg..nuget
does not seem to like the wine ncrypt dll. - (
CommandLineAttribute.cs
,AutomationTool/Program.cs
): For some reason string methods such asStartsWith
,Contains
,EndsWith
do not properly compare input characters wrapped in single quotes. To fix the issue simply convert single quotes to double quotes. - (
GenerateProjectFiles.bat
,BuildUAT.bat
,RunUBT.bat
):dotnet msbuild
does not work properly if it is allowed to run across multiple cores. Add-maxCpuCount:1
to all msbuild calls which appear in various bat files to restrict msbuild to one core and fix the issue.
- Set
- In wine console:
- Change to engine source root directory
- Run
GenerateProjectFiles.bat
- Fixes
-
Build Unreal Frontend
- Fixes
- (
UserInterfaceCommand.cpp
): Unreal frontend tries to load visual studio upon start (which currently does not run under wine). Simply comment out visual studio loading code inUserInterfaceCommand.cpp
to fix this issue.
- (
- Run
Engine\Build\BatchFiles\Build.bat ShaderCompileWorker Win64 Development -waitmutex
- Run
Engine\Build\BatchFiles\Build.bat UnrealFrontend Win64 Development -waitmutex
- Fixes
-
Compile Engine
- Fixes
- (
SProjectDialog.cpp
,SourceCodeNavigation
): Since visual studio does not currently work in wine you will need to comment out IDE setup and loading code in order to properly open projects and work within the Unreal Editor. - (
WindowsPlatformFile.cpp
): The windows file IO code in does not seem to handle writes to non-overlapped IO file handles correctly.fix_big_files.patch
fixes this issue. - (
RenderUtils.h
,WindowsD3D12PipelineState.cpp
): GPU vendor extensions currently do not work properly with dxvk-nvapi/vkd3d-proton so we need to tell the engine not to use them.
- (
- To compile core engine and editor run the following commands in the wine console (from source root folder):
Engine\Build\BatchFiles\Build.bat UnrealEditor Win64 Development -waitmutex
- To compile existing project/game
- Add
DisablePlugins.Add("VisualStudioSourceCodeAccess");
to .Target.cs - Add
DisablePlugins.Add("ADOSupport");
to .Target.cs - Run
Engine\Build\BatchFiles\Build.bat <ProjectName>Editor Development Win64 "<path to uproject file>" -Progress -waitmutex
- Add
- To run compiled project in editor
- Run
Engine/Binaries/Win64/UnrealEditor.exe "<path to uproject file>"
- Run
- Fixes
-
Packaging Project
- Run Unreal Frontend and have fun :)
UE5 may at times freeze up or crash while being run under wine. Below is a set of recommendations for debugging and fixing various issues.
- Freezes
- IF UE5 freezes up and you also notice your system becoming unresponsive for a few seconds, then check
dmesg
for GPU crash messages. NVIDIA drivers provide an XID which specifies the type of issue which occured. - In general, GPU crashes are usually caused by shader issues. We recommend that you leverage vkd3d-proton (when in dx12 mode) to debug and fix the issue. We recommend using the vkd3d-proton breadcrumbs mechanism as your primary debugging tool. Once you have narrowed down the faulty shader in the vkd3d-proton log by examining breadcrumbs, you can decompile the shader in question, modify the decompiled shader to get around a certain issue, recompile the shader, and finally instruct vkd3d-proton to swap out the faulty shader for your new version.
- IF UE5 freezes up and you also notice your system becoming unresponsive for a few seconds, then check
dotnet48
is required by the mstools installer