SDL 2.0 on XCode 9.2 Will Not Run on Physical iPhone 6

Hello!

I’m trying to create games for both Android and iOS using SDL 2.0. For iOS, I’ve followed the awesome and very detailed Lazy Foo tutorial at http://lazyfoo.net/tutorials/SDL/52_hello_mobile/ios_mac/index.php and it works great as long as I run the sample game on the simulator. As soon as I try to run it on a physical iPhone 6, I get the following error:

Undefined symbols for architecture arm64:
OBJC_CLASS$_MTLTextureDescriptor”, referenced from:
objc-class-ref in libSDL2.a(SDL_render_metal.o)
OBJC_CLASS$_MTLSamplerDescriptor”, referenced from:
objc-class-ref in libSDL2.a(SDL_render_metal.o)
OBJC_CLASS$_MTLRenderPassDescriptor”, referenced from:
objc-class-ref in libSDL2.a(SDL_render_metal.o)
OBJC_CLASS$_MTLRenderPipelineDescriptor”, referenced from:
objc-class-ref in libSDL2.a(SDL_render_metal.o)
“_MTLCreateSystemDefaultDevice”, referenced from:
_METAL_CreateRenderer in libSDL2.a(SDL_render_metal.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I’ve turned on the setting for “build for other architectures” and ensured that arm64 was added to the architectures list, but this same error still comes up.

Could somebody please help me resolve this issue?

Thank you in advance!

What does your Linked Frameworks and Libraries look like?

Thank you for your reply! Here’s what I’ve got:

download_20180411_202701

Did you add the SDL2.framework in Library/Frameworks in your machine?

Thank you for the quick reply! I’m just heading off to work, but I’ll give that a shot and report back tonight.

Same error with me. I’m compiling the Xcode-iOS demos and get this error. I tried adding the SDL2.framework but no difference. This is happening both with the stable 2.0.8 and SDL-2.0.8-11935 snapshot.

I already have the SDL framework installed at /Library/Frameworks/ (which was installed from the precompiled .dmg file from the SDL site). I tried adding this library to my project through xcode and the same error is produced still. If you have any other ideas please let me know. I’ve been stuck on this for a few weeks now and I haven’t been able to find much information about it.

You need to add the Metal framework (I can’t remember its exact name) to your ‘Link Binary with Libraries’. This fixed the problem for me, but SDL 2.0.8 broke my app in other ways so I reverted to 2.0.7 and deleted the Metal framework again!

rtrussel, that worked!!! Thank you a ton! I’ll drop an email to the Lazy Foo guy to see if he’ll add this to his tutorial as well. Here’s what was added to resolve the issue:

download_20180415_105209

1 Like