Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDL2 installing on xCode

I have downloaded SDL2.frameworks from https://www.libsdl.org and installed it into /Libraries/Frameworks/. Then I have pointed xcode a path of frameworks and headers in 'Build Settings', in 'General' 'Frameworks and Libraries' pointed at framework file libSDL2-2.0.0.dylib . The I type #include <SDL2/SDL.h> and try to build the project. It shows 150+ warnings, but if I try to Run the program it says that Library not loaded. Why? what is the problem? I'm using Big Sur OS picture1 build settings general


2 Answers

I have figured it out.

  1. I have installed homebrew from https://brew.sh
  2. I typed in terminal brew install sdl2
  3. Then I have showed the path of framework (in xCode select project file >> build settings >> header search paths) and using cmd+shift+g type /usr/local/include
  4. In General Frameworks & Libraries put libSDL2-2.0.0.dylib (its here /usr/local/Cellar/sdl2/2.0.14_1/lib)
  5. And most important I have checked Disable Library Validations in Signing & Capabilities

After these steps code started to work for me

You need to codesign the Framework.(The command by the Lazy Foo may be not right).

  1. Find out one's own signature:
security find-identity
  1. Sign the frameworks:
codesign -f -s "XXXX Your signature" SDL2.framework

Don't forget to sign the another hidapi.framework within the ./Versions/A/Frameworks.

  1. You can verify the signature:
codesign -display --verbose=4 SDL2.framework
like image 37
Anony Avatar answered Nov 22 '25 13:11

Anony