[SDL] MacOS and static linking problem

Gabriele Greco gabriele.greco at darts.it
Tue Mar 26 09:48:25 PDT 2013

> cc -o Launcher foo.o bar.o ... -arch x86_64 -static `sdl2-config
> --static-libs`
You should remove for sure -static from your command line, otherwise GCC
will try to find a static library for everything, also system frameworks,

And `sdl2-config --static-libs` evalutes to:
> -L/usr/local/lib -lSDL2 -lm -liconv -Wl,-framework,OpenGL
> -Wl,-framework,ForceFeedback -lobjc -Wl,-framework,Cocoa
> -Wl,-framework,Carbon -Wl,-framework,IOKit -Wl,-framework,CoreAudio
> -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit

 ...as far as I can see from your --static-libs, except if you have build
SDL as static only with --disable-shared, the output of sdl-config is
wrong, it should contain something like:

[...]   -Wl,"-Bstatic"  -lSDL2 -Wl,"-Bdynamic" [...]

Anyway usually there is no need to compile statically on OSX, since you can
distribute SDL as framework inside your application bundle.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130326/eb5001ce/attachment-0008.htm>

More information about the SDL mailing list