[Top][All Lists]

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

Re: Sun C++ shared library creation failing

From: Albert Chin
Subject: Re: Sun C++ shared library creation failing
Date: Sun, 1 Jun 2003 18:15:56 -0500
User-agent: Mutt/1.4i

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 -o .libs/
>   .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 (address@hidden)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]