executable very huge ????

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
limbrus
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Dec 09, 2004 3:00 pm
Location: Lima - Peru

executable very huge ????

Post by limbrus »

Hi! I'm new since a couple of days with wxWidgets :). Hope some wxGuru's can help me with this :).

After tried out a little under Linux, it seems to be easier to build GUI with wxWidgets in Windows, so I've go to my Win2000 a little to try it. I've install the wx-devcpp and compile a simple application that contains only one wxFrame, two wxSizer and three wxButton, it's very simple.

I have been very surprised when I saw the size of the executable that result from this simple interface. A huge monster of 3,621 KB (~3.5M) :shock: ! After reading the last thread, I've tried to strip it and optimize the size and I got an executable size of 2,027 KB.

Here is the build command:
g++.exe newProgramFrameApp.o newProgramFrame.o Project2_private.res -o "Project2.exe" -L"G:/Program Files/wxDev-Cpp/lib" -mwindows -lwxmsw25 -lwxmsw25_gl -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lopengl32 -lodbc32 -Os -s

Normaly, with MFC for example or pure WIN32 API this kind of application should take about 50 KB.

I would like to know if this is normal and if it is not, which I hope, where is my mistake and how can I produce a smaller executable ?

Thanks !!
limbrus
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Dec 09, 2004 3:00 pm
Location: Lima - Peru

a little better

Post by limbrus »

Hi, with the better optimization of UPX I got 533 KB.

other option ?
Guest

Post by Guest »

Hi there,

That may not be a pleasant surprise, but yes, it's normal.

There's no way you'll ever get a 50 Kb executable by linking it with a library with the size of wxWidgets statically. If you plan on making several programs with wxWidgets, link dynamically instead. Even so, your example might still be about 100 Kb, in which case, you can try UPX, but I doubt it will help that much there.

The downside of this, however, is having to supply your users with the DLL... but hey, most MFC-based program installations also do this.

In any case, g++ is know for making slightly larger executables than most compilers, so don't expect it to compete with cl in that aspect.


Good luck in your future experiments with wxWidgets
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Hi!
The downside of this, however, is having to supply your users with the DLL... but hey, most MFC-based program installations also do this.
True, but MS has the advantage that they can ship the DLLs with their OS :D
The size of the executables is one of the biggest disadvantages of wxWidgets... But that is quite a common problem: With Qt you'll have to ship separate DLLs, with Java you'll even have to install a whole runtime environment (like .NET). What you get is a cool cross-platform, easy portable lib.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
maurg1975
Earned a small fee
Earned a small fee
Posts: 24
Joined: Tue Dec 14, 2004 11:17 am

Post by maurg1975 »

You can always try to disable some features using "configure".
For example, you can try to exclude tiff and pcx support
from compilation...
You can try to exclude some classes like wxFTP,wxHTTP etc...

Isn't this right?

Maurizio
arkanes
Experienced Solver
Experienced Solver
Posts: 59
Joined: Sun Oct 17, 2004 12:05 am

Post by arkanes »

GCC makes HUGE executables on Windows. If you can, try some other compilers. The main one I use is VC++ 7.1 and the "minimal" sample is around 400k in release build. I can get it smaller than that with some other optimization tricks and then down a lot more with UPX.
eros
I live to help wx-kind
I live to help wx-kind
Posts: 162
Joined: Mon Sep 06, 2004 1:40 am
Location: Argentina

Post by eros »

Yep using mingw is not good for final builds, if you want to develop using devcpp or wxdevcpp thats fine but at the time to release compile it with microsoft vc++.

what to say, for ms windows there's no better compiler....
...
limbrus
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Dec 09, 2004 3:00 pm
Location: Lima - Peru

thanks

Post by limbrus »

OK guys !

Thanks for all your reply, I see better how the things works now in wxWidgets. I think I will do it with dynamic sharing and in M$ I will compile with their compiler VC++ and I'll use UPX.

Limbrus
brandysboguslaw
Earned a small fee
Earned a small fee
Posts: 23
Joined: Wed Oct 20, 2004 5:07 pm

Post by brandysboguslaw »

Strong advice.
Do not use UPX - you will have a lot memory used , becouse UPX-ed applications cannot share codein memory and twice memory is needed to decompres it before run.Just use good installer to down size of installation (like Inno Setup 4.2.x with lzma support or NSIS) :!:
User avatar
myukew
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Jan 13, 2005 6:33 pm

Post by myukew »

wait... before I found wxDevCpp I build a program with the "normal" dev-cpp (just a simple one) and it was -after stripping- ~900kb! how comes that a progam with similar functionality compiled with wxDevCpp is 3.5mb?
Linkku
Knows some wx things
Knows some wx things
Posts: 33
Joined: Sun Jan 02, 2005 5:16 pm

Post by Linkku »

I get normally with wxDev-Cpp 2.04MB files (when comiling something small) and with UPX i get ~500kb files.
--- http://linkku.has.it ---

- Debian Etch, KDevelop3, Anjuta2, wxWidgets CVS, GCC 3.3
- Windows XP, wxDevCpp, wxWidgets 2.6.1
zambizzi
Earned some good credits
Earned some good credits
Posts: 115
Joined: Mon Jan 03, 2005 9:16 pm
Location: Boise Idaho
Contact:

sticky

Post by zambizzi »

The moderator should create a sticky post specifically for this, I see this question in here at least every-other day.
brandysboguslaw
Earned a small fee
Earned a small fee
Posts: 23
Joined: Wed Oct 20, 2004 5:07 pm

Post by brandysboguslaw »

Check if You must include all those libraries like odbc, wsock32.
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Hi!
wait... before I found wxDevCpp I build a program with the "normal" dev-cpp (just a simple one) and it was -after stripping- ~900kb! how comes that a progam with similar functionality compiled with wxDevCpp is 3.5mb?
1. You left debugging on.
2. You didn't strip the executable.

What version of Dev-C++ did you use? I suppose it was an older version that used gcc 2.9.5. This gcc version produced smaller app than the new gcc 3.3.1.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
User avatar
myukew
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Jan 13, 2005 6:33 pm

Post by myukew »

I used dev-cpp 4.9.9.1 beta and linked with -s option.
now i use wx-dev-cpp 4.9.9.0 and link with -s option. generate debugging info is "no"...
Post Reply