# Error when compile SlateViewer

**URL:** <https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874>\
**Category:** Feedback & Requests\
**Tags:** unreal-engine, bug-report, question\
**Created:** [September 30, 2015, 1:52pm UTC](https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874 "2015-09-30T13:52:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_57ceb6c0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_57ceb6c0](https://forums.unrealengine.com/u/anonymous_user_57ceb6c0)\
**Post date:** [September 30, 2015, 1:52pm UTC](https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874/1 "2015-09-30T13:52:11Z")

</div>

Hi I try to compile UE4.9 but when i try to compile SlateViewer I get this error

```
In file included from /home/piero/UnrealEngine/Engine/Intermediate/Build/Linux/x86_64-unknown-linux-gnu/SlateViewer/Development/ImageWrapper/Module.ImageWrapper.cpp:9:
In file included from /home/piero/UnrealEngine/Engine/Source/Developer/ImageWrapper/Private/JpegImageWrapper.cpp:14:
ThirdParty/libJPG/jpgd.cpp:569:51: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
        static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7...
                                                     ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:66: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
        static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7...
                                                                    ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:81: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
        static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7...
                                                                                   ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:96: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
        static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7...
                                                                                                  ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:111: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
        static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7...
                                                                                                                 ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:126: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
  ...const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8...
                                                                                                                      ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:141: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
  ...= { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<1...
                                                                                                       ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:156: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
  ...= { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<1...
                                                                                                                      ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:171: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
  ...+ 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11...
                                                                                                                    ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:186: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
  ...+ 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<1...
                                                                                                                    ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:202: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
  ...+ 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<...
                                                                                                                     ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:218: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
  ...+ 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<...
                                                                                                                      ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:234: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
  ...+ 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)...
                                                                                                                       ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:250: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
  ...+ 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                        ~~~~ ^
ThirdParty/libJPG/jpgd.cpp:569:266: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
  ...+ 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                        ~~~~ ^
15 errors generated.

```

And the compiler will fail. I’m using fedora and clang 3.7

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [October 1, 2015, 1:12pm UTC](https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874/2 "2015-10-01T13:12:50Z")

</div>

Hey Piko-

4.9 can only be compiled with clang 3.6 and clang 3.5, trying other versions may result in compilation errors. For now I would suggest switching to another version of Clang.

Cheers

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_57ceb6c0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_57ceb6c0](https://forums.unrealengine.com/u/anonymous_user_57ceb6c0)\
**Post date:** [October 2, 2015, 9:49pm UTC](https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874/3 "2015-10-02T21:49:13Z")

</div>

Thanks now the compilation work

---

<div class="post-metadata">

**Author:** ![Omar007](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Omar007](https://forums.unrealengine.com/u/Omar007)\
**Post date:** [October 18, 2015, 2:44pm UTC](https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874/4 "2015-10-18T14:44:02Z")

</div>

Another workaround you could use is the following:

- Open the file “./Engine/Source/Programs/UnrealBuildTool/Linux/LinuxToolChain.cs”

- Insert the following piece of code after line 343

- Rerun GenerateProjectFiles.sh

- Rebuild Engine

I seriously dislike the use of flags such as these though… Imho it just promotes bad coding and should never be used/needed…  
If this wasn’t a third-party library issue I’d be fixing the engine code right now instead of supplying this workaround…

It could potentially actually be fixed instead of worked around by changing those (-1)'s to (std::numeric\_limits::max()), (UINT\_MAX) or ((unsigned)-1), unless they’re trying to achieve something completely different here, but then we would be messing with an external library…

@-; Maybe in the future it’d be nice to have the UnrealBuildTool handle compiler flags on a per project or per group basis (for example, flags for Third-Party projects only and flags for UE4 only).  
That way we could ensure good and clean code in the engine itself by gradually removing all such flags for the engine while still being able to work around bad code in third-party libraries.

---

<div class="post-metadata">

**Author:** ![LuisAlaguna](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/luisalaguna/32/570408_2.png) [@LuisAlaguna](https://forums.unrealengine.com/u/LuisAlaguna)\
**Post date:** [November 2, 2015, 4:17am UTC](https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874/5 "2015-11-02T04:17:49Z")

</div>

But, this maybe mean that it’s necessery install a third party for avoid this errors?  
Will be useful that put this requeriments in the docs.

ANd yes, i don’t know if this issue was solved installing libjpeg or put these code in the file, but, i fixed it.

---

<div class="post-metadata">

**Author:** ![Omar007](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Omar007](https://forums.unrealengine.com/u/Omar007)\
**Post date:** [November 2, 2015, 4:48pm UTC](https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874/6 "2015-11-02T16:48:41Z")

</div>

You don’t install anything extra here; we’re compiling source.  
The piece of source code that causes the problem is located in a third-party library that is included in the UE4 source tree (…/ThirdParty/libJPG/\*). For this reason I supplied the UnrealBuildTool option as a possible solution but the proper fix to this error would be for the upstream third-party library to fix this piece of code.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a488984a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a488984a1](https://forums.unrealengine.com/u/anonymous_user_a488984a1)\
**Post date:** [December 9, 2016, 7:00am UTC](https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874/7 "2016-12-09T07:00:26Z")

</div>

line 343 for me reads:

```
 if (CompileEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Shipping)

```

after that is:

```
        {
            Result += " -Wno-unused-value";

            // in shipping, strip as much info as possible
            Result += " -g0";
            Result += " -fomit-frame-pointer";
            Result += " -fvisibility=hidden"; // prevents from exporting all symbols (reduces the size of the binary)
        }
        else if (CompileEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Debug)
        {
            Result += " -fno-inline"; // disable inlining for better debuggability (e.g. callstacks, "skip file" in gdb)
        }

```

are you sure line 343 is correct?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a488984a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a488984a1](https://forums.unrealengine.com/u/anonymous_user_a488984a1)\
**Post date:** [December 9, 2016, 7:02am UTC](https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874/8 "2016-12-09T07:02:34Z")

</div>

./Setup.sh doesn’t work with clang 3.6 for me. It only works with the latest version of clang for me, but of course make fails with the latest version of clang for me because of clang errors or something, and it’s recommended to downgrade clang to get around those errors!!!

---

<div class="post-metadata">

**Author:** ![Omar007](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Omar007](https://forums.unrealengine.com/u/Omar007)\
**Post date:** [December 9, 2016, 10:02am UTC](https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874/9 "2016-12-09T10:02:45Z")

</div>

If you’re building UE4.9, then yes I’m sure that number is correct.  
However, you’re replying to a post that is more than a year old. Assuming you’ve been updating the engine since 4.9 was released, the chance this number is still valid is very small.

Furthermore, as far as I’m aware this has since been fixed in ‘ThirdParty/libJPG/jpgd.cpp’ so you should not be needing this at all.

---

<div class="post-metadata">

**Author:** ![Omar007](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Omar007](https://forums.unrealengine.com/u/Omar007)\
**Post date:** [December 9, 2016, 10:06am UTC](https://forums.unrealengine.com/t/error-when-compile-slateviewer/333874/10 "2016-12-09T10:06:42Z")

</div>

The latest release atm should support clang 3.5 up to and including 3.9 just fine.  
This question is a year old. Could you please specify if you are still using 4.9?
