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 4342

Summary: YUV sources not built by Xcode/SDL/SDL.xcodeproj for Static or Shared targets
Product: SDL Reporter: David Ludwig <dll>
Component: buildAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: dll
Version: HG 2.0   
Hardware: Other   
OS: Mac OS X (All)   
Attachments: possible fix, revision 1

Description David Ludwig 2018-10-30 17:52:56 UTC
SDL's macOS-specific Xcode project, Xcode/SDL/SDL.xcodeproj, includes targets for either a Framework, a Static Library, or a Shared Library.  The Static and Shared targets do not include either SDL_yuv.c or yuv_rgb.c, whereas the Framework target does.  The end result is that the Static and Shared library targets are incomplete, and attempting to link to them can result in linker errors.

This shows for me in the current content of https://hg.libsdl.org/SDL.  I was using changeset 12373:8feb5da6f2fb to reproduce this;.

To reproduce:

 1. open in Xcode: Xcode/SDL/SDL.xcodeproj
 2. change the active target to any of the SDL demos, such as "testkeys"
 3. attempt to build

Expected Result: the test app builds, successfully

Observed Result: build errors are shown.  Here is what I see with Xcode 10.0:

    Undefined symbols for architecture x86_64:
      "_SDL_ConvertPixels_RGB_to_YUV", referenced from:
          _SDL_ConvertPixels_REAL in libSDL2.a(SDL_surface.o)
      "_SDL_ConvertPixels_YUV_to_RGB", referenced from:
          _SDL_ConvertPixels_REAL in libSDL2.a(SDL_surface.o)
      "_SDL_ConvertPixels_YUV_to_YUV", referenced from:
          _SDL_ConvertPixels_REAL in libSDL2.a(SDL_surface.o)
      "_SDL_GetYUVConversionModeForResolution_REAL", referenced from:
          _SDL_DYNAPI_entry in libSDL2.a(SDL_dynapi.o)
          _GL_SetupCopy in libSDL2.a(SDL_render_gl.o)
      "_SDL_GetYUVConversionMode_REAL", referenced from:
          _SDL_DYNAPI_entry in libSDL2.a(SDL_dynapi.o)
      "_SDL_SetYUVConversionMode_REAL", referenced from:
          _SDL_DYNAPI_entry in libSDL2.a(SDL_dynapi.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)


Adding the following files to SDL's Static Library and Shared Library should, I think, fix the issue.  It does, at least, fix the reproduction case listed above.
Comment 1 David Ludwig 2018-10-30 17:58:23 UTC
Created attachment 3417 [details]
possible fix, revision 1

Here is a fix that works for me.  It makes sure that both SDL_yuv.c and yuv_rgb.c are compiled into the relevant targets (for macOS), Static Library and Shared Library.
Comment 2 David Ludwig 2018-10-30 21:11:53 UTC
This seems to be a false alarm.

When I do a fresh clone of https://hg.libsdl.org/SDL, the bug does not manifest, and the relevant files are included in both the Static and Shared targets.

I'm not sure what happened before, but my best guess is that I did something, or perhaps didn't do something, with the local SDL repo that I was working with.

I'm closing this case as "INVALID" (in lieu of a 'CANNOT REPRODUCE' option).

Apologies for any confusion!