We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4088 - [patch] Fix Metal link errors with test programs in SDLTest.xcodeproj
Summary: [patch] Fix Metal link errors with test programs in SDLTest.xcodeproj
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: x86 Other
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-19 21:30 UTC by Eric Wasylishen
Modified: 2018-02-20 17:04 UTC (History)
0 users

See Also:


Attachments
Fix link errors in SDLTest.xcodeproj (31.26 KB, patch)
2018-02-19 21:30 UTC, Eric Wasylishen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Wasylishen 2018-02-19 21:30:16 UTC
Created attachment 3176 [details]
Fix link errors in SDLTest.xcodeproj

Xcode 9.2/macOS 10.13.3

The following patch adds Metal.framework to the "link binary with libraries" section of each test program, with "status" set to "optional", which fixes link errors on all of the test programs. I'm not sure if this is a correct fix - the fact that this was necessary might indicate the static SDL2.a library has a hard dependency on Metal.framework (?) - but it gets the test programs working in Xcode again.

It also adds testyuv_cvt.c to the testoverlay2 target, fixing a link error.


Here is an example of the error I was getting before adding Metal.framework:

```
Ld /Users/ericwa/Library/Developer/Xcode/DerivedData/SDLTest-hejdvjqvdzpmofapnvlpoxaroscc/Build/Products/Debug/testoverlay2 normal x86_64
    cd /Users/ericwa/dev/SDL-Mirror/Xcode/SDLTest
    export MACOSX_DEPLOYMENT_TARGET=10.6
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -L/Users/ericwa/Library/Developer/Xcode/DerivedData/SDLTest-hejdvjqvdzpmofapnvlpoxaroscc/Build/Products/Debug -F/Users/ericwa/Library/Developer/Xcode/DerivedData/SDLTest-hejdvjqvdzpmofapnvlpoxaroscc/Build/Products/Debug -F/Users/ericwa/dev/SDL-Mirror/Xcode/SDLTest/../SDL/build/Debug -F/Users/ericwa/Library/Frameworks -F/Library/Frameworks -filelist /Users/ericwa/Library/Developer/Xcode/DerivedData/SDLTest-hejdvjqvdzpmofapnvlpoxaroscc/Build/Intermediates.noindex/SDLTest.build/Debug/testoverlay2.build/Objects-normal/x86_64/testoverlay2.LinkFileList -mmacosx-version-min=10.6 -Xlinker -object_path_lto -Xlinker /Users/ericwa/Library/Developer/Xcode/DerivedData/SDLTest-hejdvjqvdzpmofapnvlpoxaroscc/Build/Intermediates.noindex/SDLTest.build/Debug/testoverlay2.build/Objects-normal/x86_64/testoverlay2_lto.o -Xlinker -no_deduplicate -framework CoreVideo -framework Cocoa -framework CoreAudio -framework ForceFeedback -framework IOKit -framework AudioToolbox -framework CoreFoundation -framework AudioUnit -framework Carbon /Users/ericwa/Library/Developer/Xcode/DerivedData/SDLTest-hejdvjqvdzpmofapnvlpoxaroscc/Build/Products/Debug/libSDL2.a -Xlinker -dependency_info -Xlinker /Users/ericwa/Library/Developer/Xcode/DerivedData/SDLTest-hejdvjqvdzpmofapnvlpoxaroscc/Build/Intermediates.noindex/SDLTest.build/Debug/testoverlay2.build/Objects-normal/x86_64/testoverlay2_dependency_info.dat -o /Users/ericwa/Library/Developer/Xcode/DerivedData/SDLTest-hejdvjqvdzpmofapnvlpoxaroscc/Build/Products/Debug/testoverlay2

ld: warning: directory not found for option '-F/Users/ericwa/dev/SDL-Mirror/Xcode/SDLTest/../SDL/build/Debug'
ld: warning: directory not found for option '-F/Users/ericwa/Library/Frameworks'
Undefined symbols for architecture x86_64:
  "_MTLCreateSystemDefaultDevice", referenced from:
      _METAL_CreateRenderer in libSDL2.a(SDL_render_metal.o)
      _IsMetalAvailable 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)
  "_OBJC_CLASS_$_MTLSamplerDescriptor", referenced from:
      objc-class-ref in libSDL2.a(SDL_render_metal.o)
  "_OBJC_CLASS_$_MTLTextureDescriptor", referenced from:
      objc-class-ref in libSDL2.a(SDL_render_metal.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
Comment 1 Sam Lantinga 2018-02-20 17:04:45 UTC
Added, thanks!
https://hg.libsdl.org/SDL/rev/728f670288e4