Build fails cross-compiling to linux (-Wnonportable-include-path)

Building from source with 4.18 release branch while cross compiling from windows, to linux, with clang-5.0.0 toolchain fails with many errors for -Wnonportable-include-path -Werror.

This was already reported, and fixed, by Epic in this comment
https://github.com/EpicGames/UnrealEngine/commit/8de880b0670dbecf4cef195eafc7f8e514416073#diff-01eb1d3ffee9496a4b29ba137cffa630
for Mac.

However, the fix did not make it across the build chain for all other toolchains with utilize clang as the compiler. This patch should be applied across all clang-using platforms.

It seems like the above mentioned commit didn’t actually fix the issue for Linux - I had to directly patch UnrealBuildTool and add the warning flag there.

The proper fix is to make sure that the case sensitivity of the file path is correct. E.g. if a file is called “Baz/Foobar.h” it should be included as “Baz/Foobar.h” but not “baz/foobar.h” or anyhow else.

While the cross-compilation will succeed on Windows with the warning disabled, issues like that will break native compilation on a case-sensitive file system, which may be needed at some point (e.g. for better debugging experience).

Hi jaynus,

Linux by default uses a case sensitive file-systems and the code would not compile correctly on Linux and is therefore expected functionality (and not a bug). As macOS uses a case insensitive filesystem (by default) the macOS toolchain can get away with this hack. However this should not be fixed in the same way for the Linux buildchain.

Feel free to use the commit if you only intend to cross-compile to Linux but to fix this correctly you need to make sure that the file paths in the include directives match the actual path names on disk.

For example if you had a file named SomeFileName.h then you should reference it using:

#include "SomeFileName.h"

and not other derivatives such as:

#include "SomeFilename.h"

#include "Somefilename.h"

#include "somefilename.h"

The stock engine compiles without warnings, both natively and cross. You can test that by compiling UE4 project directly.

What target are you compiling and could you paste some warnings you are seeing?

That would imply changes to the unreal header generate then, yes? As these are errors in the base core engine from GitHub.