简体   繁体   English

在OSX上构建巨大的C ++源代码时LLVM Clang 6.0致命错误

[英]LLVM Clang 6.0 fatal error when building a huge C++ source code on OSX

I'm building a pretty huge source code, which builds just fine with MS compiler and Intel compiler, but Clang ends up with this: 我正在构建一个非常庞大的源代码,该代码可以使用MS编译器和Intel编译器很好地构建,但是Clang最终实现了这一点:

fatal error: error in backend: Section too large, can't encode r_address (0x1000008) into 24 bits of scattered relocation entry. 致命错误:后端错误:段太大,无法将r_address(0x1000008)编码为24位分散的重定位条目。

If I remove half of it, it starts working fine, so obviously there are some limitations. 如果我删除其中一半,它将开始正常工作,因此显然存在一些限制。 This seems to be a well known issue from XCode 4.5, but now it's XCode 6.2 and it still doesn't work!! 这似乎是XCode 4.5中的一个众所周知的问题,但是现在是XCode 6.2,它仍然无法正常工作! Any options I could enable to make it work? 我可以启用它的任何选项? For example on Windows I needed to use /BIGOBJ to make the compiler work fine. 例如,在Windows上,我需要使用/ BIGOBJ使编译器正常工作。

Solved by cutting the source file into multiple source files. 通过将源文件切成多个源文件来解决。 It's quite a shame that a compiler bug can cause this as it may be a lot of work and can degrade performance unless the compiler provides global optimizations. 除非编译器提供全局优化,否则编译器错误可能会导致大量工作并降低性能,这真是令人遗憾。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM