Paradiso


Aerobatic pilot, software architect, explorer, and researcher focused on all things distributed.


Issues using SDLv2 with OSX Yosemite

I've recently been exploring the possibility of starting a side project, a computer game to be specific. Its been a goal of mine for quite a while and I've had a pretty good idea of the type of game I want to create.

I don't want this to be a long post as I just wanted to get a few things out there for people trying to use SDL with OSX Yosemite (and possibly other OSX versions). Specifically, to get started with SDL, if you merely download and install the disk image like it states here and run some sample code, you'll likely run into the issue where the application will crash. This happens because the SDL framework isn't correctly signed for OSX. I spent a whilel google-ing for an answer and, got chose, but nothing was specifically working. Everyone says to run:

codesign -f -s - SDL2  

...but they don't tell you where to run it and on which SDL file. As it turns out, for SDLv2, when you install the framework there will be multiple versions of the SDL file. The file structure looks roughly like:

SDL2.framework/  
  + Headers/
  + Resources/
  + Versions/
    + Current/
      + Headers/
      + Resources/
      + _CodeSignature/
      + SDL2
    + A/
      + Headers/
      + Resources/
      + _CodeSignature/
      + SDL2
  + SDL2

...and, to get your application to work correctly, you need to run the codesign tool on each SDL file under the versions/ directory.

Concretely if you run something like the below it should fix the problem (assuming you installed SDL globally under /Library/Frameworks).

find /Library/Frameworks/SDL2.framework/Versions -name "SDL2" -exec codesign -f -s - {} \;  

Hope this helps others on OSX trying to get SDL to work! Now for the fun part of designing and building my game!

:)

comments powered by Disqus