SDL 1.3 MacOS X Static library linker errors?

SDL runs fine when compiled into SDL.framework, but when I create the static library libSDL.a and use that instead, I get two linker errors:

SDL_GetWindowDisplay()
SDL_GetCPUCacheLineSize()

symbol(s) undefined.

Yes, my program uses both of these. They are fairly new functions I believe, so somehow they aren’t getting “included” in the static library build? Any idea how to fix this? SDL_GetWindowDisplay() is in SDL_video.c, so I don’t see why it would be left out.

I need to build a static library instead of a framework for Mac App Store submission, because Apple’s Application Loader gives bogus errors when trying to submit an app that uses the 1.3 SDL framework. Using a static library, I could work around this.

Vern,

Don’t know 1.3 well enough to say, but I’ll bet there’s some included
linkage that the framework had (look in the linker area or some
framework) that you need to include in the program the static library is
being used in. More than likely a missing framework. I know that error
seems spurious, but the same thing happened to me on libPNG because I
forgot to include -lz in my linker flags (and it was originally in the
library.)

[>] Brian

No luck trying to add more frameworks to my target project, or to the “Static Library -> Link Library With Binaries” build portion of the SDL XCode project. :-/

Aside from 2 frameworks, I don’t see anything else missing.

Op 2011-07-18 20:53 , VernJensen schreef:

SDL runs fine when compiled into SDL.framework, but when I create the
static library libSDL.a and use that instead, I get two linker errors:

SDL_GetWindowDisplay()
SDL_GetCPUCacheLineSize()

symbol(s) undefined.
Perhaps you’re linking against and older libSDL.a that is on the system
somewhere (not the one you just created).

Kees Bakker wrote:

Perhaps you’re linking against and older libSDL.a that is on the system somewhere (not the one you just created).

Well, I found the libSDL.a that I had just created, marked with the correct date and time, and dragged that into my XCode project. So it’s doubtful it’s using another library? I will double-check though. Wouldn’t be the first time my XCode project has behaved strangely.

Okay, so yes, it turns out it was linking with an old SDL-1.3.dylib for some reason. I still don’t know how or why it was doing this – there was nothing in the XCode project that could cause it to do this (from a human perspective at least.) Anyway, I rebuilt the project from scratch.

Only one problem remains:

_sync_lock_release()

referenced from _SDL_Atomic_Unlock() in libSDL.a (SDL_spinlock.o)

symbol(s) not found

No idea how to fix this. Any guesses at what might be causing it?

Thanks to a tip from Ryan, I modified HAVE_GCC_ATOMICS in SDL_config.h to be 0, and it links and runs just fine now. Tomorrow I’ll see if this lets it get on the Mac App Store now, since I can now run SDL as a static library instead of as a framework.