CrashReportClient compile error

I am trying to build UnrealEngine and have hit a link error trying to compile CrashReportClient:

[49/49] Link CrashReportClient-Linux-Development
/usr/bin/ld: /home//Projects/DogFight/Build/UnrealEngine/Engine/Source/ThirdParty/zlib/v1.2.8//lib//Linux/x86_64-unknown-linux-gnu/libz.a(compress.o): relocation R_X86_64_32 against .rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /home//Projects/DogFight/Build/UnrealEngine/Engine/Source/ThirdParty/zlib/v1.2.8//lib//Linux/x86_64-unknown-linux-gnu/libz.a(deflate.o): relocation R_X86_64_32S against symbol zcalloc’ can not be used when making a shared object; recompile with -fPIC e

/usr/bin/ld: /home//Projects/DogFight/Build/UnrealEngine/Engine/Source/ThirdParty/FreeType2/FreeType2-2.6/Lib/Linux/x86_64-unknown-linux-gnu/libfreetype.a(ftlzw.c.o): relocation R_X86_64_32S against .text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /home//Projects/DogFight/Build/UnrealEngine/Engine/Source/ThirdParty/zlib/v1.2.8//lib//Linux/x86_64-unknown-linux-gnu/libz.a(uncompr.o): relocation R_X86_64_32 against .rodata’ can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: UBT ERROR: Failed to produce item: /home//Projects/DogFight/Build/UnrealEngine/Engine/Binaries/Linux/CrashReportClient-Linux-Development
Total build time: 96.92 seconds (Local executor: 0.00 seconds)
make: *** [Makefile:253: CrashReportClient] Error 5
[@-pc UnrealEngine]$ ^C

it seems that it wants me to compile with the flag -fPIC. How do I resolve this issue? I do not know how to set this compile flag.

My OS is Manjaro arch.

I tried editing LinuxToolChain.cs to add it and re-ran ./GenerateProjectFiles.sh, but I get the same error.
I see that LinuxToolChain.cs will use -fPIC if bIsBuildingDLL is set to true, perhaps this is the correct way to fix the problem? But how do I do that?

This is because Arch (and a number of related distros) configure clang and gcc to produce position-independent executables by default. You may attempt to fix that in LinuxToolChain.cs by adding -fno-PIE but the fix may not be as straightforward.

Thank you for your help, but it still does not work.

I added in the line:

Result += " -fno-PIE"; in GetCLArguments_Global

then ran ./GenerateProjectFiles.sh then make. I still have the same problem.
If that is the correct way to do it, I will try setting up ubuntu in a VM if there are no other solutions.

Hi, check out the patches used by the aur package aur.git - AUR Package Repositories they help with making the current version of the engine buildable. If you need some older version do go back in the repository to that version.

Thats! that is perfect! I managed to get building on manjaro.