Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
346 views
in Technique[技术] by (71.8m points)

crash - Xcode 5 crashes when running an app with SDL 2

I tried to follow these two tutorials (or the applicable parts of them, due to version differences) to install SDL 2.0.2 to work with Xcode 5.1:

Tutorial 1

Tutorial 2

Running any program with the SDL 2 framework linked causes Xcode to crash with the following problem details:

Process:         Xcode [1787]  
Path:            /Applications/Xcode.app/Contents/MacOS/Xcode  
Identifier:      com.apple.dt.Xcode  
Version:         5.1 (5084)
Build Info:      IDEFrameworks-5084000000000000~21
App Item ID:     497799835
App External ID: 444172641
Code Type:       X86-64 (Native)
Parent Process:  launchd [257]
Responsible:     Xcode [1787]
User ID:         501

PlugIn Path:       /Library/Frameworks/SDL2.framework/Versions/A/SDL2
PlugIn Identifier: org.libsdl.SDL2
PlugIn Version:    2.0.2 (2.0.2)

Date/Time:       2014-03-13 04:24:59.771 +0200
OS Version:      Mac OS X 10.9.2 (13C64)
Report Version:  11
Anonymous UUID:  EFECF2A0-A489-055E-0904-D3CD9E756EB0


Crashed Thread:  21  <lldb.process.internal-state(pid=1804)>

Exception Type:  EXC_BAD_ACCESS (Code Signature Invalid)
Exception Codes: 0x0000000000000032, 0x0000000124718000

VM Regions Near 0x124718000:
    Stack                  0000000124696000-0000000124718000 [  520K] rw-/rwx SM=COW  thread 22
--> mapped file            0000000124718000-00000001247fd000 [  916K] r--/rwx SM=COW  /Library/Frameworks/SDL2.framework/Versions/A/SDL2
    CG shared images       00000001c0003000-00000001c000b000 [   32K] r--/r-- SM=SHM  

Application Specific Information:
ProductBuildVersion: 5B130a

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff8d1aca1a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8d1abd18 mach_msg + 64
2   com.apple.CoreFoundation        0x00007fff87ba8155 __CFRunLoopServiceMachPort + 181
3   com.apple.CoreFoundation        0x00007fff87ba7779 __CFRunLoopRun + 1161
4   com.apple.CoreFoundation        0x00007fff87ba70b5 CFRunLoopRunSpecific + 309
5   com.apple.HIToolbox             0x00007fff8e776a0d RunCurrentEventLoopInMode + 226
6   com.apple.HIToolbox             0x00007fff8e7767b7 ReceiveNextEventCommon + 479
7   com.apple.HIToolbox             0x00007fff8e7765bc _BlockUntilNextEventMatchingListInModeWithFilter + 65
8   com.apple.AppKit                0x00007fff8145a3de _DPSNextEvent + 1434
9   com.apple.AppKit                0x00007fff81459a2b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
10  com.apple.dt.DVTKit             0x00000001067a3e31 -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 84
11  com.apple.AppKit                0x00007fff8144db2c -[NSApplication run] + 553
12  com.apple.AppKit                0x00007fff81438913 NSApplicationMain + 940
13  libdyld.dylib                   0x00007fff8dda55fd start + 1

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib          0x00007fff8d1b1662 kevent64 + 10
1   libdispatch.dylib               0x00007fff88b8543d _dispatch_mgr_invoke + 239
2   libdispatch.dylib               0x00007fff88b85152 _dispatch_mgr_thread + 52

Thread 2:
0   libsystem_kernel.dylib          0x00007fff8d1b0e6a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8ddccf08 _pthread_wqthread + 330
2   libsystem_pthread.dylib         0x00007fff8ddcffb9 start_wqthread + 13

Thread 3:
0   libsystem_kernel.dylib          0x00007fff8d1b0e6a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8ddccf08 _pthread_wqthread + 330
2   libsystem_pthread.dylib         0x00007fff8ddcffb9 start_wqthread + 13

Thread 4:: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib          0x00007fff8d1aca1a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8d1abd18 mach_msg + 64
2   com.apple.CoreFoundation        0x00007fff87ba8155 __CFRunLoopServiceMachPort + 181
3   com.apple.CoreFoundation        0x00007fff87ba7779 __CFRunLoopRun + 1161
4   com.apple.CoreFoundation        0x00007fff87ba70b5 CFRunLoopRunSpecific + 309
5   com.apple.Foundation            0x00007fff87db8967 +[NSURLConnection(Loader) _resourceLoadLoop:] + 348
6   com.apple.Foundation            0x00007fff87db876b __NSThread__main__ + 1318
7   libsystem_pthread.dylib         0x00007fff8ddcb899 _pthread_body + 138
8   libsystem_pthread.dylib         0x00007fff8ddcb72a _pthread_start + 137
9   libsystem_pthread.dylib         0x00007fff8ddcffc9 thread_start + 13

Thread 5:
0   libsystem_kernel.dylib          0x00007fff8d1aca1a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8d1abd18 mach_msg + 64
2   com.apple.CoreFoundation        0x00007fff87ba8155 __CFRunLoopServiceMachPort + 181
3   com.apple.CoreFoundation        0x00007fff87ba7779 __CFRunLoopRun + 1161
4   com.apple.CoreFoundation        0x00007fff87ba70b5 CFRunLoopRunSpecific + 309
5   com.apple.DTDeviceKitBase       0x00000001109fb40e -[DTDKRemoteDeviceDataListener listenerThreadImplementation] + 162
6   com.apple.Foundation            0x00007fff87db876b __NSThread__main__ + 1318
7   libsystem_pthread.dylib         0x00007fff8ddcb899 _pthread_body + 138
8   libsystem_pthread.dylib         0x00007fff8ddcb72a _pthread_start + 137
9   libsystem_pthread.dylib         0x00007fff8ddcffc9 thread_start + 13

Thread 6:: com.apple.CFSocket.private
0   libsystem_kernel.dylib          0x00007fff8d1b09aa __select + 10
1   com.apple.CoreFoundation        0x00007fff87bf3b83 __CFSocketManager + 867
2   libsystem_pthread.dylib         0x00007fff8ddcb899 _pthread_body + 138
3   libsystem_pthread.dylib         0x00007fff8ddcb72a _pthread_start + 137
4   libsystem_pthread.dylib         0x00007fff8ddcffc9 thread_start + 13

Thread 7:: DYMobileDeviceManager
0   libsystem_kernel.dylib          0x00007fff8d1aca1a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8d1abd18 mach_msg + 64
2   com.apple.CoreFoundation        0x00007fff87ba8155 __CFRunLoopServiceMachPort + 181
3   com.apple.CoreFoundation        0x00007fff87ba7779 __CFRunLoopRun + 1161
4   com.apple.CoreFoundation        0x00007fff87ba70b5 CFRunLoopRunSpecific + 309
5   com.apple.Foundation            0x00007fff87dbaadc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 253
6   com.apple.Foundation            0x00007fff87ea34aa -[NSRunLoop(NSRunLoop) run] + 74
7   com.apple.GPUToolsMobileFoundation  0x0000000112ab0e0d -[DYMobileDeviceManager _deviceNotificationThread:] + 134
8   com.apple.Foundation            0x00007fff87db876b __NSThread__main__ + 1318
9   libsystem_pthread.dylib         0x00007fff8ddcb899 _pthread_body + 138
10  libsystem_pthread.dylib         0x00007fff8ddcb72a _pthread_start + 137
11  libsystem_pthread.dylib         0x00007fff8ddcffc9 thread_start + 13

Thread 8:: CVDisplayLink
0   libsystem_kernel.dylib          0x00007fff8d1b0716 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff8ddcdc3b _pthread_cond_wait + 727
2   com.apple.CoreVideo             0x00007fff8d2d1a38 CVDisplayLink::runIOThread() + 656
3   com.apple.CoreVideo             0x00007fff8d2d178f startIOThread(void*) + 147
4   libsystem_pthread.dylib         0x00007fff8ddcb899 _pthread_body + 138
5   libsystem_pthread.dylib         0x00007fff8ddcb72a _pthread_start + 137
6   libsystem_pthread.dylib         0x00007fff8ddcffc9 thread_start + 13

Thread 9:
0   libsystem_kernel.dylib          0x00007fff8d1b0e6a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8ddccf08 _pthread_wqthread + 330
2   libsystem_pthread.dylib         0x00007fff8ddcffb9 start_wqthread + 13

Thread 10:
0   libsystem_kernel.dylib          0x00007fff8d1b0e6a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8ddccf08 _pthread_wqthread + 330
2   libsystem_pthread.dylib         0x00007fff8ddcffb9 start_wqthread + 13

