[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 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.

> Whether you love or hate libtool, this is not a libtool problem.  Are
> you using libtool 1.5 yet?

It's *always* a libtool problem.  That's why I hate libtool...

-- 
Steve Langasek
postmodern programmer

Attachment: pgpOb3CZKdIhD.pgp
Description: PGP signature


Reply to: