This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Troubles linking with ld
- From: Ian Lance Taylor <ian at airs dot com>
- To: <securehell at hushmail dot com>
- Cc: <drow at false dot org>, <binutils at sourceware dot org>
- Date: 07 Feb 2006 23:27:44 -0800
- Subject: Re: Troubles linking with ld
- References: <200602080153.k181r26m030240@mailserver2.hushmail.com>
<securehell@hushmail.com> writes:
> My next challenge: I actually build 4 different .so libraries. The
> first so far has compiled/linked.
>
> The next library is built the same as my previous library with one
> exception: When I link the objects I am getting the following error:
>
> gcc -shared -Wl,--whole-archive -fPIC -o libnew2.so file6.o
> libfiles12.a libfiles56.a libnew.so -Wl,--no-whole-archive
>
> libfiles12.a: member libfiles12.a(libfiles78.a) in archive is not
> an object
>
> So one of the archives is created which includes another archive(s)
> but the linking step doesn't like it. By the way, I have verified
> that the libfiles78.a is correct with "ar x libfiles12.a
> libfiles78.a" and everything looked fine.
Yes, it looks like you put an archive file inside another archive
file. The linker doesn't understand that. Archive files that you
pass to the linker should only contain object files.
You can put the entire contents of one archive into another by doing
something like:
mkdir tmp
cd tmp
ar x ../INNERARCHIVE
ar rcv ../OUTERARCHIVE *.o
Ian