LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Creating smallest GTK slax mo from source (https://www.linuxquestions.org/questions/programming-9/creating-smallest-gtk-slax-mo-from-source-500076/)

Gzou 11-09-2006 09:55 AM

Creating smallest GTK slax mo from source
 
Hello every Linux users ! I'm gzou

As the subject says, I have a few questions about how to create the smallest possible module of GTK (meaning GTK1 and GTK2 together) for the Live distribution SLAX. The module would be used to run programs such as gnumeric, gimp, abiword, firefox, etc. My questions are realted to slax, of course, bue also about what happens to file sizes when you compile for different architcturs

Here's my situation: I want to be able to run slax with custom-made modules on a 220 MB CD and putting as much as i can on it. I've already worked on the core and X modules, took off all the stuff I didn't want and made sure they still worked. I've also compiled almost all the software I want on the CD from source. (using checkinstall in combination with tgz2mo) Now i'm on to the reducing part, where I take out all the stuff I don't need.

I've tried just putting all my modules onto the CD and they all worked fine, the only problem was that I needed a 700 MB CD (thus the reducing part)

One of my freinds, who had similar ideas, gave me his GTK module as an example of what he did to reduce it. When I looked at it all there was were the /etc (containing GTK's config files) and /usr/lib directories. The total size of the 2 directories was 5.8 MB. When I tired to imitate him by taking out all except /etc and /usr/lib in my modules of GTK and GTK2, the total was 17 MB, and I recheked to make sure that there weren't any additional files that were in my GTK but not in his, and it still was 17 MB. So I started asking myself why the big difference in size ?

First thing that was apparent was the version numbers. his module contained GTK2.4.1, mine was 2.10.x (can't remember the last digit) but even if mine was drastically much more newer than his, it didn't quite seem to explain the difference in size

The other thing was how we created the modules. I compiled mine from source while he just took a bunch of tgz's and deb's and put them together. But then again, didn't satisfy me.

Third thing was how I compiled them. I compiled all my modules for the i386 artitechture (main reason was compatibility, and also to make sure that It would run on another really old computer that I've got in my room).

When I realised that I went and compared individual file sizes in both modules, and in most cases, My files were bigger than his. I also saw that the largest ones were the ELF executables. Then It clicked: maybe, since I compiled all the modules for i386, it somehow made the ELF files bigger. But I wasn't sure at all, this was just a hypothesis.

That's why I'm here, I've got a few main questions relating to all of this

1. Are their certain directories/files (like the documentation and var) that can be easily taken out to reduce size ? and, generally, which ones ?

2.Is the newer version of GTK that I compiled the reason for the bigger file size ?

3. Does compiling for i386 change the size of idividual files ?


I'm still a relatively new guy in linux, so that's why I came here to see if anyone around had any suggestions or answers to my questions.

I'd really appreciate the insight you can provide on this and thank you in advance !

Gzou.

P.S. : here's the list of the files in the lib directory and their size:

My freind's version (the smaller one):

116K gtk-2.0/2.4.0/engines
176K gtk-2.0/2.4.0/immodules
272K gtk-2.0/2.4.0/loaders
564K gtk-2.0/2.4.0
4.0K gtk-2.0/include
568K gtk-2.0
0 libgdk-1.2.so.0
200K libgdk-1.2.so.0.9.1
4.0K libgdk-x11-2.0.la
0 libgdk-x11-2.0.so
0 libgdk-x11-2.0.so.0
516K libgdk-x11-2.0.so.0.800.19
4.0K libgdk.la
0 libgdk.so
4.0K libgdk_imlib.la
0 libgdk_imlib.so
0 libgdk_imlib.so.1
140K libgdk_imlib.so.1.9.15
4.0K libgdk_pixbuf-2.0.la
0 libgdk_pixbuf-2.0.so
0 libgdk_pixbuf-2.0.so.0
84K libgdk_pixbuf-2.0.so.0.800.19
4.0K libgdk_pixbuf_xlib-2.0.la
0 libgdk_pixbuf_xlib-2.0.so
0 libgdk_pixbuf_xlib-2.0.so.0
56K libgdk_pixbuf_xlib-2.0.so.0.800.19
0 libgtk-1.2.so.0
1.2M libgtk-1.2.so.0.9.1
4.0K libgtk-x11-2.0.la
0 libgtk-x11-2.0.so
0 libgtk-x11-2.0.so.0
3.0M libgtk-x11-2.0.so.0.800.19
4.0K libgtk.la
0 libgtk.so
5.7M total

and my module, compiled from source for i386:
96K gtk-2.0/2.10.0/engines
344K gtk-2.0/2.10.0/immodules
524K gtk-2.0/2.10.0/loaders
964K gtk-2.0/2.10.0
4.0K gtk-2.0/include
968K gtk-2.0
0 libgdk-1.2.so.0
520K libgdk-1.2.so.0.9.1
4.0K libgdk-x11-2.0.la
0 libgdk-x11-2.0.so
0 libgdk-x11-2.0.so.0
1.5M libgdk-x11-2.0.so.0.1000.6
4.0K libgdk.la
0 libgdk.so
4.0K libgdk_pixbuf-2.0.la
0 libgdk_pixbuf-2.0.so
0 libgdk_pixbuf-2.0.so.0
216K libgdk_pixbuf-2.0.so.0.1000.6
4.0K libgdk_pixbuf_xlib-2.0.la
0 libgdk_pixbuf_xlib-2.0.so
0 libgdk_pixbuf_xlib-2.0.so.0
120K libgdk_pixbuf_xlib-2.0.so.0.1000.6
0 libgtk-1.2.so.0
3.4M libgtk-1.2.so.0.9.1
4.0K libgtk-x11-2.0.la
0 libgtk-x11-2.0.so
0 libgtk-x11-2.0.so.0
9.4M libgtk-x11-2.0.so.0.1000.6
4.0K libgtk.la
0 libgtk.so
16M total

hope this helps !

verdeboy2k 11-09-2006 10:05 AM

just a thought? did you compile them with the -g (debug) flag? You could also optimize for size (-Os). Also did you remember to strip the binaries?

Gzou 11-09-2006 11:16 AM

ummm, well, to be honest, I don't know what those options do ^^*

so, I should try doing

make -g -Os

right ? or are those options for the configure script ?

also, I don't know what stripping is, but I suppose that it reduces the size of the files, right ?

I'm sorry If I sound a bit dumb when asking these questions, I don't know that much about compiling

95se 11-09-2006 12:08 PM

Using 2.10 will make a very large difference. Google for Project Ridley and you'll see why. 2.10 was the first release which incorporated Project Ridley. Basically, Project Ridley is an attempt to consolidate a bunch of, previously external, libraries which should probably be in GTK+ into GTK+. So you not only got the added features/enhancements of GTK+, but a whole whack load of other libraries' code added to it. Definitely remove debugging symbols, optimize for size (-Os as above), and make use of strip to strip all the unnecessary symbols.


All times are GMT -5. The time now is 08:38 PM.