The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_Mixer broken under OSX 10.5
Hornpipe2


Joined: 20 Apr 2012
Posts: 4
I'm getting an error when trying to build and run my SDL application under Mac OSX. Let's get the versions out of the way first : )

OS: Mac OSX 10.5 (32-bit)
XCode: 3.1.4
GCC: 4.0.1
SDL: 1.2.15 (Intel 10.5+ Runtime Framework downloaded from here: http://www.libsdl.org/download-1.2.php )
SDL_mixer: 1.2.12 (Intel 10.5+ Framework downloaded from here: http://www.libsdl.org/projects/SDL_mixer )
SDL_image: 1.2.12 (Intel 10.5+ Framework downloaded from here: http://www.libsdl.org/projects/SDL_image )

All three frameworks downloaded today and extracted to (empty) /Library/Frameworks. ~/Library/Frameworks does not exist.

When building, everything works great. (Ignore the "enum" warnings):
Code:
macmini:timewave grkenn$ make -f Makefile.OSX
gcc -c main.c -Wall -O2 -fomit-frame-pointer -frename-registers -pipe  -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers
main.c: In function ‘SDL_main’:
main.c:48: warning: format ‘%d’ expects type ‘int *’, but argument 7 has type ‘enum SDLKey *’
main.c:48: warning: format ‘%d’ expects type ‘int *’, but argument 8 has type ‘enum SDLKey *’
main.c:48: warning: format ‘%d’ expects type ‘int *’, but argument 9 has type ‘enum SDLKey *’
main.c:48: warning: format ‘%d’ expects type ‘int *’, but argument 10 has type ‘enum SDLKey *’
main.c:48: warning: format ‘%d’ expects type ‘int *’, but argument 11 has type ‘enum SDLKey *’
main.c:48: warning: format ‘%d’ expects type ‘int *’, but argument 12 has type ‘enum SDLKey *’
main.c:48: warning: format ‘%d’ expects type ‘int *’, but argument 13 has type ‘enum SDLKey *’
main.c:48: warning: format ‘%d’ expects type ‘int *’, but argument 14 has type ‘enum SDLKey *’
main.c:48: warning: format ‘%d’ expects type ‘int *’, but argument 15 has type ‘enum SDLKey *’
main.c:48: warning: format ‘%d’ expects type ‘int *’, but argument 16 has type ‘enum SDLKey *’
gcc -c game.c -Wall -O2 -fomit-frame-pointer -frename-registers -pipe  -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers
gcc -c menu.c -Wall -O2 -fomit-frame-pointer -frename-registers -pipe  -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers
gcc -c title.c -Wall -O2 -fomit-frame-pointer -frename-registers -pipe  -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers
gcc -c winlose.c -Wall -O2 -fomit-frame-pointer -frename-registers -pipe  -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers
gcc -c hs.c -Wall -O2 -fomit-frame-pointer -frename-registers -pipe  -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers
gcc -c hspick.c -Wall -O2 -fomit-frame-pointer -frename-registers -pipe  -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers
gcc -c keyconf.c -Wall -O2 -fomit-frame-pointer -frename-registers -pipe  -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers
gcc -o timewave SDLMain.m main.o winlose.o game.o menu.o title.o hs.o hspick.o keyconf.o -O2 -fomit-frame-pointer -frename-registers -pipe -Wall -O2 -fomit-frame-pointer -frename-registers -pipe  -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers -framework Cocoa -framework SDL -framework SDL_mixer -framework SDL_image
strip timewave


However, when attempting to run the application, I'm getting an error with the smpeg library included in SDL_mixer.
Code:
macmini:timewave grkenn$ ./timewave
dyld: Library not loaded: @rpath/smpeg.framework/Versions/A/smpeg
  Referenced from: /Library/Frameworks/SDL_mixer.framework/Versions/A/SDL_mixer
  Reason: no suitable image found.  Did find:
   /Library/Frameworks/SDL_mixer.framework/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg: unknown required load command 0x80000022
Trace/BPT trap


A little Googling points out that 0x80000022 often indicates a library <-> OS version mismatch. Possibly the framework has a 10.6 or 10.7 version of smpeg which is taking priority over any 10.5 version.

In fact I'm not using smpeg at all, and would gladly ship without it, but recompiling sdl_mixer to not depend on smpeg doesn't seem like the best solution to me.
Hornpipe2


Joined: 20 Apr 2012
Posts: 4
Here is someone reporting a similar problem on Stack Overflow. Fortunately, there's solutions! Unfortunately, they're solutions requiring recompiling the smpeg library.
http://stackoverflow.com/questions/1440456/static-libraries-in-version-cross-compiled-program

Quote:
I have been searching for the same issue, as I develop on 10.6 but must have a version that works on 10.5. In addition to the compiler flags above, you should add:

-no_compact_linkedit

It is described here:

http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/ld.1.html

where it says:

Normally when targeting Mac OS X 10.6, the linker will generate compact information in the __LINKEDIT segment. This option causes the linker to instead produce traditional relocation information.
I got there from a discussion on the xcode-users mailing list about "unknown required load command 0x80000022".


and

Quote:
The reason for the dyld 0×80000022 error can be that, you are linking on OS X 10.6, and OS X 10.6 will use a load command (LC_DYLD_INFO_ONLY = 0×80000022) that OS X 10.5 does not understand.

To fix this, make sure you are using a deployment target by setting the environment variable just before your link command:

export MACOSX_DEPLOYMENT_TARGET=10.5
(or setenv MACOSX_DEPLOYMENT_TARGET=10.5)

You can always check if your executable uses the right load command like this:

otool -l executable
It will either show LC_DYLD_INFO_ONLY (without deployment target) commands or LC_DYLD_INFO (with deployment target).
SDL_Mixer broken under OSX 10.5
Hornpipe2


Joined: 20 Apr 2012
Posts: 4
I posted about this on the forums, and even emailed the maintainers
directly, but have gotten no response. So next up: we go to the ML.

Here is the original topic:
http://forums.libsdl.org/viewtopic.php?t=8109 I'll quote some
highlights from it.

I'm getting an error when trying to build and run my SDL application
under Mac OSX. Let's get the versions out of the way first : )

OS: Mac OSX 10.5 (32-bit)
XCode: 3.1.4
GCC: 4.0.1
SDL, SDL_mixer, SDL_image: latest 1.2 versions from the website
All three frameworks downloaded today and extracted to (empty)
/Library/Frameworks. (~/Library/Frameworks does not exist.)

When building, everything works great. However, when attempting to
run the application, I'm getting an error with the smpeg library
included in SDL_mixer.
Code:
macmini:timewave grkenn$ ./timewave
dyld: Library not loaded: @rpath/smpeg.framework/Versions/A/smpeg
Referenced from: /Library/Frameworks/SDL_mixer.framework/Versions/A/SDL_mixer
Reason: no suitable image found. Did find:
/Library/Frameworks/SDL_mixer.framework/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg:
unknown required load command 0x80000022
Trace/BPT trap

A little Googling points out that 0x80000022 often indicates a library
<-> OS version mismatch. Possibly the framework has a 10.6 or 10.7
version of smpeg which is taking priority over any 10.5 version.

Here is someone reporting a similar problem on Stack Overflow.
Fortunately, there's solutions! Unfortunately, they're solutions
requiring recompiling the smpeg library.
http://stackoverflow.com/questions/1440456/static-libraries-in-version-cross-compiled-program

--

* It is my belief that the official SDL_mixer for OSX, or at least the
smpeg component of it, needs to be recompiled with additional linker
flag '-no_compact_linkedit ' in order to be usable on 10.5 as
advertised. I've tried to do it but have gotten stuck. *

Thoughts? Has anyone else encountered a similar issue?
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Hornpipe2


Joined: 20 Apr 2012
Posts: 4
I gave up on fixing this: it appears 10.5 support is completely dropped on all SDL and satellite libraries.

I simply got older releases of SDL (1.2.14), SDL_Mixer (1.2.11), SDL_Image (1.2.10) which do work for me.

There is an additional issue: xcode 3.1.4 does not happily build Release targets using these libs. Uncheck “strip debug symbols during copy” in Release project settings and things will build / run just fine.