This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Troubles linking with ld


<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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]