Xcode 5 crashes when running an app with SDL 2

六眼飞鱼酱① 提交于 2019-11-28 04:22:01

It looks like the problem is that SDL2 isn't properly signed. There's a ticket to fix the issue at https://bugzilla.libsdl.org/show_bug.cgi?id=2058.

When you spawn an application from Xcode 5 with lldb, Xcode loads a plugin that will inspect modules your application loads, presumably to give you insight into your program. Xcode is set up to crash if it reads from a page that is backed by an invalid signature. Because SDL2 isn't properly signed, when Xcode 5 attempts to examine the SDL2 library, it will read from an invalid page, and crash. You get a clue that this is happening by the following line in your crash report above:

Exception Type:  EXC_BAD_ACCESS (Code Signature Invalid)

To see for yourself that SDL isn't properly signed, execute the following command from the folder where SDL2 resides:

$ codesign -vvvv SDL2 
SDL2: invalid signature (code or signature have been modified)
In architecture: x86_64 

If you don't want to build your own version of SDL2 (the solution that's mentioned above), you can update the signature to make it correct:

$ codesign -f -s - SDL2 
SDL2: replacing existing signature

And to verify that the new signature is good:

$ codesign -vvvv SDL2
SDL2: valid on disk
SDL2: satisfies its Designated Requirement

Note that doing this as a workaround is risky from a security standpoint, as I'm not sure why the signature is invalid.

I had the same problem using 2.0.2 (stable). I downloaded the latest code (as of 3/13) and compiled the framework manually and it worked.

  1. hg clone http://hg.libsdl.org/SDL
  2. Compile the "Framework" target in Xcode/SDL/SDL.xcodeproj
  3. Copy framework to /Library/Frameworks
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!