Reducing the size of the wxWidgets app. executable

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
akkumar
Earned a small fee
Earned a small fee
Posts: 15
Joined: Sat Sep 11, 2004 8:35 pm
Location: CA

Reducing the size of the wxWidgets app. executable

Post by akkumar » Fri Sep 17, 2004 11:07 pm

Hi,
Right now, the application size of my trivial wxWidgets app ( just a frame , containing a canvas and making it visible ) is about 5MB . I was wondering if there is any way we can reduce this app. size.

The linking options that I am having are -

-mwindows
-lwxmsw25d
-lwxregexd
-lwxpngd
-lwxjpegd
-lwxzlibd
-lwxtiffd
-lwxmsw25d_gl
-lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lodbc32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid

Is there any way to reduce the application size , ( in terms of adding / removing some libraries ?? ) or some other options.
Karthik.

cg
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 201
Joined: Sun Aug 29, 2004 12:33 am
Location: Canada
Contact:

Post by cg » Fri Sep 17, 2004 11:26 pm

There has been lots of talk about this on the mail list. YOu can search thru google:

http://groups.google.com/groups?hl=en&l ... .wxwindows

If you *really* need a compact exe you can use something like UPX:

http://upx.sourceforge.net/

Or you can use borland, visual c++ or digital mars they all have free compilers that products smaller exes. But not that much smaller.

CG

User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Re: Reducing the size of the wxWidgets app. executable

Post by ABX » Fri Sep 17, 2004 11:33 pm

akkumar wrote:Hi,
Right now, the application size of my trivial wxWidgets app ( just a frame , containing a canvas and making it visible ) is about 5MB . I was wondering if there is any way we can reduce this app. size.

The linking options that I am having are -

-mwindows
-lwxmsw25d
-lwxregexd
-lwxpngd
-lwxjpegd
-lwxzlibd
-lwxtiffd
-lwxmsw25d_gl
-lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lodbc32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid

Is there any way to reduce the application size , ( in terms of adding / removing some libraries ?? ) or some other options.
For release there is no reason to use debug version of library. Also do you really use all the formats of the images ? You can also disable some of the feature. For comparison I once tried to cut size of exacutables experimenting with Borland on minimal wxW sample. I started from more than 3MB. After disabling everything possible (in setup.h) I finished with about 500KB. So definietly there is a lot to play with.

geon
I live to help wx-kind
I live to help wx-kind
Posts: 189
Joined: Tue Sep 07, 2004 4:10 pm
Location: Sweden, Uppsala

Post by geon » Sat Sep 18, 2004 8:35 pm

You can run strip on the executable. It will remove a lot of "wasted space" in the file. And UPX works fine too. A file of >1 MB can be squezed down to less than 300 kB.

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 » Sat Sep 18, 2004 9:36 pm

You can also link to shared libs instead of static linking. Maybe not to wx itself but if you use external libs that could help too.
...

prophet
Knows some wx things
Knows some wx things
Posts: 32
Joined: Wed Sep 01, 2004 6:19 am

Post by prophet » Tue Sep 21, 2004 11:57 am

Don't use iostream, use wxLogError, wxLogVerbose for logging. That way you can avoid linking in the iostream library.

Post Reply