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

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

 



Hi,
On Tue, Apr 19, 2011 at 07:08:44AM -0400, Qi Zuo wrote:
> Thank you for reply!
> 
> >You configure the compiler *before* you build it, not after.
> 
> Yes, I configured GCC before I built it. Just as following:
> #!/bin/sh
> LD_LIBRARY_PATH=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib
> export LD_LIBRARY_PATH
> cd /lab/home/zuoqi/gcc32/build-gcc-gnu-ccs
> rm -rf *
> ../gcc-4.6.0/configure ABI=32
> --prefix=/lab/home/zuoqi/gcc32/gcc-gnu-ccs --with-gnu-as
> --with-as=/usr/local/bin/as --with-gnu-ld --with-ld=/usr/local/bin/ld
> -
> -enable-languages=c,c++,java
> --with-gmp-include=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/include
> --with-gmp-lib=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib --with-mpfr-inc
> lude=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/include
> --with-mpfr-lib=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib
> --with-mpc-include=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/incl
> ude --with-mpc-lib=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib --without-ppl
> --without-cloog --enable-plugin --enable-lto
> make -j 64
> make check
> make install
> echo gcc DONE!
> 
> 
> > -bash-3.00$ export LD_LIBRARY_PATH=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib
> > -bash-3.00$ echo $LD_LIBRARY_PATH
> > /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib
> >
> > Then, when I compile the hello.cpp program, I got unreferenced
> > std::cout problem.
> 
> > Those symbols should be defined in libstdc++, maybe there's a symbol
> > versioning problem.
> >
> I'm not sure about this problem.
> The version of libstdc++.so of GCC4.4.2 is libstdc++.so.6.0.13
> The version of libstdc++.so of GCC4.6.0 is libstdc++.so.6.0.15
> 
> Is this the problem??
Probably not. In principle, g++ should automatically link to its "own"
library. However, a first remark: the "LD_LIBRARY_PATH" is (as far as I
know) not important here: it will be used when you RUN the program, in
order to find then the correct dynamic library. Your problem appears
however already at link time.

Could you recompile the code, passing "-v" to the compiler?
/lab/home/zuoqi/gcc32/gcc-gnu-ccs/bin/g++ -v hello.cpp 
With that, g++ will tell us all pathes and sub-commands it executes.
Maybe then someone will see the problem.

What I could imagine: I never tried "ABI=32" at configuration time --
maybe your linker "ld" does not understand correctly 32 bit libraries?
Or you have a mixture of 32bit and 64bit code/libraries, which can't be
linked together (if libstdc++ would be a 32bit file, but g++ generates
64bit I would understand the undefined reference...)?

Axel


[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