Yes, ptDev : even if nothing done towards wx-dev mailing list (I've subscribed to user side, but not dev one yet), I've already opened a thread about this in the wxWidgets forum. It's here :
http://forums.wxwidgets.org/viewtopic.php?f=1&t=35103&p=143804Thanks for these added info, xunxun ; until now, I've pushed a little bit further (see my results below), but wouldn't fall in a too specific optimization ; knowing same wx libs should work for several projects, and it's difficult to remember to not use this or that... Well, here are my results until now (and a problem too) :
--
So, as said above, I've tried to reduce the exe size a little bit more like this :
- Rebuild wxWidgets 2.9.3 w/ "WXWIN_COMPATIBILITY_2_8 0" & "wxDEBUG_LEVEL 0" in setup.h => my mini_wx29_project's exe becomes 5.65 MB
- Post-build w/ "strip --strip-all XXX.exe" (read it's sometime better than GCC -Os) : negligible, but I keep-it (- 0.01 MB)
- Rebuild wxWidgets 2.9.3 adding theses make options : CFLAGS='-Os -fdata-sections -ffunction-sections' CXXFLAGS='-Os -fdata-sections -ffunction-sections -fno-keep-inline-dllexport' LDFLAGS='-Wl,--gc-sections' => mini_wx29_project is now 3.64 MB, but w/ a lot of warnings about sections.
Thus, now my initial minimalist project of 7.07 MB is 3.64 MB, but linker returns a lot of warnings (about 300 lines like the ones below) :
Linking executable: bin\Release\wx29_cb-mini.exe
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\devlibs\wxWidgets\lib\gcc_lib/libwxmsw29u.a(monolib_gdicmn.o): warning: duplicate section `.rdata$_ZTV20wxThreadHelperThread[vtable for wxThreadHelperThread]' has different size
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\devlibs\wxWidgets\lib\gcc_lib/libwxmsw29u.a(monolib_window.o): warning: duplicate section `.rdata$_ZTV20wxThreadHelperThread[vtable for wxThreadHelperThread]' has different size
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\devlibs\wxWidgets\lib\gcc_lib/libwxmsw29u.a(monolib_window.o): warning: duplicate section `.rdata$_ZTV13wxTransform2D[vtable for wxTransform2D]' has different size
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\devlibs\wxWidgets\lib\gcc_lib/libwxmsw29u.a(monolib_mdi.o): warning: duplicate section `.rdata$_ZTV20wxThreadHelperThread[vtable for wxThreadHelperThread]' has different size
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\devlibs\wxWidgets\lib\gcc_lib/libwxmsw29u.a(monolib_mdi.o): warning: duplicate section `.rdata$_ZTV21wxMDIClientWindowBase[vtable for wxMDIClientWindowBase]' has different size
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\devlibs\wxWidgets\lib\gcc_lib/libwxmsw29u.a(monolib_mdi.o): warning: duplicate section `.rdata$_ZTS19wxNavigationEnabledI16wxNonOwnedWindowE[typeinfo name for wxNavigationEnabled<wxNonOwnedWindow>]' has different size
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\devlibs\wxWidgets\lib\gcc_lib/libwxmsw29u.a(monolib_appbase.o): warning: duplicate section `.rdata$_ZTV20wxThreadHelperThread[vtable for wxThreadHelperThread]' has different size
[...]
Output size is 3.64 MB
Running target post-build steps
strip --strip-all wx29_cb-mini.exe
Process terminated with status 0 (0 minutes, 28 seconds)
0 errors, 305 warnings (0 minutes, 28 seconds)
Do you have an idea to avoid these hundreds of warnings ?
I've asked in the wxWidgets forum too (see URL I indicate at top of this post).
Next step could be to use no-monolithic linking, but, before, I would like to remove theses warnings
--
EDIT : I try to advance. Now, I've got only 6 warnings (rather than hunderds) but two errors too (so, it doesn't build)
Here are the options I've indicated :
For compiler :
-ffunction-sections
-fdata-sections
-Wl,-allow-multiple-definition
-flto
For linker :
-flto
-Os
-Wl,--gc-sections
-Wl,-allow-multiple-definition
And I get this :
Compiling: resource.rc
Compiling: wx29_cb_miniMain.cpp
Linking executable: bin\Release\wx29_cb-mini.exe
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\DOCUME~1\eln\LOCALS~1\Temp\cctYhhpd.ltrans0.ltrans.o: warning: duplicate section `.rdata$_ZTS19wxNavigationEnabledI16wxNonOwnedWindowE[typeinfo name for wxNavigationEnabled<wxNonOwnedWindow>]' has different size
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\DOCUME~1\eln\LOCALS~1\Temp\cctYhhpd.ltrans0.ltrans.o: warning: duplicate section `.rdata$_ZTV13wxTransform2D[vtable for wxTransform2D]' has different size
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\DOCUME~1\eln\LOCALS~1\Temp\cctYhhpd.ltrans0.ltrans.o: warning: duplicate section `.rdata$_ZTV20wxThreadHelperThread[vtable for wxThreadHelperThread]' has different size
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\DOCUME~1\eln\LOCALS~1\Temp\cctYhhpd.ltrans1.ltrans.o: warning: duplicate section `.rdata$_ZTS19wxNavigationEnabledI16wxNonOwnedWindowE[typeinfo name for wxNavigationEnabled<wxNonOwnedWindow>]' has different size
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\DOCUME~1\eln\LOCALS~1\Temp\cctYhhpd.ltrans1.ltrans.o: warning: duplicate section `.rdata$_ZTS19wxNavigationEnabledI8wxWindowE[typeinfo name for wxNavigationEnabled<wxWindow>]' has different size
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: C:\DOCUME~1\eln\LOCALS~1\Temp\cctYhhpd.ltrans1.ltrans.o: warning: duplicate section `.rdata$_ZTS17wxWindowWithItemsI9wxControl15wxItemContainerE[typeinfo name for wxWindowWithItems<wxControl, wxItemContainer>]' has different size
C:\DOCUME~1\eln\LOCALS~1\Temp\cctYhhpd.ltrans0.ltrans.o:cctYhhpd.ltrans0.o:(.text+0xd22): undefined reference to `wxTheAssertHandler'
C:\DOCUME~1\eln\LOCALS~1\Temp\cctYhhpd.ltrans0.ltrans.o:cctYhhpd.ltrans0.o:(.text+0xd51): undefined reference to `wxOnAssert(char const*, int, char const*, char const*, wchar_t const*)'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 39 seconds)
2 errors, 6 warnings (0 minutes, 39 seconds)
Knowing I've maybe made obvious mistake with theses options : I'm new in GCC as in C::B and wxWidgets
Do you have an idea, an advice ?