Executable size doubled from 2.8.12 to 2.9.2

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Tapsa
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Executable size doubled from 2.8.12 to 2.9.2

Post by Tapsa » Tue Dec 06, 2011 6:02 pm

Upon upgrading to the new 2.9.2 version, massive amounts of problems hit my face.
The most important thing is the file size.
What causes the file size to get doubled compared to 2.8.12 version?
I compiled wxWidgets with these settings:
mingw32-make -f makefile.gcc MONOLITHIC=0 SHARED=0 UNICODE=1 BUILD=release

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: Executable size doubled from 2.8.12 to 2.9.2

Post by Auria » Tue Dec 06, 2011 6:21 pm

There are many reasons :
1) assertions are left in by default. You could try to make a build with all debug info removed (I don't remember what is the flag for mingw though)
2) there are just more controls. If you make a monolithic build, especially, (or if you just added all wx libs you can find) you may get new controls included even if you don't use them

More generally, see http://wiki.wxwidgets.org/Reducing_Executable_Size
"Keyboard not detected. Press F1 to continue"
-- Windows

Tapsa
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Re: Executable size doubled from 2.8.12 to 2.9.2

Post by Tapsa » Tue Dec 06, 2011 8:11 pm

I believe the file size increase is due to wxWidgets core libraries doubled file size.
I always strip and upx my executable when releasing.

All the included files I have in all of my source files:
#include "wx/busyinfo.h"
#include "wx/filename.h"
#include "wx/wx.h"
#include "wx/hyperlink.h"
#include "wx/odcombo.h"
#include "wx/wx.h"
#include "wx/fileconf.h"
#include "wx/notebook.h"
#include "wx/aboutdlg.h"
#include "wx/hyperlink.h"
#include "wx/tooltip.h"
#include "wx/wx.h"
#include "wx/filepicker.h"
#include "wx/wx.h"
#include "wx/filepicker.h"
#include "wx/wx.h"
#include "wx/wx.h"
#include "wx/wx.h"
#include "wx/msw/wx.rc"

I switched back to 2.8.12 because I started to get undefined references to wxOnAsserts? and wxStrings.
I did not change any include files or add extra functionality.
The only thing I need from 2.9.2 now is wxToolTip::SetAutoPop(30000).
Can I copy its sources somehow to 2.8.12 and use it?

The other major problems I got the time I succesfully compiled using 2.9.2 are:
•wxScrolledWindows did not show anything in them (any window part with a scroll bar was blank).
•Most of my layout got screwed up (the absolute partitioning values don't apply anymore).
•Text control's borders disappeared sometimes.
•Some text controls and check boxes disappeared completely.

What would be the actual compiling line for "if possible, compile all libraries that you're going to statically link in your program with the -ffunction-sections -fdata-sections -Os options and remember to link with the -Wl,--gc-sections option; this gives a 30-50% improvement" ?
It takes maybe half an hour to compile wxWidgets on my computer.
Will this do it?
mingw32-make -f -ffunction-sections -fdata-sections -Os makefile.gcc -Wl --gc-sections MONOLITHIC=0 SHARED=0 UNICODE=1 BUILD=release clean

Post Reply