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

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



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. :-)

To answer Roger's question, yes, the AC_PROG_CXX macro is used, and everything
else seems to use g++ as it should, without any other gruesome hacks.  It's
not the cleanest auto* setup either, it appears to have been done years ago
and touched very little.

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

I haven't heard anything good about libtool in a while.

-- 
Neil Roeth



Reply to: