我的应用程序构建,运行,模拟等等很好!一切都在模拟器和物理设备上100%工作。建设期间没有错误或警告。
现在,当我尝试存档我的项目时,出现以下错误:
0 clang 0x000000010bdb3472 _ZL15PrintStackTracePv + 34
1 clang 0x000000010bdb38f9 _ZL13SignalHandleri + 553
2 libsystem_c.dylib 0x00007fff8bd8ccfa _sigtramp + 26
3 libsystem_c.dylib 0x0000000000000001 _sigtramp + 18446603338169922337
4 clang 0x000000010bc7fbbf (anonymous namespace)::ObjCARCOpt::runOnFunction(llvm::Function&) + 7407
5 clang 0x000000010b0502b2 llvm::FPPassManager::runOnFunction(llvm::Function&) + 322
6 clang 0x000000010b052baf (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) + 1039
7 clang 0x000000010b050bc1 llvm::MPPassManager::runOnModule(llvm::Module&) + 289
8 clang 0x000000010b0505c5 llvm::PassManagerImpl::run(llvm::Module&) + 277
9 clang 0x000000010b0504ad llvm::PassManager::run(llvm::Module&) + 13
10 clang 0x000000010b02f0e8 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 4424
11 clang 0x000000010b02c941 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 513
12 clang 0x000000010aef83f6 clang::ParseAST(clang::Sema&, bool) + 406
13 clang 0x000000010aef6ed7 clang::CodeGenAction::ExecuteAction() + 855
14 clang 0x000000010aec943f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 879
15 clang 0x000000010aec80cb clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2683
16 clang 0x000000010aeba8ce cc1_main(char const**, char const**, char const*, void*) + 5086
17 clang 0x000000010ae950d8 main + 648
18 clang 0x000000010ae94e44 start + 52
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
clang: note: diagnostic msg: Please submit a bug report to http://developer.apple.com/bugreporter/ and include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/yn/jhqtwmzx2l31sytjj7ltz_qc0000gn/T/Image-u5GlrW.mii
clang: note: diagnostic msg: /var/folders/yn/jhqtwmzx2l31sytjj7ltz_qc0000gn/T/Image-u5GlrW.sh
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 254
我不明白为什么。我现在问题来自我在simple-iphone-image-processing
项目中使用的Image.mm。我认为这与ARC有关。任何人都能对此有所了解吗?
由于
更新
好的,所以我尝试了很多次并且有效。所以问题是间歇性的。如果其他人可能有话要说,我会在这里留下这个问题。
答案 0 :(得分:1)
正在破坏的功能是ObjCARCOpt::runOnFunction(llvm::Function&)
。只是为了咯咯笑,我发布了下面的runOnFunction()代码。此函数的目的是优化传入的llvm::Function
对象中与ARC相关的对象代码。这很好,但编译器中似乎存在与Objective-C ++处理相关的错误,坦率地说它没有让我感到惊讶。
错误报告已经提交给Apple(here,here,可能还有其他地方)。你也应该报告。
在此之前,我可能会提出一些建议。
1)由于问题是间歇性的,所以继续你的项目。这可能对你有用,也可能不对。毕竟,编译器应该是确定性的......
2)尝试为Obj-C ++的东西关闭ARC。这可能是最简单的方法。
3)关闭ARC优化。通过从构建中省略-enable-objc-arc-opts
来执行此操作。如何使用XCode构建设置执行此操作留给读者练习。无论如何,我认为你最好的选择是2)。
llvm-3.0.src/lib/Transforms/Scalar/ObjCARC.cpp
的代码如下。你最好的选择是离开if (!Run) return false;
。如果在要解析的模块中禁用ARC,则Run
将为false。祝你好运,别忘了提交bug报告!
bool ObjCARCOpt::runOnFunction(Function &F) {
if (!EnableARCOpts)
return false;
// If nothing in the Module uses ARC, don't do anything.
if (!Run)
return false;
Changed = false;
PA.setAA(&getAnalysis<AliasAnalysis>());
// This pass performs several distinct transformations. As a compile-time aid
// when compiling code that isn't ObjC, skip these if the relevant ObjC
// library functions aren't declared.
// Preliminary optimizations. This also computs UsedInThisFunction.
OptimizeIndividualCalls(F);
// Optimizations for weak pointers.
if (UsedInThisFunction & ((1 << IC_LoadWeak) |
(1 << IC_LoadWeakRetained) |
(1 << IC_StoreWeak) |
(1 << IC_InitWeak) |
(1 << IC_CopyWeak) |
(1 << IC_MoveWeak) |
(1 << IC_DestroyWeak)))
OptimizeWeakCalls(F);
// Optimizations for retain+release pairs.
if (UsedInThisFunction & ((1 << IC_Retain) |
(1 << IC_RetainRV) |
(1 << IC_RetainBlock)))
if (UsedInThisFunction & (1 << IC_Release))
// Run OptimizeSequences until it either stops making changes or
// no retain+release pair nesting is detected.
while (OptimizeSequences(F)) {}
// Optimizations if objc_autorelease is used.
if (UsedInThisFunction &
((1 << IC_Autorelease) | (1 << IC_AutoreleaseRV)))
OptimizeReturns(F);
return Changed;
}