Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: kirash4 on May 09, 2014, 09:01:06 pm

Title: Using C::B's MinGW to compile wxWidgets 2.8.12 -> ld.exe error
Post by: kirash4 on May 09, 2014, 09:01:06 pm
I'm trying to use the build-in MinGW that comes with C::B to compile wxWidgets 2.8.12. The process runs for some time and then fails with the following error:
Code
Creating library file: ..\..\lib\gcc_dll\libwxmsw28.a

c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../..
/mingw32/bin/ld.exe: out of memory allocating 160 bytes
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe: *** [..\..\lib\gcc_dll\wxmsw28_gcc_custom.dll] Error 1

The compile command issued was:
Code
T:\wxMSW-2.8.12\build\msw>mingw32-make.exe -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0

That is just duplicating what's also in the config.gcc file as far as the command line options goes.

Looking at the system's memory usage, during that last step, memory usage climbs to about 5.6GB out of the system's 8GB. It's a Win7 64-bit machine. Should I forego the MinGW version that comes with C::B and install a stand alone version and try compiling with that?
Title: Re: Using C::B's MinGW to compile wxWidgets 2.8.12 -> ld.exe error
Post by: Jenna on May 09, 2014, 11:27:19 pm
Have a look at: http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef#Build_wxWidgets (http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef#Build_wxWidgets).
You need to add CXXFLAGS=-fno-keep-inline-dllexport or you run out of memory while linking.
You should also use UNICODE=1 unless you build for a real old windows version (pre Win2000), but you will not be able to build C::B (at least not without really heavy modification).
Title: Re: Using C::B's MinGW to compile wxWidgets 2.8.12 -> ld.exe error
Post by: kirash4 on May 09, 2014, 11:33:29 pm
Oh I'm not doing this to build C::B on Windows. I'm trying to get every library compiled using the same compiler, in hopes that it will make things easier. ImageMagick releases two flavors of binaries, one for CygWin and one for MinGW. So I'm trying to figure out which way to go with wx. If I can get it compiled for both, then great, it gives me multiple options, otherwise I'll stick to one or the other.

I was following the instructions posted here: http://wiki.wxwidgets.org/CodeBlocks_Setup_Guide which recommended setting unicode=0 - I suppose that's specific to getting C::B itself compiled against wx.

Thanks for the CXXFLAGS note.
Title: Re: Using C::B's MinGW to compile wxWidgets 2.8.12 -> ld.exe error
Post by: Jenna on May 09, 2014, 11:40:56 pm
I was following the instructions posted here: http://wiki.wxwidgets.org/CodeBlocks_Setup_Guide which recommended setting unicode=0 - I suppose that's specific to getting C::B itself compiled against wx.
You should also use UNICODE=1 unless you build for a real old windows version (pre Win2000), but you will not be able to build C::B (at least not without really heavy modification).

The link in the wxWidgets-wiki is definitely outdated.
Title: Re: Using C::B's MinGW to compile wxWidgets 2.8.12 -> ld.exe error
Post by: kirash4 on May 09, 2014, 11:43:55 pm
One thing I noticed is the link you gave me does not mention the USE_XRC=1 option. Is that no longer relevant?
Title: Re: Using C::B's MinGW to compile wxWidgets 2.8.12 -> ld.exe error
Post by: Jenna on May 09, 2014, 11:47:02 pm
On my Windows test-systems (xp, 7 and 8.1) I build wx with this commandline to compile C::B and it works.
Title: Re: Using C::B's MinGW to compile wxWidgets 2.8.12 -> ld.exe error
Post by: stahta01 on May 10, 2014, 03:08:04 am
Edit: Reread this thread and saw the answer I mentioned was already covered.

This sounds like the wxWidgets link error from long ago.
What was the option to fix this?

I have upgraded my MinGW to a version without this bug.

From my old build batch files I see I used these in the past.
Code
-fno-strict-aliasing 
-Wno-unused-local-typedefs
-fno-keep-inline-dllexport

I think this one was the fix "-fno-keep-inline-dllexport".

Code
CXXFLAGS="-fno-keep-inline-dllexport"

From http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows (http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows)
Quote
If you are using a recent version of MinGW you may find that the object files are too large and that the linker runs out of memory. To fix this problem you need to edit config.gcc so that inline functions are not exported, by modifying the CFLAGS and CXXFLAGS lines to:

 CFLAGS ?= -fno-keep-inline-dllexport

 CXXFLAGS ?= -fno-keep-inline-dllexport

Tim S.