简体   繁体   English

为什么g ++ / ld会耗尽内存?

[英]Why is g++/ld running out of memory?

I am trying to compile Qt (Windows 7, mingw32-g++ 32-bit under msys) and ld is running out of memory. 我正在尝试编译Qt(Windows 7,mysw32-g ++ 32位msys下)和ld内存不足。 Does anyone know why? 有谁知道为什么? Or perhaps a workaround? 或者也许是一种解决方法? Thanks! 谢谢!

$ g++ -mthreads -shared -Wl,--out-implib,i:/Programs/Qt/lib/libQtGuid4.a -o ../
../lib/QtGuid4.dll object_script.QtGuid.Debug  -L'i:/Programs/Qt/lib' -L'i:/Pro
grams/Qt/lib' -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32
 -lole32 -luuid -luser32 -ladvapi32 tmp/obj/debug_shared/QtGuid_resource_res.o
-lmsimg32 -lshell32 -lQtCored4 -lz

i:/programs/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../../mingw32/bin/ld.exe: o
ut of memory allocating 133614056 bytes
collect2.exe: error: ld returned 1 exit status

Thanks to all the commenters who helped me figure out a solution to this problem. 感谢所有帮助我找到问题解决方案的评论者。 What I did was replace ld with a large address aware version. 我所做的是用大地址识别版本替换ld I downloaded it from this MinGW build inside the bin folder. 我下载了它从这个 MinGW的生成bin文件夹内。 The post with the person linking that distribution is here . 链接该分发的人员的帖子就在这里 I hope this helps other people who run into this problem. 我希望这可以帮助遇到这个问题的其他人。

If you install the current version of MinGW 4.6 or newer, then compile QT should specify the flag: 如果安装当前版本的MinGW 4.6或更新版本,则编译QT应指定标志:

configure -platform win32-g++-4.6 configure -platform win32-g ++ - 4.6

In "mkspecs" for win32-g++4.6 already defined flag -fno-keep-inline-dllexport which resolves your problem. 在“mkspecs”中,win32-g ++ 4.6已经定义了标志-fno-keep-inline-dllexport来解决你的问题。

I tried to download ld.exe from somewhere else, but it was not fitting into my toolkit (TDM-GCC). 我试图从其他地方下载ld.exe,但它不适合我的工具包(TDM-GCC)。 Some plugin was not able to load. 某些插件无法加载。 Hopefully, making ld.exe LAA was not that hard. 希望制作ld.exe LAA并不是那么难。 I have opened ld.exe in a hex editor and patched at offset 0x96 "0f 03" to "2f 03". 我已经在十六进制编辑器中打开了ld.exe,并在偏移0x96“0f 03”到“2f 03”处打了补丁。 That did the trick for me. 这对我有用。

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

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