This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Re: strip makes libs unusable
On Thu, Sep 23, 1999 at 11:54:31AM -0600, Dale Harris wrote:
> On Thu, Sep 23, 1999 at 10:38:09AM -0400, David Ronis elucidated:
> >
> > I ran strip/ranlib on all the .a libs (actually by mistake) and that
> > made some programs (but not all) unlinkable,
> > specifically, ones with calls to stat or lstat. I reinstalled
> > libc_nonshared.a and the problem went away.
>
> Well, at least you didn't do it on purpose. Why didn't you just stick to
> make install?
When the libraries have been compiled with -g, stripping them can
save a LOT of disk space. Also, I don't like libc.so to have
debugging information, because I trust that it functions well, and
I rather concentrate on finding the bug in my program. With debugging
information, a printf jumps into the library when single stepping.
>
> >
> > 1. Why?
>
> I'm assuming it is because they have symbols. Do an nm on one of those
> libraries, in the case of shared libraries, ld-linux.so needs to see them;
> for archive libraries the linker needs those symbols to be able to reference
> the bit of code for which you are looking. Lucky you didn't to it on the
> shared libraries, otherwise you have a nonfunctioning system.
It's perfectly ok to strip shared libraries.
(Although I believe that old versions of strip did damage shared libs.)
>
> > 2. Do all the other .a libs have to be reinstalled.
>
> Any you stripped, sure.
I usually strip my .a libs too without getting into trouble.
I think that in general this doesn't do any harm, but maybe I just
don't experience problems because I never link statically.
I should probably just delete those .a libs.
>
> > 3. I thought strip was supposed to be safe on .a or .so libs--I guess
> > it isn't.
>
> Guess not.
In most cases it is.
I know that stripping the .o files in /usr/lib/gcc-lib/ is not a good idea.
I wouldn't be surprised if in the case of .a libs, libc_nonshared.a
is an exception. I just checked, and my libc_nonshared.a does not
seem to be stripped. Most other libs are.
>
> >
> > THIS SHOULD BE ADDED TO THE FAQ/INSTALL INSTRUCTIONS.
> >
>
> Well, maybe and maybe not, if you had FAQ for hammers, would you need a
> warning not to hit yourself in the head with it? Course when you got
> people suing for hot coffee they spilled on themselves, maybe they should
> add it.
If libc_nonshared.a is an exception to the general rule, it wouldn't
hurt to add it to the FAQ.
Ronald