Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3946A07E.98F13651@phekda.freeserve.co.uk> Date: Tue, 13 Jun 2000 21:58:38 +0100 From: Richard Dawe X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: Using strip --strip-debug on libraries References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Hello. Eli Zaretskii wrote: > > On Sun, 11 Jun 2000, Richard Dawe wrote: > > > The other day I ran strip with the '--strip-debug' option on a > > library. The library I ran it had several files named 'init.o' within. > > I found that after stripping, there was only one file called 'init.o'. [snip] > That `strip' rewrites the TOC seems reasonable: it rewrites the entire > archive, after all. Sure, it seems reasonable, but it wasn't what I expected it to do. > What you need to make sure that it leaves the last copy of init.o in the > archive and removes the rest. I'm not sure which init.o it left, but there was only one (down from three, I think). > A more importtant question is: how did that library wind up with more > than a single copy of init.o in it? BTW this is from building gmp - there are subdirectories called mp?, e.g. mpz, and some of these have a file called init.c, with functions like (IIRC) __mpz_init(). So, when you build the library, you end up with three files called init.o (from three directories), since the path information appears to be discarded. So, when the library is stripped of debug info, only one init.o survives, leading to unresolved symbols when you link against it. Solution: find . -name '*.o' -exec strip --strip-debug '{}' ';' find . -name '*.o' -exec touch '{}' ';' then remake library. Bye, -- Richard Dawe [ mailto:richdawe AT bigfoot DOT com | http://www.bigfoot.com/~richdawe/ ]