Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is g++/ld running out of memory?

Tags:

c++

g++

mingw

qt

ld

I am trying to compile Qt (Windows 7, mingw32-g++ 32-bit under msys) and ld is running out of memory. 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

like image 398
chacham15 Avatar asked Aug 16 '12 01:08

chacham15


2 Answers

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. I downloaded it from this MinGW build inside the bin folder. The post with the person linking that distribution is here. I hope this helps other people who run into this problem.

like image 73
chacham15 Avatar answered Sep 28 '22 08:09

chacham15


If you install the current version of MinGW 4.6 or newer, then compile QT should specify the flag:

configure -platform win32-g++-4.6

In "mkspecs" for win32-g++4.6 already defined flag -fno-keep-inline-dllexport which resolves your problem.

like image 24
ConConovaloff Avatar answered Sep 28 '22 08:09

ConConovaloff