Build UE4 Failed from Source on Mac OS X

I am using the Engine source from branch 4.10. I have successfully run via Terminal:

./Setup.command

and

./GenerateProjectFiles.command

I am now on the section where I need to build Unreal Engine 4 from source using Xcode. I am on a Mac Mini running OS X El Capitan 10.11.4 with Xcode version 7.3. I am getting the following error during build:

jpgd.cpp

Shifting a negative signed value is undefined

86540-error+building+on+mac.png

What can I do to fix this? Is this related to not having libjpeg-dev installed on the Mac or is it related to clang or something else entirely? Please provide step-by-step guidance if you know of a solution.

Alright, the issue has to do with how Clang in Xcode 7.3 has newly defined rules that jpgd.cpp does not obey. The quick fix was to edit the jpgd.cpp file as posted here. I am unaware of what repercussions this may have on projects, but so far nothing has gone wrong on my side. I am now able to build the engine properly using Xcode 7.3 with the Build for Running option under Product.

It produces a proper UE4Editor.app file which I can run in standalone.

Basically, inside the source folder for the engine at Engine/Source/ThirdParty/libJPG/jpgd.cpp, change line 569 to the following (notice the change in bracket usage):

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)) + 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 };

A possible alternative solution if you have access to the Apple Developer paid programme, then you can download an older version of Xcode that has an older version of Clang as posted here, if you feel unsafe modifying the jpgd.cpp file.