This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++ error on Solaris/Sparc undefined reference to std::cout


On 19 April 2011 16:49, Qi Zuo wrote:
> Thank you for your continuous help!
>
> I followed the instruction to copy GMP, MPFR AND MPC into GCC4.6.0
> source directory and compile it as a whole.
> The configuration is as following:
> #!/bin/sh
> cd /lab/home/zuoqi/gccfull/build-gcc-gnu
> rm -rf *
> ../gcc-4.6.0/configure --prefix=/lab/home/zuoqi/gccfull/gcc-gnu
> --with-gnu-as --with-as=/usr/local/bin/as --with-gnu-ld
> --with-ld=/usr/local/bin/ld --enable-languages=c,c++,java
> --without-ppl --without-cloog --enable-plugin --enable-lto
> make -j 64
> make check
>
> cd /lab/home/zuoqi/gccfull/gcc-gnu
> rm -rf *
> cd /lab/home/zuoqi/gccfull/build-gcc-gnu
>
> make install
> echo gcc-gnu DONE!
>
> When I use the generated g++ to compile hello.cpp, the cout error is
> still there.
>
> BTW, nm check also shows that the libstdc++.so.6 has following
> attribute the same as the GCC4.6.0 built with seperate GMP,MPFR and
> MPC.

Yes, that's expected, building gmp, mpfr and mpc as part of the gcc
build only avoids needing to set LD_LIBRARY_PATH.

It has absolutely nothing to do with your std::cout linking problem.
I only suggested it because you kept mentioning that you couldn't run
g++ without setting LD_LIBRARY_PATH, so I pointed out how to avoid
that.


> -bash-3.00$ nm /lab/home/zuoqi/gccfull/gcc-gnu/lib/libstdc++.so.6|grep cout
> 000e1050 b _ZN14__gnu_internal13buf_cout_syncE
> 000e0db0 b _ZN14__gnu_internal14buf_wcout_syncE
> 000e0f48 b _ZN14__gnu_internal8buf_coutE
> 000e0ca0 b _ZN14__gnu_internal9buf_wcoutE
> 000e13e0 b _ZSt4cout
> 000e1198 B _ZSt5wcout
>
> I checked the libstdc++.so.6 for GCC4.4.2
>
> -bash-3.00$ nm /usr/local/gcc4/lib/libstdc++.so.6|grep cout
> 001797e8 b _ZN14__gnu_internal13buf_cout_syncE
> 00179a88 b _ZN14__gnu_internal14buf_wcout_syncE
> 00179860 b _ZN14__gnu_internal8buf_coutE
> 00179b00 b _ZN14__gnu_internal9buf_wcoutE
> 001793f0 B _ZSt4cout
> 00179638 B _ZSt5wcout
>
> The difference is as you said. _ZStcout has different attributes B vs b.
>
> However, I haven't got a solution to this problem. Maybe as lan
> mentioned, it's a problem of my building of stdc++ library.

Yes.

You need to look at the logs in the libstdc++-v3 directory.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]