On Wed, Mar 19, 2008 at 07:03:38PM -0500, Tim Mooney wrote: > > I think I have discovered a bug in libtool's link behavior with the > Sun Workshop C++ compiler when creating a C++ library that requires libm. > I observed it on x86_64-sun-solaris2.10, but it may also affect the > Workshop C++ compiler on Linux too. I found it when trying to build > GNU aspell 0.60.5.
What version of Sun C++ are you using? > If you have a configure.ac that calls AC_LANG([C++]), any subsequent > AC_CHECK_FUNCS will result in a link that uses the C++ compiler. Because > the C++ compiler initiates the link, it automatically adds some libraries > to the final call to ld. Which libraries it adds depends on what flags > CC was passed (arguments like -library=stlport4 change what C++ libraries > are automatically added). The C++ compiler appears to always add `-lm > -lc' after the C++ libraries, though. > > That means that doing something like > > AC_INIT(lttest, 0.60.5) > AC_CONFIG_SRCDIR(configure.ac) > AC_PROG_CXX > AC_LANG([C++]) > > AC_CHECK_FUNCS(sqrt) > AC_OUTPUT > > will always detect sqrt(), because the C++ compiler added `-lm -lc' > behind the scenes. > > When libtool is called to generate a C++ library on Solaris, it doesn't > add -lm, though. It only adds -lc. That will result in link failures > if functions like sqrt(), floor(), etc. from libm are used by the C++ > library. But if Sun C++ automatically adds -lm -lc, why, with libtool using C++ to link the library, isn't -lm -lc automatically added? Because Sun C++ is creating a library and not a program? -- albert chin ([EMAIL PROTECTED]) _______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool