public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* How can I link several static libraries into single shared library?
@ 2010-05-11  7:09 michael kapelko
  2010-05-11  7:27 ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: michael kapelko @ 2010-05-11  7:09 UTC (permalink / raw)
  To: binutils

Hi.
I want to link several static libraries into single shared library.
So far I'm trying to link ALURE(http://kcat.strangesoft.net/alure.html) 
static library into my shared library:

g++ -shared -o libmj.so  /usr/local/lib/libalure.a

But that leaves my libmj.so of 6K size, while libalure.a is of 1.5M. 
Looks like linker discards all unused symbols from libalure.
How do I force it to put *ALL* symbols from libalure.a into my libmj.so?
Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How can I link several static libraries into single shared library?
  2010-05-11  7:09 How can I link several static libraries into single shared library? michael kapelko
@ 2010-05-11  7:27 ` Alan Modra
  2010-05-11  7:55   ` michael kapelko
  2010-05-11 13:01   ` michael kapelko
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Modra @ 2010-05-11  7:27 UTC (permalink / raw)
  To: michael kapelko; +Cc: binutils

On Tue, May 11, 2010 at 02:09:19PM +0700, michael kapelko wrote:
> How do I force it to put *ALL* symbols from libalure.a into my libmj.so?

--whole-archive

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How can I link several static libraries into single shared library?
  2010-05-11  7:27 ` Alan Modra
@ 2010-05-11  7:55   ` michael kapelko
  2010-05-11 13:01   ` michael kapelko
  1 sibling, 0 replies; 4+ messages in thread
From: michael kapelko @ 2010-05-11  7:55 UTC (permalink / raw)
  To: binutils

Alan Modra wrote:
> On Tue, May 11, 2010 at 02:09:19PM +0700, michael kapelko wrote:
>   
>> How do I force it to put *ALL* symbols from libalure.a into my libmj.so?
>>     
>
> --whole-archive
>
>   
Doesn't work. Already tried that.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How can I link several static libraries into single shared library?
  2010-05-11  7:27 ` Alan Modra
  2010-05-11  7:55   ` michael kapelko
@ 2010-05-11 13:01   ` michael kapelko
  1 sibling, 0 replies; 4+ messages in thread
From: michael kapelko @ 2010-05-11 13:01 UTC (permalink / raw)
  To: binutils

Looks like i found the way to do it:

ld -shared -h libmj.so.1.0 -o libmj.so --whole-archive ./libalure.a 
./libOgreMainStatic.a

At least it grows in size. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-11 13:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-11  7:09 How can I link several static libraries into single shared library? michael kapelko
2010-05-11  7:27 ` Alan Modra
2010-05-11  7:55   ` michael kapelko
2010-05-11 13:01   ` michael kapelko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).