Thread 11:
0   libsystem_kernel.dylib          0x00007fff8d1aca1a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8d1abd18 mach_msg + 64
2   com.apple.CoreFoundation        0x00007fff87ba8155 __CFRunLoopServiceMachPort + 181
3   com.apple.CoreFoundation        0x00007fff87ba7779 __CFRunLoopRun + 1161
4   com.apple.CoreFoundation        0x00007fff87ba70b5 CFRunLoopRunSpecific + 309
5   com.apple.AppKit                0x00007fff815fa16e _NSEventThread + 144
6   libsystem_pthread.dylib         0x00007fff8ddcb899 _pthread_body + 138
7   libsystem_pthread.dylib         0x00007fff8ddcb72a _pthread_start + 137
8   libsystem_pthread.dylib         0x00007fff8ddcffc9 thread_start + 13

Thread 12:
0   libsystem_kernel.dylib          0x00007fff8d1b0e6a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8ddccf08 _pthread_wqthread + 330
2   libsystem_pthread.dylib         0x00007fff8ddcffb9 start_wqthread + 13

Thread 13:
0   libsystem_kernel.dylib          0x00007fff8d1b0e6a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8ddccf08 _pthread_wqthread + 330
2   libsystem_pthread.dylib         0x00007fff8ddcffb9 start_wqthread + 13

Thread 14:
0   libsystem_kernel.dylib          0x00007fff8d1b0716 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff8ddcdc3b _pthread_cond_wait + 727
2   com.apple.Xcode.DevToolsCore    0x000000010c476363 -[XCBlockQueue _processBlocksInThreadSlotNumber:] + 524
3   com.apple.Foundation            0x00007fff87db876b __NSThread__main__ + 1318
4   libsystem_pthread.dylib         0x00007fff8ddcb899 _pthread_body + 138
5   libsystem_pthread.dylib         0x00007fff8ddcb72a _pthread_start + 137
6   libsystem_pthread.dylib         0x00007fff8ddcffc9 thread_start + 13

Thread 15:
0   libsystem_kernel.dylib          0x00007fff8d1b0716 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff8ddcdc3b _pthread_cond_wait + 727
2   com.apple.Xcode.DevToolsCore    0x000000010c476363 -[XCBlockQueue _processBlocksInThreadSlotNumber:] + 524
3   com.apple.Foundation            0x00007fff87db876b __NSThread__main__ + 1318
4   libsystem_pthread.dylib         0x00007fff8ddcb899 _pthread_body + 138
5   libsystem_pthread.dylib         0x00007fff8ddcb72a _pthread_start + 137
6   libsystem_pthread.dylib         0x00007fff8ddcffc9 thread_start + 13

Thread 16:
0   libsystem_kernel.dylib          0x00007fff8d1b0716 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff8ddcdc3b _pthread_cond_wait + 727
2   com.apple.Xcode.DevToolsCore    0x000000010c476363 -[XCBlockQueue _processBlocksInThreadSlotNumber:] + 524
3   com.apple.Foundation            0x00007fff87db876b __NSThread__main__ + 1318
4   libsystem_pthread.dylib         0x00007fff8ddcb899 _pthread_body + 138
5   libsystem_pthread.dylib         0x00007fff8ddcb72a _pthread_start + 137
6   libsystem_pthread.dylib         0x00007fff8ddcffc9 thread_start + 13

Thread 17:: <lldb.comm.debugger.input>
0   libsystem_kernel.dylib          0x00007fff8d1b09aa __select + 10
1   com.apple.LLDB.framework        0x0000000113d965f0 lldb_private::ConnectionFileDescriptor::BytesAvailable(unsigned int, lldb_private::Error*) + 888
2   com.apple.LLDB.framework        0x0000000113d96052 lldb_private::ConnectionFileDescriptor::Read(void*, unsigned long, unsigned int, lldb::ConnectionStatus&, lldb_private::Error*) + 170
3   com.apple.LLDB.framework        0x0000000113d94493 lldb_private::Communication::ReadFromConnection(void*, unsigned long, unsigned int, lldb::ConnectionStatus&, lldb_private::Error*) + 97
4   com.apple.LLDB.framework        0x0000000113d940f1 lldb_private::Communication::ReadThread(void*) + 147
5   libsystem_pthread.dylib         0x00007fff8ddcb899 _pthread_body + 138
6   libsystem_pthrea

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...