使用LLVM和任何优化进行构建会导致应用程序在启动时崩溃 [英] Building with LLVM and any optimization causes app to crash on startup

查看:136
本文介绍了使用LLVM和任何优化进行构建会导致应用程序在启动时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用XCode 4.0.1中的LLVM 2.0构建我的应用程序以及任何级别或优化级别不是非(除-O0外的任何级别或优化级别)时,应用程序在设备上启动后会崩溃(模拟器无问题)。我似乎无法调试崩溃,因为当我在xcode中编译并通过GDB / LLDB连接时,它不会发生。此外,只有当我使用xcodebuild在命令行上构建应用程序时才会发生崩溃;即使使用完全相同的项目设置,通过XCode IDE构建也不会崩溃。我在崩溃日志中看不到任何有用的信息,因为崩溃发生在我的代码之外:

 异常类型:EXC_BAD_ACCESS( SIGBUS)
例外代码:KERN_PROTECTION_FAILURE at 0x00b53400
崩溃线程:0

线程0名称:调度队列:com.apple.main-thread
线程0崩溃:
0 ??? 0x00b53400 0 + 11875328

它不会正确表示符号,因为它不知道崩溃发生在哪个库设备控制台显示我们的应用程序在启动时所做的一些NSLog语句,然后加载并绘制第一个屏幕的UI,然后发生崩溃。 没有优化的构建,或者使用GCC 4.2构建任何优化级别都可以。



这里可能发生了什么,我该如何调试它?当XCode IDE构建和部署应用程序与xcodebuild命令行界面时,它们可以做些什么不同?解析方案

升级到Xcode 4.0.2。



它为我们解决了这个问题(ARMv6启动时崩溃,但未启用优化的ARMv7)。


When I try to build my app with LLVM 2.0 in XCode 4.0.1 and any level or optimization that is not none (anything but -O0), the app crashes after i launch it on the device (simulator is ok). I can't seem to debug the crash as it does not happen when i build in xcode and attach via GDB/LLDB. Also, the crash only happens when i build the app on the command line with xcodebuild; building via the XCode IDE doesn't crash even with the exact same project settings. I can't see any useful information in the crash logs, as the crash happens outside my code:

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00b53400
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   ???                             0x00b53400 0 + 11875328

It won't symbolicate correctly since it doesn't know which library the crash happened in.

The device console shows some NSLog statements that our app makes at startup, then the first screen's UI is loaded and drawn, and after that the crash happens. Building with no optimizations, or building with GCC 4.2 with any optimization level works fine.

What could be happening here, and how can i debug it? What could the XCode IDE be doing differently when it builds and deploys the app vs. the xcodebuild command line interface?

解决方案

Upgrade to Xcode 4.0.2.

It fixed this issue (crash on launch for ARMv6 but not ARMv7 with optimization turned on) for us.

这篇关于使用LLVM和任何优化进行构建会导致应用程序在启动时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