This is the mail archive of the
automake@gnu.org
mailing list for the automake project.
Re: How use --whole-archive ld arg with libtool ?
- From: Alain BARBET <alian at alianwebserver dot com>
- To: "Boehne, Robert" <rboehne at ricardo-us dot com>
- Cc: libtool <libtool at gnu dot org>, automake at gnu dot org
- Date: Mon, 20 May 2002 23:47:22 +0200
- Subject: Re: How use --whole-archive ld arg with libtool ?
- References: <3CE400D8.7090303@alianwebserver.com> <3CE40516.EBA11963@ricardo-us.com> <3CE40D99.6070102@alianwebserver.com> <3CE6F8B1.6050401@alianwebserver.com> <3CE90F72.B84E7A94@ricardo-us.com>
Original problem:
> Take example in libtool doc:
>
> "burger$ libtool gcc -module -o libhello.la 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 libhello.la 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
> line.
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 = myfirstlib.la mysecondlib.la
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 ?
--
Alain BARBET