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

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

 



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.

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

2011/4/19 Jonathan Wakely <jwakely.gcc@xxxxxxxxx>:
> On 19 April 2011 12:08, Qi Zuo wrote:
>>
>>> Yes, if you install gmp, mpfr and mpc without using --disable-shared
>>> then gcc depends on the shared libraries at runtime.
>>>
>>> See http://advogato.org/person/redi/diary/240.html (and the pages it
>>> links to) for a simple way to build gcc so you don't need to set
>>> LD_LIBRARY_PATH to use it.
>>
>> I once built GCC as this web page suggested. However, it seems to
>> generate static libraries for gmp, mpfr and mpc rather than dynamic
>> ones.
>
> Yes, that's the whole point!
>
> If you use dynamic libraries gcc needs to find them. If you don't want
> to worry about that, use static libraries.
>



-- 
Regards
Qi Zuo

School Of Computer Science and Technology
Beijng Institute of Technology, China, 100081


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux