Download

Unable to Compile the ARSample in Xcode 9 beta 3

I’m following the guide to test the AR kit but I’ve run into a snag. When I try to compile I get the following error. I’ve seen a couple posts with similar issues but nothing exactly the same. If anyone could offer some advice it would be greatly appreciated.


Setting up Mono
Building ARSampleEditor...
2017-07-13 08:36:16.172 defaults[9085:92557] 
The domain/default pair of (com.apple.dt.Xcode, IDEBuildOperationMaxNumberOfConcurrentCompileTasks) does not exist
Running command : Engine/Binaries/DotNET/UnrealBuildTool.exe ARSampleEditor Mac Development /Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Samples/ARSample/ARSample.uproject
Performing 5 actions (4 in parallel)
[1/5] Compile Module.MetalRHI.cpp
In file included from /Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Intermediate/Build/Mac/UE4Editor/Development/MetalRHI/Module.MetalRHI.cpp:9:
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalComputeCommandEncoder.cpp:266:68: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setTextures:(const id <MTLTexture> __nullable [__nullable])textures withRange:(NSRange)range
                                                                   ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalComputeCommandEncoder.cpp:330:78: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers withRange:(NSRange)range
                                                                             ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalComputeCommandEncoder.cpp:394:78: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers lodMinClamps:(const float [__nullable])lodMinClamps lodMaxClamps:(const float [__nullable])lodMaxClamps withRange:(NSRange)range
                                                                             ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalComputeCommandEncoder.cpp:394:126: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers lodMinClamps:(const float [__nullable])lodMinClamps lodMaxClamps:(const float [__nullable])lodMaxClamps withRange:(NSRange)range
                                                                                                                             ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalComputeCommandEncoder.cpp:394:178: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers lodMinClamps:(const float [__nullable])lodMinClamps lodMaxClamps:(const float [__nullable])lodMaxClamps withRange:(NSRange)range
                                                                                                                                                                                 ^
In file included from /Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Intermediate/Build/Mac/UE4Editor/Development/MetalRHI/Module.MetalRHI.cpp:19:
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:263:74: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setVertexTextures:(const id <MTLTexture> __nullable [__nullable])textures withRange:(NSRange)range
                                                                         ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:326:84: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setVertexSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers withRange:(NSRange)range
                                                                                   ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:390:84: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setVertexSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers lodMinClamps:(const float [__nullable])lodMinClamps lodMaxClamps:(const float [__nullable])lodMaxClamps withRange:(NSRange)range
                                                                                   ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:390:132: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setVertexSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers lodMinClamps:(const float [__nullable])lodMinClamps lodMaxClamps:(const float [__nullable])lodMaxClamps withRange:(NSRange)range
                                                                                                                                   ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:390:184: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setVertexSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers lodMinClamps:(const float [__nullable])lodMinClamps lodMaxClamps:(const float [__nullable])lodMaxClamps withRange:(NSRange)range
                                                                                                                                                                                       ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:614:76: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setFragmentTextures:(const id <MTLTexture> __nullable [__nullable])textures withRange:(NSRange)range
                                                                           ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:678:86: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setFragmentSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers withRange:(NSRange)range
                                                                                     ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:742:86: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setFragmentSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers lodMinClamps:(const float [__nullable])lodMinClamps lodMaxClamps:(const float [__nullable])lodMaxClamps withRange:(NSRange)range
                                                                                     ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:742:134: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setFragmentSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers lodMinClamps:(const float [__nullable])lodMinClamps lodMaxClamps:(const float [__nullable])lodMaxClamps withRange:(NSRange)range
                                                                                                                                     ^
/Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.cpp:742:186: error: nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'
- (void)setFragmentSamplerStates:(const id <MTLSamplerState> __nullable [__nullable])samplers lodMinClamps:(const float [__nullable])lodMinClamps lodMaxClamps:(const float [__nullable])lodMaxClamps withRange:(NSRange)range
                                                                                                                                                                                         ^
15 errors generated.
ERROR: UBT ERROR: Failed to produce item: /Users/ue4user/Desktop/UnrealEngine-dev-ar-kit/Engine/Binaries/Mac/UE4Editor.app/Contents/MacOS/UE4Editor-MetalRHI.dylib
Total build time: 60.78 seconds (Local executor: 0.00 seconds)

Exact same issue here. Just got the beta 3 of Xcode, pulled the latest code from dev-ar-kit branch on GitHub, and cannot compile the sample due to the nullable errors you pointed out.

Same here, cannot build the dev-arkit branch because of those nullable errors. There was a checkin a few days back to fix a similar issue with Beta 2. Perhaps there will be a new push soon.

