gcc version 4.5.0 20100311 (experimental) (GCC)
Unusable, sadly.agreed, because a lot of patches need to be applied to the GCC4.5 source.
I'd recommend trying the '-2' release. I've successfully built wxWidgets and I'm in the process of building C::B with it.
Runtime requirements:
binutils-2.20.1-2-mingw32-bin.tar.gz
libmpc-0.8.1-1-mingw32-dll-2.tar.lzma
libmpfr-2.4.1-1-mingw32-dll-1.tar.lzma
libgmp-5.0.1-1-mingw32-dll-10.tar.lzma
libpthread-2.8.0-3-mingw32-dll-2.tar.lzma (for OpenMP)
mingwrt-3.18-mingw32-dev.tar.gz
w32api-3.14-mingw32-dev.tar.gz
GNU ld (GNU Binutils) 2.20
ld.exe: out of memory allocating 28770816 bytes
...for the record: There is a "gcc-4.5.0_20100311-2" version now....now it's:
Has anyone got around the issue of ld running out of memory?Did you try the above already?
...now it's:I try it, but it not working in here.
gcc-4.5.0-1 (2010-04-19)
LDFLAGS ?= --no-keep-memory --reduce-memory-overheads
gcc-4.5.0 is released btw.
http://gcc.gnu.org/
wx compilation still runs out of memory though :S looking on how to fix that atm.
i can build cb with the multilibs but i doubt the cb guys would love that option ?I personally perfer monolithic wxWidget library for Codeblocks.
GNU ld (GNU Binutils) 2.20
Supported emulations:
i386pe
Hi, allI find the reason, When linking, we need this option too.
First, pardon for my poor english.
I have succesfully built wxWidgets2.8.11 with MinGW-W64 GCC 4.5.0 cross compiler.
As gcc 4.5.0 changed its code-generation, now the code dllexport-inline function shall be generated in object files. However, in the headers of wxWidgets, there are so many dllexport-inline functions, so the object file could be as large as 1MB. In my 2GB RAM laptop, Windows Server 2008 R2, it runs with an end of out of memory exception while linking. So I got a cross compiler from MinGW-W64 project, and start building wxWidgets in Ubuntu Linux with 2GB SWAP space(finally it seems cost about 2.8GB memory for linking). This time I built it successful. And I added --disable-precompile-headers whlie configuration to reduce the size of those object files(cause if precompiled header is used, code for all dllexport-inline functions in header of wx would be generated in EACH OBJECT FILES), and edit the Makefile with flags --no-keep-memory , --reduce-memroy-overheads and --enable-runtime-pseudo-reloc-v2 passed to linker to avoid the situation out of memory and to ensure dll loaded properly.
By the way I tested this library in code::blocks (windows, of cause), compiling and linking went well. But the program could not run and with a 0x0000000c error. I know this problem could be solved by pass a flag of --enable-runtime-pseudo-reloc-v2 to the linker, and I tested this flags in command line and it works. But I don't know where to add this flag in project build option. I added the flag in 'Compiler settings - other options' tab, but it didn't work. I added the flag in 'Linker setting -Other linker option' box, it didn't work, too. So I think if this, flags couldn't be passed to the linker, is a bug of codeblocks, and plz fix it. Or it's a problem of my codeblocks.
And I also test 64bit-compiler, but 64-bits linker seems to link resource file wrongly(without .res file, the executable is linked properly, but add a resource file it could not run with an error of 0x0000007d)
luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32
collect2: ld returned 5 exit status
mingw32-make: *** [..\..\lib\gcc_dll\wxmsw28u.dll] Error 1
# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS ?= -static-libgcc -static-libstdc++
# Standard linker flags
LDFLAGS ?= -static-libgcc -static-libstdc++
mingw32-make -f makefile.gcc LDFLAGS=-s SHARED=1 BUILD=release UNICODE=1 MONOLITHIC=1 OFFICIAL_BUILD=1 RUNTIME_LIBS=static
mingw32-make -f makefile.gcc CXXFLAGS="-Wl,--enable-auto-import" LDFLAGS="-Wl,--enable-auto-import -s" SHARED=1 BUILD=release UNICODE=1 MONOLITHIC=1 OFFICIAL_BUILD=1 RUNTIME_LIBS=static
nothing so far no :( i need to check the diffs between 4.4.3 and 4.5.0 to see whats changed.I would suggest test wxWidgets with all GCC 4.5 snapshots here,
--- gcc/tree.c 2010-04-02 00:18:08 +0800 revert some code to gcc-4.5-20090521, don't emit exported inline functions
+++ gcc/tree-2.c 2010-05-14 22:56:44 +0800
@@ -5377,11 +5377,6 @@
if (*no_add_attrs == false)
DECL_DLLIMPORT_P (node) = 1;
}
- else if (TREE_CODE (node) == FUNCTION_DECL
- && DECL_DECLARED_INLINE_P (node))
- /* An exported function, even if inline, must be emitted. */
- DECL_EXTERNAL (node) = 0;
-
/* Report error if symbol is not accessible at global scope. */
if (!TREE_PUBLIC (node)
&& (TREE_CODE (node) == VAR_DECL
--- gcc/cp/decl2.c 2010-03-24 06:29:54 +0800
+++ gcc/cp/decl2-2.c 2010-05-14 23:00:42 +0800
@@ -1782,10 +1782,6 @@
|| (DECL_ASSEMBLER_NAME_SET_P (decl)
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
return true;
- /* Functions marked "dllexport" must be emitted so that they are
- visible to other DLLs. */
- if (lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
- return true;
/* Otherwise, DECL does not need to be emitted -- yet. A subsequent
reference to DECL might cause it to be emitted later. */
return false;
--- gcc/cp/semantics.c 2010-04-02 02:48:34 +0800
+++ gcc/cp/semantics-2.c 2010-05-14 23:14:04 +0800
@@ -3447,10 +3447,8 @@
/* If the user wants us to keep all inline functions, then mark
this function as needed so that finish_file will make sure to
- output it later. Similarly, all dllexport'd functions must
- be emitted; there may be callers in other DLLs. */
- if ((flag_keep_inline_functions && DECL_DECLARED_INLINE_P (fn))
- || lookup_attribute ("dllexport", DECL_ATTRIBUTES (fn)))
+ output it later. */
+ if (flag_keep_inline_functions && DECL_DECLARED_INLINE_P (fn))
mark_needed (fn);
}
For C DLLs the solution seems simple enough: just don't dllexport inline
functions and no code for them will be generated. But this doesn't work for
C++ DLLs because, AFAIK, all C++ libraries use the same approach for DLL
export, namely they declare the entire classes as being dllexport'd which
inevitably leads to all of its inline functions being dllexport'd as well.
Lastly, there's one other new command line switch: -fvisibility-inlines-hidden. This causes all inlined class member functions to have hidden visibility, causing significant export symbol table size & binary size reductions though not as much as using -fvisibility=hidden. However, -fvisibility-inlines-hidden can be used with no source alterations, unless you need to override it for inlines where address identity is important either for the function itself or any function local static data.
--- ld/emultempl/pe.em 2009-09-14 19:43:30 +0800
+++ ld/emultempl/pe.em 2010-01-29 10:49:20 +0800
@@ -155,7 +155,7 @@
default_auto_import=1
;;
*)
- default_auto_import=-1
+ default_auto_import=1
;;
esac
@@ -946,7 +946,8 @@
if (pe_enable_stdcall_fixup == -1)
{
- einfo (_("Warning: resolving %s by linking to %s\n"),
+ if (link_info.pei386_auto_import == -1)
+ info_msg (_("Info: resolving %s by linking to %s (auto-import)\n"),
undef->root.string, cname);
if (! gave_warning_message)
{
@@ -973,7 +974,8 @@
if (pe_enable_stdcall_fixup == -1)
{
- einfo (_("Warning: resolving %s by linking to %s\n"),
+ if (link_info.pei386_auto_import == -1)
+ info_msg (_("Info: resolving %s by linking to %s (auto-import)\n"),
undef->root.string, sym->root.string);
if (! gave_warning_message)
{
...
SHARED ?= 1
...
UNICODE ?= 1
...
BUILD ?= release
...
MONOLITHIC ?= 1
...
OFFICIAL_BUILD ?= 1
...
Success! :DNice!!
The build generate small object files of size 61.5MB in total
and can produce the dll
wxmsw28u_gcc.dll
of size 9.84MB.
This dll is woking, I tested it with demos/life successfully.
cooking up a patch since the problem only seems to affect c++ so check for c++ and if found use old way if not use nathans.Hello, reckless. Please have a look at this post
seems like the way to do it correctly ?
For C DLLs the solution seems simple enough: just don't dllexport inlineI think nathan's code is for C++ dlls especially libstdc++6.dll, before nathan's code there is no OLD way for libstdc++6.dll.
functions and no code for them will be generated. But this doesn't work for
C++ DLLs
Cesar Strauss did suggest another approach in private email: don't useThis idea works very good! Thanks Cesar's idea and Dave Korn's patch for Cygwin.
dllexport at all but rely on MinGW auto-import mechanism.
but it's hardly ideal: all classes and
functions defined in the DLL are then exported, even those that are not
supposed to be used outside of it. This unnecessarily bloats (already
big) export tables and just seems like a step backwards. Indeed, if a
consequence of an improvement to dllexport mechanism is that now it can't
be used at all, what was the point of this improvement in the first case?
Leo's build of gcc, binutils, wxmsw, and cb6233 here. 8)Nice, I will test it!! You're so smart!!!
At Mr.Loaden's googlecode project,(I don't have enough time to manage patch/build/troubleshoot issues, thanks Mr.Loaden.)
http://code.google.com/p/qp-gcc/
located at Wiki and Downloads columns:
http://code.google.com/p/qp-gcc/wiki/GCC45BuildbyLeo
http://code.google.com/p/qp-gcc/wiki/InstallNotesForGCC45BuildByLeo
http://code.google.com/p/qp-gcc/downloads/list
Please help test them.
GCC 4.5.0 related bug reported to wxWidgets has a work around that I did not need on Multi-Lib Build but I did not test the DLLs.I have enabled --enable-auto-import in ld by default.
http://trac.wxwidgets.org/ticket/12064
Tim S.
What version ld.exe are you using?
The one I am using is currently using 1.5GB of memory.
I assume it runs out at 2GB. This is linking wxWidgets 2.8 Branch.
It seems to have leveled off at 1.5GB. I am waiting till it finishes/crashes/errors out before getting the version number.
It ran out of memory.CodeGNU ld (GNU Binutils) 2.20
Tim S.
editbin /LARGEADDRESSAWARE c:\gcc\bin\ld.exe
-Wl,--enable-auto-import,--enable-runtime-pseudo-reloc-v2,--no-keep-memory,--reduce-memory-overheads,--large-address-aware
4.5.1 released.
http://gcc.gnu.org/gcc-4.5/ (http://gcc.gnu.org/gcc-4.5/)
This is the list of problem reports (PRs) from GCC's bug tracking system that are known to be fixed in the 4.5.1 release. This list might not be complete (that is, it is possible that some PRs that have been fixed are not listed here).
All languages
GCC's new link-time optimizer (-flto) now also works on a few non-ELF targets:
Cygwin (*-cygwin*)
MinGW (*-mingw*)
Darwin on x86-64 (x86_64-apple-darwin*)
LTO is not enabled by default for these targets. To enable LTO, you should configure with the --enable-lto option.
All patches utilized will be uploaded to somewhere soon.If these are C::B patches, then yes. Otherwise: No. We don't have endless forums space you know. But you can surely use a filesharing homepage for this...
Dear moderator of this forum, can I upload it here?
Thanks for reminding me.All patches utilized will be uploaded to somewhere soon.If these are C::B patches, then yes. Otherwise: No. We don't have endless forums space you know. But you can surely use a filesharing homepage for this...
Dear moderator of this forum, can I upload it here?
What version of 7z was used on binutils-2.20.51.20100801-bin.7z? I could not unzip it.
From http://a1mingwgcc.googlecode.com/files/binutils-2.20.51.20100801-bin.7z
I was able to unzip gcc451-bin-leo.7z
Trying to download binutils a second time. Error-ed out the second time also.
Tim S.
hmm spoke to soon wxwidgets cant be compiled as a monolithic dll again with 4.5.1 they changed the code so the patch to undo it can not be applied ouch.
looks like they tried to get smart about checking if inline was really needed commendable but its broken with wxwidgets :lol:
The solution posted here (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601#c12) seems to work, which is not using __declspec(dllexport) but rather --enable-auto-import in the linker. Defined WXEXPORT as empty and added --enable-auto-import to LDFLAGS, using MinGW's GCC 4.5.0-1 with MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release, DLL is about 9MB.
mingw32-make -f makefile.gcc CXXFLAGS="-enable-auto-import -O2 -pipe -mthreads -fvisibility=hidden -fvisibility-inlines-hidden" LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--copy-dt-needed-entries -Wl,-enable-auto-import -s" SHARED=1 BUILD=release UNICODE=1 DEBUG_INFO=0 DEBUG_FLAG=0 MONOLITHIC=1 USE_STC=0 USE_PROPGRID=1 USE_EXCEPTIONS=0 USE_RTTI=0 OFFICIAL_BUILD=1 RUNTIME_LIBS=static
--- ld/emultempl/pe.em 2009-09-14 19:43:30 +0800
+++ ld/emultempl/pe.em 2010-01-29 10:49:20 +0800
@@ -155,7 +155,7 @@
default_auto_import=1
;;
*)
- default_auto_import=-1
+ default_auto_import=1
;;
esac
@@ -946,7 +946,8 @@
if (pe_enable_stdcall_fixup == -1)
{
- einfo (_("Warning: resolving %s by linking to %s\n"),
+ if (link_info.pei386_auto_import == -1)
+ info_msg (_("Info: resolving %s by linking to %s (auto-import)\n"),
undef->root.string, cname);
if (! gave_warning_message)
{
@@ -973,7 +974,8 @@
if (pe_enable_stdcall_fixup == -1)
{
- einfo (_("Warning: resolving %s by linking to %s\n"),
+ if (link_info.pei386_auto_import == -1)
+ info_msg (_("Info: resolving %s by linking to %s (auto-import)\n"),
undef->root.string, sym->root.string);
if (! gave_warning_message)
{
Index: gcc/c-family/c.opt
===================================================================
--- gcc/c-family/c.opt (revision 168608)
+++ gcc/c-family/c.opt (working copy)
@@ -814,6 +814,10 @@ ffriend-injection
C++ ObjC++ Var(flag_friend_injection)
Inject friend functions into enclosing namespace
+fkeep-inline-dllexport
+C C++ ObjC ObjC++ Var(flag_keep_inline_dllexport) Init(1) Report Condition(TARGET_DLLIMPORT_DECL_ATTRIBUTES)
+Don't emit dllexported inline functions unless needed
+
flabels-ok
C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
Index: gcc/tree.c
===================================================================
--- gcc/tree.c (revision 168608)
+++ gcc/tree.c (working copy)
@@ -5509,7 +5509,8 @@ handle_dll_attribute (tree * pnode, tree name, tre
DECL_DLLIMPORT_P (node) = 1;
}
else if (TREE_CODE (node) == FUNCTION_DECL
- && DECL_DECLARED_INLINE_P (node))
+ && DECL_DECLARED_INLINE_P (node)
+ && flag_keep_inline_dllexport)
/* An exported function, even if inline, must be emitted. */
DECL_EXTERNAL (node) = 0;
Index: gcc/cp/semantics.c
===================================================================
--- gcc/cp/semantics.c (revision 168608)
+++ gcc/cp/semantics.c (working copy)
@@ -3446,7 +3446,8 @@ expand_or_defer_fn_1 (tree fn)
if ((flag_keep_inline_functions
&& DECL_DECLARED_INLINE_P (fn)
&& !DECL_REALLY_EXTERN (fn))
- || lookup_attribute ("dllexport", DECL_ATTRIBUTES (fn)))
+ || (flag_keep_inline_dllexport
+ && lookup_attribute ("dllexport", DECL_ATTRIBUTES (fn))))
mark_needed (fn);
}
Index: gcc/cp/decl2.c
===================================================================
--- gcc/cp/decl2.c (revision 168608)
+++ gcc/cp/decl2.c (working copy)
@@ -1780,7 +1780,8 @@ decl_needed_p (tree decl)
return true;
/* Functions marked "dllexport" must be emitted so that they are
visible to other DLLs. */
- if (lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
+ if (flag_keep_inline_dllexport
+ && lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
return true;
/* Otherwise, DECL does not need to be emitted -- yet. A subsequent
reference to DECL might cause it to be emitted later. */
C:\Documents and Settings\David>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=d:/program/mingw/bin/../libexec/gcc/mingw32/4.6.0/lto-wrappe
r.exe
Target: mingw32
Configured with: ../source/GCC46/configure --prefix=/mingw --build=mingw32 --hos
t=mingw32 --target=mingw32 --enable-languages=c,c++ --enable-libgomp --enable-li
biconv --disable-werror --enable-threads=win32 --disable-nls --disable-win32-reg
istry --disable-sjlj-exceptions --with-dwarf2 --enable-lto --enable-fully-dynami
c-string --with-system-zlib --with-host-libstdcxx=-lstdc++ --enable-libstdcxx-de
bug --enable-cxx-flags='-fno-function-sections -fno-data-sections' --disable-lib
stdcxx-pch --disable-symvers --enable-version-specific-runtime-libs --enable-boo
tstrap --enable-static --disable-shared --with-pkgversion=pcx32
Thread model: win32
gcc version 4.6.0 20110318 (prerelease) (pcx32)
C:\Documents and Settings\David>ld -v
GNU ld (pcx32) 2.21.51.20110313
mingw32-make -f makefile.gcc CXXFLAGS="-enable-auto-import -O2 -pipe -mthreads -fvisibility=hidden -fvisibility-inlines-hidden -flto" LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--copy-dt-needed-entries -Wl,-enable-auto-import -Wl,-flto -s" SHARED=1 BUILD=release UNICODE=1 DEBUG_INFO=0 DEBUG_FLAG=0 MONOLITHIC=1 USE_STC=0 USE_PROPGRID=1 USE_EXCEPTIONS=0 USE_RTTI=0 OFFICIAL_BUILD=1 RUNTIME_LIBS=static
To wangdong1226:
I have compiled gcc4.6 successfully on Windows (revert Nathan's patch), but the edition can produce a very large wx release dll (mine is 17M), and when I use "-flto -fuse-linker-plugin", the dll will be 7M. So I currently recommend 4.6 only to test, not to be a production.
ps: pcx32 is my copyright. :)
c_mswudll\monodll_richtextstyles.o gcc_mswudll\monodll_richtextxml.o gcc_mswudll
\monodll_richtexthtml.o gcc_mswudll\monodll_richtextformatdlg.o gcc_mswudll\mono
dll_richtextsymboldlg.o gcc_mswudll\monodll_richtextstyledlg.o gcc_mswudll\monod
ll_richtextprint.o gcc_mswudll\monodll_xml.o gcc_mswudll\monodll_xtixml.o -mth
reads -L..\..\lib\gcc_dll -Wl,--out-implib=..\..\lib\gcc_dll\libwxmsw28u.a -Wl,
-flto -Wl,-fwhole-program -Wl,-O1 -Wl,--sort-common -Wl,--copy-dt-needed-entries
-Wl,-enable-auto-import -s -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lw
xexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -
lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32
Creating library file: ..\..\lib\gcc_dll\libwxmsw28u.a
lto-wrapper: invalid LTO mode
collect2: lto-wrapper returned 1 exit status
mingw32-make: *** [..\..\lib\gcc_dll\wxmsw28u_gcc.dll] Error 1
D:\Program\wxWidgets2.8.12\build\msw>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=d:/program/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.5.2/lt
o-wrapper.exe
Target: i686-pc-mingw32
Configured with: ./configure --prefix=/mingw --build=i686-pc-mingw32 --host=i686
-pc-mingw32 --target=i686-pc-mingw32 --enable-languages=c,c++,fortran --enable-l
ibgomp --enable-libiconv --disable-werror --enable-threads=win32 --disable-nls -
-disable-win32-registry --disable-sjlj-exceptions --with-dwarf2 --enable-lto --e
nable-fully-dynamic-string --with-system-zlib --with-host-libstdcxx=-lstdc++ --e
nable-libstdcxx-debug --enable-cxx-flags='-fno-function-sections -fno-data-secti
ons' --disable-libstdcxx-pch --disable-symvers --enable-version-specific-runtime
-libs --disable-bootstrap --with-libelf --enable-static --disable-shared --with-
pkgversion=pcx32
Thread model: win32
gcc version 4.5.2 20101118 (prerelease) (pcx32)
mingw32-make -f makefile.gcc CFLAGS="-flto -fwhole-program" LFLAGS="-Wl,-flto -Wl,-fwhole-program" CXXFLAGS="-flto -fwhole-program -enable-auto-import -O2 -pipe -mthreads" LDFLAGS="-Wl,-flto -Wl,-fwhole-program -Wl,-O1 -Wl,--sort-common -Wl,--copy-dt-needed-entries -Wl,-enable-auto-import -s" SHARED=1 BUILD=release UNICODE=1 DEBUG_INFO=0 DEBUG_FLAG=0 MONOLITHIC=1 USE_STC=0 USE_PROPGRID=1 USE_EXCEPTIONS=0 USE_RTTI=0 OFFICIAL_BUILD=1 RUNTIME_LIBS=static
mingw32-make -f makefile.gcc CXXFLAGS="-enable-auto-import -O2 -pipe -mthreads" LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--copy-dt-needed-entries -Wl,-enable-auto-import -s" SHARED=1 BUILD=release UNICODE=1 DEBUG_INFO=0 DEBUG_FLAG=0 MONOLITHIC=1 USE_STC=0 USE_PROPGRID=1 USE_EXCEPTIONS=0 USE_RTTI=0 OFFICIAL_BUILD=1 RUNTIME_LIBS=staticit will successfully produce wxmsw28u_gcc.dll file, but the size of it only 5.49MB, not 'official' approx. 9MB.
mingw32-make -f makefile.gcc CPPFLAGS="-Os -flto -pipe -mthreads" CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden -Wno-attributes" LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -s -flto" SHARED=1 BUILD=release UNICODE=1 DEBUG_INFO=0 DEBUG_FLAG=0 MONOLITHIC=1 USE_EXCEPTIONS=0 USE_RTTI=0 OFFICIAL_BUILD=1 RUNTIME_LIBS=static