目标文件有太多的部分 [英] Object file has too many sections

查看:552
本文介绍了目标文件有太多的部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在大量使用的boost ::序列化和模板一般。一切似乎很顺利。

We am 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

法师谷歌透露了这一消息存档,<一个href=\"http://sourceforge.net/mailarchive/forum.php?thread_name=CA%2Bsc5mkLvj%3DW9w2%3DsY%3Dc_N%3DEwnsQuPDEX%3DiBcbsbxS3CuE_5Bg%40mail.gmail.com&forum_name=mingw-users\">http://sourceforge.net/mailarchive/forum.php?thread_name=CA%2Bsc5mkLvj%3DW9w2%3DsY%3Dc_N%3DEwnsQuPDEX%3DiBcbsbxS3CuE_5Bg%40mail.gmail.com&forum_name=mingw-users

在它时,表明另一人击中pretty大体相同抽丝。它确实点到了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大小添加到汇编器选项。这并没有帮助。

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的等效选项。另外谷歌的结果似乎不相关了这一点。

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.

在这一点上,我们将不得不重构我们的code(啊)来解决这个限制。不过,我仍然关注的是,沉重的模板,我们可以一次又一次地跑入的问题(我们已经有三个源文件碰上它)。

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).

所以我的问题是这样;有没有GCC相当于微软的 / bigobj 选项?有没有我还没有找到第三种选择?

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?

推荐答案

解决的办法是添加选项 -Wa,-mbig-OBJ 如果你的GCC支持的版本该选项。你可能只在编译步骤,而不是一步连接器需要它。

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.

这篇关于目标文件有太多的部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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