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.
Dear xunxun1982, thanks for your kindly suggestion. I'll go back to gcc 4.5.2
I used your released gcc 4.5.2 (
http://forums.codeblocks.org/index.php/topic,13761.msg96721/topicseen.html#msg96721)to build wxWidgets 2.8.12, but I got error either:
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)
my build file:
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
BTW, when I using your released gcc 4.5.2, in "D:\Program\wxWidgets2.8.12\build\msw", it produce "gcc_mswudll" folder same as other versions gcc did, but the size of it is only 187MB. When I use official MinGW GCC 4.5.2, it will produce "gcc_mswudll" folder about 460~480MB; the gcc 4.6.0 which I produced acc. to your guide "Build mingw gcc 4.5.x 32bit from snapshots" from your blog, it will produce "gcc_mswudll" folder about 460~480MB also.
I want to know what's the difference between your released gcc 4.5.2 and official MinGW GCC 4.5.2
When I remove the
lto options in my build file:
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=static
it will successfully produce wxmsw28u_gcc.dll file, but the size of it only 5.49MB, not 'official' approx. 9MB.