从Xcode运行时,C ++程序在main之前崩溃(但是从命令行可以正常)

时间:2015-11-03 10:55:40

标签: c++ xcode c++11 osx-yosemite cpp-netlib

在调试模式和发布模式下,在OS X 10.10.5(Yosemite)上从Xcode 6.3.2运行时,以下程序在调用main之前崩溃。

#include <boost/network/uri.hpp>

int main() 
{ 
    boost::network::uri::uri url; 
    url << boost::network::uri::scheme("http"); 
    return 0; 
}

该应用程序使用cpp-netlib v0.11.2。 cpp-netlib v0.11.0不会发生崩溃。

Xcode显示一个窗口,指出'Xcode意外退出',有3个选项 - '忽略','报告'和'重新打开'。如果我选择“报告”,则会打开另一个窗口,其中包含更多信息。我在下面添加了一段摘录。

请注意,如果我从命令行运行应用程序,则不会发生崩溃。

我如何弄清楚究竟是什么原因?

Process:               Xcode [10190]
Path:                  /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               6.3.2 (7718)
Build Info:            IDEFrameworks-7718000000000000~2
App Item ID:           497799835
App External ID:       812404257
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Xcode [10190]
User ID:               501

Date/Time:             2015-11-03 10:47:56.517 +0000
OS Version:            Mac OS X 10.10.5 (14F27)
Report Version:        11
Anonymous UUID:        FC1A7EB1-54F4-E985-58AC-A097ABAD05B9

Sleep/Wake UUID:       E1BB13F1-08A2-47C5-BF97-CF63B595B260

Time Awake Since Boot: 1200000 seconds
Time Since Wake:       1100 seconds

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGILL)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
ProductBuildVersion: 6D2105

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff8fa364de mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8fa3564f mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff93e43eb4 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff93e4337b __CFRunLoopRun + 1371
4   com.apple.CoreFoundation        0x00007fff93e42bd8 CFRunLoopRunSpecific + 296
5   com.apple.HIToolbox             0x00007fff9829256f RunCurrentEventLoopInMode + 235
6   com.apple.HIToolbox             0x00007fff982922ea ReceiveNextEventCommon + 431
7   com.apple.HIToolbox             0x00007fff9829212b _BlockUntilNextEventMatchingListInModeWithFilter + 71
8   com.apple.AppKit                0x00007fff95e678ab _DPSNextEvent + 978
9   com.apple.AppKit                0x00007fff95e66e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
10  com.apple.dt.DVTKit             0x000000010ce67aaa -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 237
11  com.apple.AppKit                0x00007fff95e5caf3 -[NSApplication run] + 594
12  com.apple.AppKit                0x00007fff95dd9244 NSApplicationMain + 1832
13  libdyld.dylib                   0x00007fff8fac15c9 start + 1

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib          0x00007fff8fa3c232 kevent64 + 10
1   libdispatch.dylib               0x00007fff8e89ca6a _dispatch_mgr_thread + 52

Thread 2:
0   libsystem_kernel.dylib          0x00007fff8fa3651a semaphore_wait_trap + 10
1   libdispatch.dylib               0x00007fff8e8a3b9c _dispatch_group_wait_slow + 218
2   com.apple.CFNetwork             0x00007fff942347be -[NSHost resolveCurrentHostWithHandler:] + 707
3   com.apple.CFNetwork             0x00007fff9423440c __18-[NSHost resolve:]_block_invoke + 298
4   libdispatch.dylib               0x00007fff8e89e323 _dispatch_call_block_and_release + 12
5   libdispatch.dylib               0x00007fff8e899c13 _dispatch_client_callout + 8
6   libdispatch.dylib               0x00007fff8e89d365 _dispatch_queue_drain + 1100
7   libdispatch.dylib               0x00007fff8e89eecc _dispatch_queue_invoke + 202
8   libdispatch.dylib               0x00007fff8e89c6b7 _dispatch_root_queue_drain + 463
9   libdispatch.dylib               0x00007fff8e8aafe4 _dispatch_worker_thread3 + 91
10  libsystem_pthread.dylib         0x00007fff8fdada9d _pthread_wqthread + 729
11  libsystem_pthread.dylib         0x00007fff8fdab3dd start_wqthread + 13

1 个答案:

答案 0 :(得分:0)

这是由调试版本中的非常长的符号引起的,这使得Xcode无法从调试器加载符号。这已经在项目的主分支中修复,应该在0.12.0版本中修复。