libtool
[Top][All Lists]
Advanced

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

Re: shared library creation versus custom gcc specs file


From: Chris McCraw
Subject: Re: shared library creation versus custom gcc specs file
Date: Mon, 24 Jan 2005 10:57:25 -0600
User-agent: Mutt/1.5.6i

On Thu, Jan 20, 2005 at 07:32:34PM -0600, Bob Friesenhahn wrote:
> On Thu, 20 Jan 2005, Chris McCraw wrote:
> >this works great, except when creating shared libraries with libtool.
> >for some reason, probably a good one but in this case ill-fated, when
> >libtool links a shared a library, it ignores my $CFLAGS, wherein i point
> >gcc to a custom specs file which contains my -R / -L directives.  i remedy
> >the situation by hacking the libtool script to include
> >"-specs /path/to/my/specsfile" after both occurrences of "-shared", which
> >works fine.
> 
> Linker options are supposed to be passed via LDFLAGS rather than 
> CFLAGS.

i agree.  however, since libtool uses gcc to link (shared objects at least),
and my flags to gcc are essential for it to call the linker right, this
behavior still feels suboptimal.  it would be a nice thing if libtool had
a "pass these flags to gcc or g++ anytime you call them" setting.  i know
it would have made my life easier here and in the past when trying to
debug other problems in libtool-driven builds.


> I don't believe that libtool knows anything about a -specs 
> option.

as well it shouldn't.  i just wanted a way to pass it to gcc, and ldflags
didn't seem right, since i am not calling the linker--gcc is.  and gcc
needs its config directives to call the linker (in this case it wasn't
even ld--it was collect2, which takes gcc-style arguments like -Wl, rather
than LDFLAGS like -rpath).


> It does know about -L and -R options passed on the libtool 
> command line.  It seems likely that -Wl,-specs,/path/to/my/specsfile 
> will work.

again, these flags were for gcc.  if libtool actually used ld to link
shared objects (it seems to use gcc -shared or g++ -shared) then i'd
set the LDFLAGS and be done with it.  but...it doesn't.  what is the
"right" way to pass these flags, since ./configure sometimes fails if you
put gcc-intentioned flags (-Wl,-rpath) in LDFLAGS rather than -rpath?




reply via email to

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