Slateviewer warning being thrown as errors

Hi,

I have cloned the Unreal Engine repository on the release branch.
The problem I am having is that after doing Setup.sh and GenerateProjectFiles.sh, doing

make SlateViewer

returns compilation warnings as errors because the code is not keeping the return value of C functions like fscan and other elemental ones, as shown below. I am on Arch linux with updated packages. I edited those lines of code to store the return values, but later on I got more compilation errors for other parts, i believe that is not the path since its a release branch it should compile as it is. Should I disable warning errors? Any help is welcome. I have not even tried compiling the Editor since this is already not working.

UnrealEngine git:(release) ✗ make SlateViewer
bash "/home/cristobal/gamedev/UnrealEngine"/Engine/Build/BatchFiles/Linux/Build.sh SlateViewer Linux Development  
Building SlateViewer...
Using clang version '3.7.0' (string), 3 (major), 7 (minor), 0 (patch)
Performing full C++ include scan (building a new target)
Creating makefile for SlateViewer (no existing makefile)
Building UnrealHeaderTool...
Using clang version '3.7.0' (string), 3 (major), 7 (minor), 0 (patch)
Creating makefile for UnrealHeaderTool (no existing makefile)
Performing full C++ include scan (no include cache file)
Performing 21 actions (5 in parallel)
[4/21] Compile Module.CoreUObject.4_of_4.cpp
[5/21] Compile Module.CoreUObject.3_of_4.cpp
[3/21] Compile Module.Projects.cpp
[2/21] Compile Module.Json.cpp
[1/21] Compile CorePrivatePCH.h
[6/21] Compile Module.Core.4_of_6.cpp
[7/21] Compile Module.Core.3_of_6.cpp
[8/21] Compile Module.Core.2_of_6.cpp
In file included from /home/cristobal/gamedev/UnrealEngine/Engine/Intermediate/Build/Linux/x86_64-unknown-linux-gnu/UnrealHeaderTool/Development/Core/Module.Core.2_of_6.cpp:39:
/home/cristobal/gamedev/UnrealEngine/Engine/Source/Runtime/Core/Private/Linux/LinuxPlatformMisc.cpp:130:3: error: ignoring return value of function declared with warn_unused_result attribute [-Werror,-Wunused-result]
                fscanf(SysFsFile, "%d", &SystemLineSize);
                ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/cristobal/gamedev/UnrealEngine/Engine/Intermediate/Build/Linux/x86_64-unknown-linux-gnu/UnrealHeaderTool/Development/Core/Module.Core.2_of_6.cpp:41:
/home/cristobal/gamedev/UnrealEngine/Engine/Source/Runtime/Core/Private/Linux/LinuxPlatformProcess.cpp:956:2: error: ignoring return value of function declared with warn_unused_result attribute [-Werror,-Wunused-result]
        getcwd(CurrentDir, sizeof(CurrentDir));
        ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cristobal/gamedev/UnrealEngine/Engine/Source/Runtime/Core/Private/Linux/LinuxPlatformProcess.cpp:1186:2: error: ignoring return value of function declared with warn_unused_result attribute [-Werror,-Wunused-result]
        fscanf(FilePtr, "%d %s %c %d", &DummyNumber, Buf, &DummyChar, &ParentPID);      
        ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.
[9/21] Compile Module.Core.1_of_6.cpp
[10/21] Compile Module.Core.6_of_6.cpp
[11/21] Compile Module.Core.5_of_6.cpp
[12/21] Compile Module.CoreUObject.2_of_4.cpp
[13/21] Compile Module.CoreUObject.1_of_4.cpp
[14/21] Compile Module.ScriptGeneratorPlugin.cpp
[15/21] Compile Module.UnrealHeaderTool.cpp

Those are valid warnings. When we start supporting clang 3.7 (which won’t happen until 4.11 I think) we’ll fix that - thanks for the pointer (and feel free to submit a PR ;-)).

Thanks. I am working on the new branch. The errors have been fixed, however I now have the error related to recompile with -fPIC. What is a practical solution?

[1/1] Link SlateViewer
/usr/bin/ld: /home/cristobal/gamedev/UnrealEngine/Engine/Source/ThirdParty/zlib/zlib-1.2.5/Lib/Linux/x86_64-unknown-linux-gnu/libz.a(compress.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/home/cristobal/gamedev/UnrealEngine/Engine/Source/ThirdParty/zlib/zlib-1.2.5/Lib/Linux/x86_64-unknown-linux-gnu/libz.a: error adding symbols: Bad value
clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)
-------- End Detailed Actions Stats -----------------------------------------------------------
ERROR: UBT ERROR: Failed to produce item: /home/cristobal/gamedev/UnrealEngine/Engine/Binaries/Linux/SlateViewer
Total build time: 4.46 seconds
Makefile:398: recipe for target 'SlateViewer' failed
make: *** [SlateViewer] Error 5

UPDATE: I managed to fix a lot of those “recompile with -fPIC” errors by doing a soft link to the xxx_fPIC.a version of the library, which existed in the corresponding lib folder of each third party library. However, for ICU library i am facing a problem because it does not provide an -fPIC version. I added “-fPIC” to BuildOnLinux.sh but when I run it t throws errors for dos2unix and cannot run “runConfigureICU”,

UPDATE2: Managed to pass that part. Let me keep trying and then i will post back the result.

Why do you need -fPIC for monolithic programs? UBT should compile SlateViewer without -fPIC by default unless you forcibly added that somewhere.

It is strange because actually I did nothing apart from the classic steps (plus the fixes).

  1. clone release branch from git
  2. Setup.sh
  3. GenerateProjectFiles.sh
  4. Fix warning errors plus some bitshifts with (-1) for libJPG.
  5. make SlateViewer

Anyway, SlateViewer has compiled and works, but i need to fix that -fPIC issue since it was a pain the way I fixed it.

Where in UE4 should that be stated?