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?