Now that you’ve updated to XCode 9 Beta 3, did you also go with IOS 11 Beta 3? And if so, have you since tried to go back and deploy any IOS project from the 4.16.2 binary of UE4?

That’s just the tip of the iceberg. Even after fixing those compile errors, apparently xcode 9 also breaks some of ue4 metal shaders. E.g the below is from ARSample. I wonder what they’ll do? Stick with xcode 8 for 4.17? which means no arkit.

Shader FSimpleLightTranslucentLightingInjectPS, VF None:
UATHelper: Packaging (iOS): Cook: /tmp/8588_81822943.metal:10:39: error: unknown ‘render_target_array_index’ attribute
UATHelper: Packaging (iOS): Cook: uint IN_SV_RenderTargetArrayIndex render_target_array_index ]];
UATHelper: Packaging (iOS): Cook: ^~~~~~~~~~~~~~~~~~~~~~~~~
UATHelper: Packaging (iOS): Cook: 1 error generated.

Pretty disappointing that Epic has not addressed this considering the level they promoted these tools. It’s not like we even can download the Xcode beta 2 anymore - so if you have the latest version you are out of luck.

Yes, most of the metal related classes in the Apple RHI folder do not correctly implement the interfaces they declare. must be a change to clang or something - it wouldn’t be the xcode GUI, but something about the new c++ compiler version that causes it.

Same problem here, can anyone confirm if the same happens with XCode 9 beta 2?

Try building the 4.17 branch of the Unreal source. Looks like the Metal classes were updated for Xcode beta 3 here https://github.com/EpicGames/UnrealEngine/commit/091e347e32db573a3390df04fabc09967831120b

Does that mean we can run the AR Sample using the 4.17 branch? That branch does not include the ARSample project.

I guess it might be possible if you transplanted the ARSample project over to the 4.17 source branch and updated the dependencies, etc. Wouldn’t know until you tried - it also depends on if they’ve put all the ARKit code in the engine everywhere its supposed to go. Its possible it works now, but who knows what their development schedule is - possible ARKit support doesn’t get merged in until later this quarter.

those are definitely the missing hooks. i might try copy/pasting that in to the dev-ar-kit branch code to see if it takes it. might be missing the METAL_NEW_NONNULL_DECL preprocessor definition, but thats easy enough to fix.

Has anyone had any success with this yet?

any news on this error?

You can get rid of the problem either updating to XCode 9 Beta 3 or removing any occurence of the “_nullable” or “__nullable” type specifiers in the code. If it’s not enough, comment out also the NS_ASSUME_NONNULL_BEGIN and NS_ASSUME_NONNULL_END from both MetalComputeCommandEncoder.cpp and MetalComputeCommandEncoder.h

It’s not entirely safe but it’s enough to make it compile and run until the next update.

Marco

With XCode beta 4 dropping today – does anyone have their mac handy to try again?

Wish that the Unreal folks would make some kind of comment on what to expect with this over the coming weeks. Feels so quiet after all the initial hoopla at WWDC.

Still doesn’t work on XCode beta 4. Same error.

For the love of God - FINALLY got that ARKit sample project to compile and deploy :smiley: But only because I still had a copy of XCode 9 Beta 2 saved on my drive and went back to that. If you no longer have it, there are still live links to Apple’s developer downloads (saw posted to this SO message)

XCode 9 Beta 2 from Apple’s Developer Downloads (will need to log in with your dev account):
https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_9_beta_2/Xcode_9_beta_2.xip

The second half of the problem was that anything I launched from the editor would either complain about the certificate/provisioning, or when finally past that, the splashscreen would just hang (no matter the project). Once I found a hint to not use Launch from Editor and just use File->Package Project->iOS and sideload the resulting IPA, it actually… finally… worked. Phew!! It has some wacky aspect ratio problem to figure out, but it is actually running on device (an iPhone 7 plus with iOS11b3).

So looks like we still have to stick with Beta 2 until more updates come to the branch for newer XCode betas, or just wait until it’s in UE4.18 or wherever it finally comes to life.

Confirming @Burly 's findings: I was able to build with XCode 9 beta 2, after failing to build using XCode 9 beta 4 due to Metal “nullable”-related errors. So use that link to get XCode 9 beta 2!

Has anyone been able to build the ARSample scheme in Xcode 9 beta 4? When I try to build it, it just sits there without any errors. Doesn’t seem to go anywhere.

Builds for the supporting schemes went without a problem.

Didn’t realize I just hijacked. I will create a new thread.