Download

OSX: Can't compile clean engine source from release branch

I’m on OS X Sierra (10.12.3) running Xcode 8.3.1. Per the readme.md, I cloned the release branch at f44f8e5 (4.15.1), ran Setup.command to sync dependencies, then GenerateProjectFiles.command to create the .xcworkspace file, then opened that up in Xcode and built the ShaderCompilerWorker (this went fine) and then built UE4. Building UE4 failed with several errors.


ThirdParty/FBX/2016.1.1/include/fbxsdk/core/fbxproperty.h:1242:70: error: binding dereferenced null pointer to reference has undefined behavior -Werror,-Wnull-dereference]
                return StaticInit(pObject, pName, FbxGetDataTypeFromEnum(FbxTypeOf(*((FbxReference*)0))), pValue, pForceSet, pFlags);

It’s pretty obvious what’s wrong with this one – the FbxGetDataTypeFromEnum(FbxTypeOf(((FbxReference)0))) argument seems like weird nonsense? (what’s with that literal zero) – but it’s not at all obvious what the correct code should be. There is a newer version of fbxproperty.h in a 2017.0.1 subfolder which throws no errors; that makes me wonder if the offending (older) version is just deprecated?


Engine/Plugins/Experimental/AlembicImporter/Source/AlembicLibrary/Private/AlembicTestCommandlet.cpp:3:10: error: non-portable path to file '"AlembicTestCommandlet.h"'; specified path differs in case from file name on disk
Engine/Plugins/Experimental/AlembicImporter/Source/AlembicLibrary/Private/AlembicTestCommandLet.h:7:10: error: non-portable path to file '"AlembicTestCommandlet.generated.h"'; specified path differs in case from file name on disk

This is a case-sensitivity issue. The include wants the last L in the filename to be uppercase, but on-disk it’s lowercase. Trivial to fix the reference in code, but is that worth making a pull request for?


Engine/Source/Runtime/Apple/MetalRHI/Private/MetalDebugCommandEncoder.h:44:5: error: inferring '_Nonnull' for pointer type within array is deprecated
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalDebugCommandEncoder.h:46:15: error: inferring '_Nonnull' for pointer type within array is deprecated
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalDebugCommandEncoder.h:55:5: error: inferring '_Nonnull' for pointer type within array is deprecated
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalDebugCommandEncoder.h:62:5: error: inferring '_Nonnull' for pointer type within array is deprecated

I have no idea what to do with these. The whole file is wrapped in NS_ASSUME_NONNULL_BEGIN / NS_ASSUME_NONNULL_END which seems relevant but I’m not familiar with any of these symbols.


Engine/Source/Runtime/Apple/MetalRHI/Private/MetalCommandBuffer.cpp:31:17: error: auto property synthesis will not synthesize property 'kernelStartTime' declared in protocol 'MTLCommandBuffer'
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalCommandBuffer.cpp:31:17: error: auto property synthesis will not synthesize property 'kernelEndTime' declared in protocol 'MTLCommandBuffer'
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalCommandBuffer.cpp:31:17: error: auto property synthesis will not synthesize property 'GPUStartTime' declared in protocol 'MTLCommandBuffer'
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalCommandBuffer.cpp:31:17: error: auto property synthesis will not synthesize property 'GPUEndTime' declared in protocol 'MTLCommandBuffer'

I don’t know what any of this means. I’m not a native OS X developer and this appears to be native OS X stuff.


Engine/Source/Runtime/Apple/MetalRHI/Private/MetalComputeCommandEncoder.cpp:115:53: error: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalComputeCommandEncoder.cpp:115:90: error: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:118:59: error: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:118:96: error: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:245:61: error: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:245:98: error: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)

These all appear with some syntax that’s complete gibberish to me. I’m guessing it’s Objective-C?

Most of this seems to have to do with some OS X native code which is an area I’m not really versed in, so I’m at a bit of a loss. Google isn’t really helping either; it seems nobody else has ever seen these errors OR I’m absolutely terrible at forming search queries.

Can anyone lend any insight?

I think UE4 4.15 doesn’t officially support Xcode 8.3.1 as yet, which is likely the cause of these issues - Xcode may have previously been less strict.
If you can, reverting to a slightly earlier version may be the simplest way to get it building.

I ran into this and hacked my way around it. For the FBX property issue, just change the 0 literal for some other constant, I used 0xdeadbeef.
For the non nullable stuff, add the keyword _Nullable in front of id<> stuff and after pointer declarations: void const * _Nullable
In the objective c function declarations, add __nullable where appropriate as well (e.g. inside the array brackets [__nullable]).

Last but not least, add the missing properties:
@synthesize GPUStartTime;
@synthesize GPUEndTime;
@synthesize kernelStartTime;
@synthesize kernelEndTime;

Good luck :slight_smile: