0

I'm trying to compile a very basic C++ app in XCode using SDL2 - and I'm running into a frustrating code signing issue that is not apparently solvable without disabling hardened validations (not really an option if you want to distribute your app). It's saying:

not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs

Error below:

dyld[3678]: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2
  Referenced from: <35CBD752-6A32-3581-9662-6DE363C74AB5> /Users/alexei/Library/Developer/Xcode/DerivedData/sdltest-fbdltneqiwmnclcteotuuilnactn/Build/Products/Debug/sdltest
  Reason: tried: '/Users/alexei/Library/Developer/Xcode/DerivedData/sdltest-fbdltneqiwmnclcteotuuilnactn/Build/Products/Debug/SDL2.framework/Versions/A/SDL2' (no such file), '/Library/Frameworks/SDL2.framework/Versions/A/SDL2' (code signature in <3F99A8E0-46D9-3192-9F62-E2C522BF5A24> '/Library/Frameworks/SDL2.framework/Versions/A/SDL2' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Library/Frameworks/SDL2.framework/Versions/A/SDL2' (no such file, not in dyld cache)
whitehawk
  • 2,429
  • 29
  • 33

1 Answers1

0

You must first install the latest SDL.framework into your /Library/Frameworks folder. Then you must codesign it with your developer certificate.

cd /Library/Frameworks
codesign -display --verbose=4 SDL2.framework

This will show that the library is codesigned by someone else. For development, you can re-sign the library using your developer certificate. Get this with this command:

security find-identity -v -p codesigning

This will output something like:

  1) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX "Apple Development: your.name@gmail.com (XXXXXXXXXX)"
     1 valid identities found

Take the part in the quotation marks, and paste it into this command:

codesign -f -s "Apple Development: your.name@gmail.com (XXXXXXXXXX)" SDL2.framework

Now, you can safely add the library to your XCode project without using Disable Library Validation (which will make your app undistributable).

For more background on codesigning SDL, check out these links:

whitehawk
  • 2,429
  • 29
  • 33