[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How use --whole-archive ld arg with libtool ?

From: Alain BARBET
Subject: Re: How use --whole-archive ld arg with libtool ?
Date: Mon, 20 May 2002 23:47:22 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc2) Gecko/20020510

Original problem:

Take example in libtool doc:

"burger$ libtool gcc -module -o foo.lo \
                hello.lo -rpath /usr/local/lib -lm"
"If symbols from your executable are needed to satisfy unresolved references in a library you want to dlopen you will have to use
> The flag -export-dynamic. You should use -export-dynamic while
linking the executable that calls dlopen:
burger$ libtool gcc -export-dynamic -o hell-dlopener main.o"

What I want do is:
burger$ libtool gcc -export-dynamic -o hell-dlopener main.o --whole-archive
> myneededlib.a --no-whole-archive

Because symbols needed for are in mynneededlib.a, not in main.o, 
and gcc will not export these symbols without --whole-archive ... and libtool 
give me:
gcc -export-dynamic -o hell-dlopener main.o -Wl,--export-dynamic 
--whole-archive --no-whole-archive myneededlib.a

Not what I want ...

From Robert Boehne:
Ok, I was confused about what exectly you were asking.
I think the best way to do this is to pass it as a single
flag, like this:

-Wl,'-whole-archive -lfoo -no-whole-archive'

This way those options won't be rearranged on the ld command

Yes thank you for this workaround but ld didn't like it:
/usr/bin/ld: unrecognized option '-L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/../../..'
/usr/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
Without quote, expression links good so ...

1/ I think there isn't any options in automake / libtool for do what I want.
2/ -whole-archive flag is os dependant, and already defined in libtool, I must use it
3/ I must do an automake / libtool patch that:

  a/ In automake, define something in automake template, something like
  mybinaries_WHOLE_LIB =
  This variable isn't in use without --disable-shared flag

  b/ If --disable-shared option of configure is in use, automake must
  remove libs that is two times on link command and keep only this with
  whole-archive flag.

  c/ Add a -whole-archive options in libtool that use os specific option
  for link a library into a binarie

What you think of this ?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]