Download

Portability for Linux Build

Hi,

I’m (mostly) a backend systems engineer with no Unreal experience who’s been asked to look at utilising an Unreal product developed by another team in our application space.
For lots of reasons I’m looking at whether I can build the product for a Linux deployment where all the original dev was targeted at Windows. Unfortunately the original development team have no experience building Unreal projects for Linux.
This project does have it’s own code so I do need to do a compilation rather than just a straight package.

I’m looking at both native compilation and cross-compiling - mostly because the download/configure/build times are so long that I have plenty of slack time to do so.
I’ve got both environments to package a simple demo project successfully after following the instructions here: https://wiki.unrealengine.com/Compiling_For_Linux
It’s after this I’m getting a little stuck

Focusing on native compilation (as I seem to be getting further with this):
In Editor source (using the 4.14 branch) I can run


$ ./GenerateProjectFiles.sh -project /path/to/myproject.uproject -game -engine

Then running the editor and opening the project prompts me:


The following modules are missing or built with a different engine version:
libUE4Editor-myproject.so
Would you like to rebuild them now?

I click yes and the build ticks along happily until it hits this error:


fatal error: 'AllowWindowsPlatformTypes.h' file not found

and it tells me to build the source manually

Now since that file exists within the Unreal engine source and it’s specific for Windows I assume that the Linux build doesn’t have it as an include path - which is fair enough.
The file that includes it is doing the whole AllowWindows…HideWindows block around #include of an internally developed file which seems to be the main state machine developed for inclusion as a DLL, with a number of Windows specific types in use.

If this was any system I’m used to dealing this would be the point where I’d abstract things out with separate Windows and Linux implementations and use #idefs to include the correct stuff at compile time

Q1/. Do I need to do the #ifdef-ing or is there some other Unreal option I can use instead?
I’m pretty sure the answer is ‘Do the #ifdefs’ but I thought it best to check

Q2/. Since the build is managed by Unreal does it have it’s own #defines used for Windows vs Linux (and I assume vs Android vs iOS vs HTML etc) that I should be testing for in my #ifdefs? If not how do I set them as part of the build?

Q3/. Are their any other gotchas regards making the code portable that I should be aware of?

Any help, guidance or insight is appreciated

Tim