GCC相当于MS的/bigobj [英] GCC equivalent of MS's /bigobj
问题描述
我们通常大量使用 boost :: serialization
和模板.一切似乎都进展顺利.
We are making heavy use of boost::serialization
and templates in general. All seems to be going well.
除了,我们在Windows版本上遇到了障碍.似乎导致目标文件太大的问题.我们正在将MinGW/Msys与g ++ 4.7.0结合使用.
Except, we've hit a snag on our Windows builds. It seems to cause issues in the object files being too large. We're using MinGW/Msys with g++ 4.7.0.
c:/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../../mingw32/bin/as.exe: CMakeFiles/source.dir/sourcecode.cpp.obj: too many sections (33396)
C:\Users\username\AppData\Local\Temp\ccnAocvD.s: Assembler messages:
C:\Users\username\AppData\Local\Temp\ccnAocvD.s: Fatal error: can't write CMakeFiles/source.dir/sourcecode.cpp.obj: File too big
Master google revealed this archived message, http://sourceforge.net/mailarchive/forum.php?thread_name=CA%2Bsc5mkLvj%3DW9w2%3DsY%3Dc_N%3DEwnsQuPDEX%3DiBcbsbxS3CuE_5Bg%40mail.gmail.com&forum_name=mingw-users
其中表示另一个人几乎击中了相同的障碍物.它确实指向Visual Studio的/bigobj
选项的一个选项,该选项似乎可以满足我们的需要.但是,我们无法迁移到Visual Studio.
In it, it indicates that another person hit pretty much the same snag. It did point to an option for Visual Studio's /bigobj
option which appears to do what we would need. However, we're unable to move to Visual Studio.
一个建议是在汇编器选项中添加--hash-size.这没有帮助.
One suggestion was to add --hash-size to the assembler options. This did not help.
如果我没记错的话,问题在于目标文件中的条目限制为2 ^ 16.实际上,根据错误消息,我敢冒险说这是一个签名的2 ^ 16条目,但这是花生.Visual Studio的/bigobj
选项会将其更改为2 ^ 32.邮件列表结果不知道GCC的等效选项.进一步的Google搜索结果似乎与此无关.
If I'm not mistaken, the issue lies in the fact that the object files have a limit of 2^16 entries in them. Actually, according to the error message, I would venture that it's a signed 2^16 entries, but that's peanuts. The /bigobj
option for Visual Studio would change that to 2^32. The mailing list result did not know of an equivalent option for GCC. Further google results don't appear to be relevant to this.
在这一点上,我们必须重构我们的代码(ugh)来克服此限制.但是我仍然担心,通过大量的模板,我们可能会一次又一次地遇到问题(我们已经用三个源文件来解决它了.)
At this point we'll have to refactor our code (ugh) to get around this limitation. But I am still concerned that, with heavy templating, we could run into the issue again and again (we've already run into it with three source files).
因此,我的问题是;是否有与Microsoft的/bigobj
选项等效的GCC?我还找不到第三种选择吗?
So my question is thus; is there a GCC equivalent to Microsoft's /bigobj
option? Is there a third option that I'm not yet found?
推荐答案
如果您的GCC版本支持该选项,则解决方案是添加选项 -Wa,-mbig-obj
.您可能只需要在编译步骤中使用它,而不必在链接器步骤中使用.
The solution is to add the option -Wa,-mbig-obj
if your version of GCC supports that option. You probably only need it during the compilation step, not the linker step.
如果编译器不支持该选项,则应考虑使用mingw-w64和 MSYS2 .
If your compiler does not support that option, you should look into using mingw-w64 and MSYS2.
这篇关于GCC相当于MS的/bigobj的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!