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

Re: How do I get libtool to use g++?



On Sun, Jun 01, 2003 at 09:52:00PM -0400, Neil Roeth wrote:
> On Jun  1, Steve Langasek (vorlon@netexpress.net) wrote:
>  > On Sun, Jun 01, 2003 at 01:18:17PM +0100, Roger Leigh wrote:

>  > > > I recently had a bug (193950) filed against one of my packages because the
>  > > > shared libraries had "undefined non-weak symbols" - libstdc++ was not being
>  > > > linked in.  I resolved it with what I consider a gruesome hack.  I discovered
>  > > > that forcing libtool to use g++ while linking would automatically link in
>  > > > libstdc++.  The hack came about because I could not figure out how to get
>  > > > libtool to use g++ instead of gcc.  So, I did

>  > > > sed -e 's/CC="gcc"/CC="g++"/g' libtool > lt.tmp && mv -f lt.tmp libtool

>  > > > to force it.  What's the right way to get libstdc++ linked in to shared
>  > > > libraries of C++ code?  The package uses autoconf, automake, libtool, etc.

>  > > Would you care to show us your Makefile.am?

>  > > automake should be using CXX (and CXXFLAGS and AM_CXXFLAGS) to invoke
>  > > the C++ compiler, *not* CC/CFLAGS/AM_CFLAGS.  It should pick the
>  > > correct compiler if you specifiy the sources properly:

>  > > bin_PROGRAMS = foo
>  > > foo_SOURCES = foo.cc

>  > > will work, but if you miss out the _SOURCES, it will imply foo.c as
>  > > being the source, since C is the default language.

>  > Actually, this is a known bug in every version of libtool I could find
>  > in the archive when I looked; even when using g++ for compiling, it
>  > still reverts to gcc for linking.

> That's pretty much what I found.  Does that imply there is a common workaround
> to get it to link with g++?  If so, I'd like to know what it is. :-)

Not that I had found.  Sounds like upgrading to libtool 1.5 might help.
In general, it seems like running sed over libtool is the most common
solution.

-- 
Steve Langasek
postmodern programmer

Attachment: pgpioz3QE1S1D.pgp
Description: PGP signature


Reply to: