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

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



Neil Roeth <neil@debian.org> writes:

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

Does configure.ac call the "AC_PROG_CXX" macro?  Without it, automake
won't know anything about there being a C++ compiler available.
Whether you love or hate libtool, this is not a libtool problem.  Are
you using libtool 1.5 yet?


-- 
Roger Leigh

                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848 available on public keyservers



Reply to: