Xcode 4内部编译错误:总线错误 [英] Xcode 4 internal compiler error: bus error

查看:154
本文介绍了Xcode 4内部编译错误:总线错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xcode 4.0.1开始给我一个内部编译器错误。它只是说总线错误。它出现在我的一个.m文件的底部,现在已经近4000行。



我看过这个问题,但我不会犯这个错误,当它出来我通常可以通过添加一些随机线的代码。当它第一次裁剪时,我跟踪它到一个视图的框架在一堆新的代码:

  view.frame = CGRectMake(otherView.frame.origin.x,0,otherView2.frame.size.width,40); 

如果我用硬编码值替换otherView和otherView2引用,问题就消失了。或者,如果我简单地把 int x = 0; 在冒犯行上面,它就走了。



还查看了此问题,但它没有一个明确的答案。它似乎不是任何单独的代码行;它似乎只是似乎随机。



我已经尝试了所有可能的编译器的项目(GCC 4.2,LLVM GCC 4.2和LLVM编译器2.0,他们都有问题。我有静态分析器设置为运行每个版本,并关闭它没有帮助。这个问题似乎表明它是一个错误编译器。我只是卡住了吗?是否有解决方法?



编辑:另一个例子:它再次发生,我跟踪到:

  [headerView centerViewVertically:milesLabel pixelsFromRight:pointLabel.frame。 size.width + 20]; 

我将其更改为:

  int x = pointLabel.frame.size.width; 
[headerView centerViewVertically:milesLabel pixelsFromRight:x + 20];
解决方案

>我也有这个错误,只有在设备上编译时,xcode预先实现了我的代码的现代化。我将编译器切换到Apple LLVM 2.1在项目和目标构建设置,并再次运行。这拾起了一些流浪;在项目和错误总线错误消失了。


Xcode 4.0.1 has started giving me an internal compiler error. It just says "Bus error". It occurs at the bottom of one of my .m files, which is now almost 4000 lines long.

I've looked at this question, but I'm not making that mistake, and when it comes up I can usually fix it by adding some random lines of code somewhere. When it first cropped up, I tracked it down to where I was setting the frame of a view in a bunch of new code:

view.frame = CGRectMake(otherView.frame.origin.x, 0, otherView2.frame.size.width, 40);

If I replaced the otherView and otherView2 references with hardcoded values, the problem went away. Or if I simply put int x = 0; above the offending line, it went away.

I've also looked at this question, but it doesn't have a clear answer. It doesn't seem to be any individual line of code; it just comes up seemingly randomly. And Google doesn't have any clear solution that I could find.

I've tried with all the possible compilers for the project (GCC 4.2, LLVM GCC 4.2, and LLVM Compiler 2.0, and they all have the problem. I have the Static Analyzer set to run every build, and turning it off doesn't help. This question seems to indicate it's a bug in the compiler. Am I just stuck? Is there a workaround?

EDIT: Another example: It happened again and I tracked it down to:

[headerView centerViewVertically:milesLabel pixelsFromRight:pointLabel.frame.size.width + 20];

I changed it to:

int x = pointLabel.frame.size.width;
[headerView centerViewVertically:milesLabel pixelsFromRight:x + 20];

And it worked again.

解决方案

I also got this error, only when compiling on device, after xcode preformed a modernize of my code. I switched the compiler to Apple LLVM 2.1 in both the project and the targets build settings and ran again. This picked up some stray ; in the project and the error bus error went away.

这篇关于Xcode 4内部编译错误:总线错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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