There appears to be a somewhat bogus statement in section 6.63
"Stripping Again". It says there:
"If disk space is very tight, the --strip-all option can be used on
the binaries in /{,usr/}{bin,sbin} to gain several more megabytes. Do
not use this option on libraries—they will be destroyed."
The statement that libs will be destroyed by --strip-all may be
correct for chapter 5 libs due to the adjustments we've made (and will
yet make) in chapter 6, the nature of the varying environments.
However, by the end of chapter 6 I don't believe that statement is
true any more.

Check this out: On my system I don't have linkable ncurses libraries
or headers (the devel packages aren't installed). So I'll install them
to /usr/local/ncurses, like so:

./configure --prefix=/usr/local/ncurses --with-shared --without-debug
--enable-wide
make
sudo make install

Then I'll look at the sizes of my files:
$ ls /usr/local/ncurses/lib/ -l
total 1804
-rw-r--r-- 1 root root 136452 Oct 25 18:34 libformw.a
lrwxrwxrwx 1 root root     13 Oct 25 18:34 libformw.so -> libformw.so.5
lrwxrwxrwx 1 root root     15 Oct 25 18:34 libformw.so.5 -> libformw.so.5.9
-rwxr-xr-x 1 root root  81623 Oct 25 18:34 libformw.so.5.9
-rw-r--r-- 1 root root  70454 Oct 25 18:34 libmenuw.a
lrwxrwxrwx 1 root root     13 Oct 25 18:34 libmenuw.so -> libmenuw.so.5
lrwxrwxrwx 1 root root     15 Oct 25 18:34 libmenuw.so.5 -> libmenuw.so.5.9
-rwxr-xr-x 1 root root  39200 Oct 25 18:34 libmenuw.so.5.9
-rw-r--r-- 1 root root 175870 Oct 25 18:34 libncurses++w.a
-rw-r--r-- 1 root root 743056 Oct 25 18:34 libncursesw.a
lrwxrwxrwx 1 root root     16 Oct 25 18:34 libncursesw.so -> libncursesw.so.5
lrwxrwxrwx 1 root root     18 Oct 25 18:34 libncursesw.so.5 ->
libncursesw.so.5.9
-rwxr-xr-x 1 root root 416908 Oct 25 18:34 libncursesw.so.5.9
-rw-r--r-- 1 root root  28708 Oct 25 18:34 libpanelw.a
lrwxrwxrwx 1 root root     14 Oct 25 18:34 libpanelw.so -> libpanelw.so.5
lrwxrwxrwx 1 root root     16 Oct 25 18:34 libpanelw.so.5 -> libpanelw.so.5.9
-rwxr-xr-x 1 root root  14468 Oct 25 18:34 libpanelw.so.5.9
lrwxrwxrwx 1 root root     17 Oct 25 18:34 terminfo -> ../share/terminfo

I'll compile this file:

#include <ncursesw/ncurses.h>

int main()
{
        initscr();                      /* Start curses mode              */
        printw("Hello World !!!");      /* Print Hello World              */
        refresh();                      /* Print it on to the real screen */
        getch();                        /* Wait for user input */
        endwin();                       /* End curses mode                */

        return 0;
}

like so:

gcc hello.c -I/usr/local/ncurses/include -L/usr/local/ncurses/lib/ -o
hello -lncursesw

no problem.

And the program runs OK:

LD_LIBRARY_PATH=/usr/local/ncurses/lib ./hello

Next I'll strip:

sudo strip --strip-all /usr/local/ncurses/lib/*

And look at the size of the files now:

$ ls /usr/local/ncurses/lib/ -l
total 1728
-rw-r--r-- 1 root root  81992 Oct 25 18:39 libformw.a
lrwxrwxrwx 1 root root     13 Oct 25 18:34 libformw.so -> libformw.so.5
lrwxrwxrwx 1 root root     15 Oct 25 18:34 libformw.so.5 -> libformw.so.5.9
-rwxr-xr-x 1 root root  67272 Oct 25 18:39 libformw.so.5.9
-rw-r--r-- 1 root root  41552 Oct 25 18:39 libmenuw.a
lrwxrwxrwx 1 root root     13 Oct 25 18:34 libmenuw.so -> libmenuw.so.5
lrwxrwxrwx 1 root root     15 Oct 25 18:34 libmenuw.so.5 -> libmenuw.so.5.9
-rwxr-xr-x 1 root root  32048 Oct 25 18:39 libmenuw.so.5.9
-rw-r--r-- 1 root root  72344 Oct 25 18:39 libncurses++w.a
-rw-r--r-- 1 root root 428806 Oct 25 18:39 libncursesw.a
lrwxrwxrwx 1 root root     16 Oct 25 18:34 libncursesw.so -> libncursesw.so.5
lrwxrwxrwx 1 root root     18 Oct 25 18:34 libncursesw.so.5 ->
libncursesw.so.5.9
-rwxr-xr-x 1 root root 376016 Oct 25 18:39 libncursesw.so.5.9
-rw-r--r-- 1 root root  19172 Oct 25 18:39 libpanelw.a
lrwxrwxrwx 1 root root     14 Oct 25 18:34 libpanelw.so -> libpanelw.so.5
lrwxrwxrwx 1 root root     16 Oct 25 18:34 libpanelw.so.5 -> libpanelw.so.5.9
-rwxr-xr-x 1 root root  11400 Oct 25 18:39 libpanelw.so.5.9
lrwxrwxrwx 1 root root     17 Oct 25 18:34 terminfo -> ../share/terminfo

They're obviously fine - now to make sure I can still link against them:

gcc hello.c -I/usr/local/ncurses/include -L/usr/local/ncurses/lib/ -o
hello -lncursesw

No problem - and again ensure that runtime is fine:

LD_LIBRARY_PATH=/usr/local/ncurses/lib ./hello

I don't see what has been 'destroyed' about these stripped libs.

JH
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to