Build for linux on windows in 4.14


I want to package my game for linux (on windows) - so I’v installed CLANG, configured all the envs, and now I’m compiling (from vc) Shipping|Linux
[after long long struggle with FMOD and other third party libs] - my ‘main’ executable is built (BTW it’s huge - 1.2 GB :confused: (it’s 103MB on windows))

12> Performing 1 actions (9 in parallel) 12> [1/1] Link MySuperGame-Linux-Shipping 12> Total build time: 112,83 seconds

but the other one fails:

9> Using LINUX_MULTIARCH_ROOT, building with toolchain 'f:\CLANG\x86_64-unknown-linux-gnu' 9> Performing 2 actions (9 in parallel) 9> [1/2] Compile BootstrapPackagedGame.cpp 9> In file included from D:\Unreal\Projects\UnrealEngine4\UE4_14_CONSOLES\Engine\Source\Programs\Windows\BootstrapPackagedGame\Private\BootstrapPackagedGame.cpp:3: 9>D:\Unreal\Projects\UnrealEngine4\UE4_14_CONSOLES\Engine\Source\Programs\Windows\BootstrapPackagedGame\Private/BootstrapPackagedGame.h(5,10): fatal error : 'windows.h' file not found 9> #include 9> ^ 9> 1 error generated. 9>ERROR : UBT error : Failed to produce item: D:\Unreal\Projects\UnrealEngine4\UE4_14_CONSOLES\Engine\Binaries\Linux\BootstrapPackagedGame-Linux-Shipping 9> Total build time: 115,49 seconds

obviously BootstrapPackagedGame.h is taken from WRONG directory - why - I’m missed some setup ?
(I’m using latest 4.14 from unreal perforce, I’m able to successfully package both for and xbox1, so my setup seems to be correct for most of the part …)

me too for tjis problem at least 3 months !

You also need to rerun Setup.bat or …/UnrealEngine/Engine/Binaries/DotNET/GitDependencies.exe because that step will grab/copy libc++ stuff to …/UnrealEngine/Engine/Source/ThirdParty/Linux/LibCxx/. Otherwise, cross-compiling will fails with saying it cannot find standard C++ headers. If you haven’t explicitly defined and set an environment variable of UE4_LINUX_USE_LIBCXX to 0, cross-compiling will use libc++ headers/libraries in there by default instead of the one inside the clang toolchain.

For packaging for Linux platforms (both x86_64 and ARM) the CrashReportClient is also needed to be built for the Linux configuration in addition to the default UE4Game project.

Notice that you may want to (re)build the Editor for your platform to get Linux target modules built. They are built for your current platform (i.e. select Win64 in configuration), and they are needed so that Unreal Editor and Unreal Frontend know how to cook/package games for Linux.

Note: If packaging for Linux (see below) fails it may be necessary to explicitly build UnrealPak and ShaderCompileWorker for the host platform, which in this case is windows (Win32 or Win64). To do this right-click on each of this project in the solution explorer and execute the “Build” command.

Hey Mariusz-

There is a that describes the process of packaging a project for Linux from a Windows machine: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums . Please let me know if you’re able to follow the steps provided and package your project or, if you do run into errors, please detail where in the process the error occurs.

C:/ue4-14/UnrealEngine/Engine/Intermediate/Build/Linux/B4D820EA/CrossCompilerTool/Development/ShaderFormatOpenGL/Module.ShaderFormatOpenGL.cpp.o: In function FOpenGLFrontend::PrecompileShader(FShaderCompilerOutput&, FShaderCompilerInput const&, char const*, GLSLVersion, EHlslShaderFrequency)': 14> C:\ue4-14\UnrealEngine\Engine\Source\Developer\ShaderFormatOpenGL\Private/OpenGLShaderCompiler.cpp:1154: undefined reference to glCreateShader’
14> C:\ue4-14\UnrealEngine\Engine\Source\Developer\ShaderFormatOpenGL\Private/OpenGLShaderCompiler.cpp:1157: undefined reference to glShaderSource' 14> C:\ue4-14\UnrealEngine\Engine\Source\Developer\ShaderFormatOpenGL\Private/OpenGLShaderCompiler.cpp:1161: undefined reference to glCompileShader’
14> C:\ue4-14\UnrealEngine\Engine\Source\Developer\ShaderFormatOpenGL\Private/OpenGLShaderCompiler.cpp:1164: undefined reference to glGetShaderiv' 14> C:\ue4-14\UnrealEngine\Engine\Source\Developer\ShaderFormatOpenGL\Private/OpenGLShaderCompiler.cpp:1179: undefined reference to glGetShaderiv’
14> C:\ue4-14\UnrealEngine\Engine\Source\Developer\ShaderFormatOpenGL\Private/OpenGLShaderCompiler.cpp:1188: undefined reference to glGetShaderInfoLog' 14> C:\ue4-14\UnrealEngine\Engine\Source\Developer\ShaderFormatOpenGL\Private/OpenGLShaderCompiler.cpp:1216: undefined reference to glDeleteShader’
14>clang++.exe : error : linker command failed with exit code 1 (use -v to see invocation)

Ok, I’v solved this - by accident - I’v done identical setup on the second machine - but that machine had win7pro instead of win10 … and on that machine everything built just fine !

the commandline to package on windows for linux for me looks like this now:

%ENGINEDIRECTORY%\Build\BatchFiles\runUAT BuildCookRun -project=%UPROJECTNAME% -noP4 -platform=Linux -clientconfig=Shipping -serverconfig=Shipping -cook -build -stage -pak -compressed -archive -archivedirectory=%LINSTAGINGDIR%

I attempted to follow these steps and ran into similar errors. I get these errors
When trying to build the Linux Target from the unreal source

5>  In file included from Programs/UnrealLightmass/Private/LightmassCore\LMCore.h:12:
5>Programs/UnrealLightmass/Private/LightmassCore/Misc\LMStats.h(11,27): error : definition of builtin function '__rdtsc'
5>  inline unsigned long long __rdtsc()
5>                            ^
5>  In file included from D:\dev\UnrealEngineSource_latest\UnrealEngine\Engine\Intermediate\Build\Linux\B4D820EA\UnrealLightmass\Development\UnrealLightmass\Module.UnrealLightmass.1_of_3.cpp:2:

9>  [1/2] Compile BootstrapPackagedGame.cpp
9>  In file included from D:\dev\UnrealEngineSource_latest\UnrealEngine\Engine\Source\Programs\Windows\BootstrapPackagedGame\Private\BootstrapPackagedGame.cpp:3:
9>D:\dev\UnrealEngineSource_latest\UnrealEngine\Engine\Source\Programs\Windows\BootstrapPackagedGame\Private/BootstrapPackagedGame.h(5,10): fatal error : 'windows.h' file not found
9>  #include <windows.h>
9>           ^~~~~~~~~~~