On Sun, Jun 01, 2003 at 03:47:42PM -0500, Albert Chin wrote: > On Solaris 9/SPARC with: > $ CC -v > CC: Forte Developer 7 C++ 5.4 Patch 111715-06 2003/03/29 > ... > PASS: tagdemo-conf.test > FAIL: tagdemo-make.test > SKIP: tagdemo-exec.test > PASS: tagdemo-shared.test > FAIL: tagdemo-make.test > SKIP: tagdemo-exec.test > ... > > Here's a copy of the error: > $ sh tagdemo-make.test > ... > CC -G -zdefs -nolib -hlibbaz.so.0 -o .libs/libbaz.so.0.0.0 > .libs/baz.o -Qoption ld -z -Qoption ld allextract ./.libs/libfoo.a > -Qoption ld -z -Qoption ld defaultextract -lm > Undefined first referenced > symbol in file > std::basic_ostream<char,std::char_traits<char> > >&std::operator<<(std::basic_ostream<char,std::char_traits<char> >&,const char*) > ./.libs/libfoo.a(foo.o) > ... > > We create a C++ shared library with -nolib which doesn't link in > -lCstd, hence the error above. How do we fix? If -nolib isn't used CC > adds the following libraries by default: > -lCstd -lCrun -lm -lw -lcx -lc > > Is it really wise to use -nolib?
Ok, I've dug some more. If we want -zdefs and -nolib, we must add -lCstd (Sun CC 6.0, 7). From libtool.m4: # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' I'm not seeing this though. CC -G with Sun CC 5.0, 6.0, and 7 don't add any libraries automatically. GCC seems to add -lstdc++ regardless so postdeps gets the "-lstdc++" and gets the above test right. -- albert chin ([EMAIL PROTECTED]) _______________________________________________ Libtool mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/libtool