David, Thank you for your quick reply and detailed information! My platform is T5140 with T2, as following $uname -a SunOS bit930 5.10 Generic_142909-17 sun4v sparc SUNW,T5140 May I ask how did you configure the compiler and library path after you compiled GCC4.6.0? My problem seems to be something wrong with the LD_LIBRARY_PATH. Initially the compiled GCC can't find the MPC it uses. So the path of mpc library must be set. I used LD_LIBRARY_PATH -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. -bash-3.00$ /lab/home/zuoqi/gcc32/gcc-gnu-ccs/bin/g++ hello.cpp -v Using built-in specs. COLLECT_GCC=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/bin/g++ COLLECT_LTO_WRAPPER=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/libexec/gcc/sparc-sun-solaris2.10/4.6.0/lto-wrapper Target: sparc-sun-solaris2.10 Configured with: ../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-include=/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/include --with-mpc-lib=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib --without-ppl --without-cloog --enable-plugin --enable-lto Thread model: posix gcc version 4.6.0 (GCC) COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mcpu=v9' /lab/home/zuoqi/gcc32/gcc-gnu-ccs/libexec/gcc/sparc-sun-solaris2.10/4.6.0/cc1plus -quiet -v -D__sparcv8 hello.cpp -quiet -dumpbase hello.cpp -mcpu=v9 -auxbase hello -version -o /var/tmp//ccEvFRQQ.s GNU C++ (GCC) version 4.6.0 (sparc-sun-solaris2.10) compiled by GNU C version 4.6.0, GMP version 5.0.1, MPFR version 3.0.0, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/../../../../sparc-sun-solaris2.10/include" #include "..." search starts here: #include <...> search starts here: /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/../../../../include/c++/4.6.0 /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/../../../../include/c++/4.6.0/sparc-sun-solaris2.10 /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/../../../../include/c++/4.6.0/backward /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/include /usr/local/include /lab/home/zuoqi/gcc32/gcc-gnu-ccs/include /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/include-fixed /usr/include End of search list. GNU C++ (GCC) version 4.6.0 (sparc-sun-solaris2.10) compiled by GNU C version 4.6.0, GMP version 5.0.1, MPFR version 3.0.0, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 9f29d9ac5fbce03d716a8e16add774bc COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mcpu=v9' /usr/local/bin/as -v -V -Qy -s -xarch=v8plus -o /var/tmp//ccfmNnbG.o /var/tmp//ccEvFRQQ.s GNU assembler version 2.21 (sparc-sun-solaris2.10) using BFD version (GNU Binutils) 2.21 COMPILER_PATH=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/libexec/gcc/sparc-sun-solaris2.10/4.6.0/:/lab/home/zuoqi/gcc32/gcc-gnu-ccs/libexec/gcc/sparc-sun-solaris2.10/4.6.0/:/lab/home/zuoqi/gcc32/gcc-gnu-ccs/libexec/gcc/sparc-sun-solaris2.10/:/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/:/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/:/usr/ccs/bin/ LIBRARY_PATH=/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/:/usr/ccs/lib/:/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mcpu=v9' /lab/home/zuoqi/gcc32/gcc-gnu-ccs/libexec/gcc/sparc-sun-solaris2.10/4.6.0/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -rpath-link /usr/lib -Qy /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/crt1.o /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/crti.o /usr/ccs/lib/values-Xa.o /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/crtbegin.o -L/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0 -L/usr/ccs/lib -L/lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/../../.. /var/tmp//ccfmNnbG.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lc /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/crtend.o /lab/home/zuoqi/gcc32/gcc-gnu-ccs/lib/gcc/sparc-sun-solaris2.10/4.6.0/crtn.o GNU ld (GNU Binutils) 2.21 Supported emulations: elf32_sparc_sol2 elf32_sparc elf64_sparc_sol2 elf64_sparc /var/tmp//ccfmNnbG.o: In function `main': hello.cpp:(.text+0x20): undefined reference to `std::cout' hello.cpp:(.text+0x24): undefined reference to `std::cout' hello.cpp:(.text+0x48): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))' collect2: ld returned 1 exit status As seen in yousr configuration, your GCC4.6.0 intends to use the ccs ld and as given by Solaris --without-gnu-as --with-as=/usr/ccs/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld Have you ever tried to use GNU ld and as ? Since some special programs require the use of GNU ld, I need to build one. Would you give me some hints? Thanks a million! 2011/4/19 David Kirkby <david.kirkby@xxxxxxxxxx>: > On 19 April 2011 03:58, Qi Zuo <bitsunnyday@xxxxxxxxx> wrote: >> Hello, >> I have built GCC 4.6.0 on Solaris10/SPARC using following >> configuration to make the compiled GCC us > > <snip> > >> The program is hello.cpp as follow: >> #include<iostream> >> using namespace std; >> int main() >> { >> cout << "hello" <<endl; >> return 1; >> } >> >> The compile command is : /lab/home/zuoqi/gcc32/gcc-gnu-ccs/bin/g++ hello.cpp >> >> The errors are: >> /var/tmp//ccckp3Mi.o: In function `main': >> hello.cpp:(.text+0x20): undefined reference to `std::cout' >> hello.cpp:(.text+0x24): undefined reference to `std::cout' > >> Regards >> Qi Zuo >> >> School Of Computer Science and Technology >> Beijng Institute of Technology, China, 100081 >> > > I don't get your problem. I'm using a Sun T5240 with the T2+ processors (sun4v). > > kirkby@t2:64 ~$ uname -a > SunOS t2 5.10 Generic_141414-02 sun4v sparc SUNW,T5240 > > This is how GCC is configured. > > kirkby@t2:64 ~$ g++ -v > Using built-in specs. > COLLECT_GCC=g++ > COLLECT_LTO_WRAPPER=/usr/local/gcc-4.6.0/libexec/gcc/sparc-sun-solaris2.10/4.6.0/lto-wrapper > Target: sparc-sun-solaris2.10 > Configured with: ../gcc-4.6.0/configure --prefix=/usr/local/gcc-4.6.0 > --with-gmp=/usr/local/gcc-4.6.0 --with-mpfr=/usr/local/gcc-4.6.0 > --with-mpc=/usr/local/gcc-4.6.0 --enable-languages=c,c++,fortran > --disable-nls --enable-checking=release --enable-werror=no > --enable-multilib --with-system-zlib --enable-bootstrap > --without-gnu-as --with-as=/usr/ccs/bin/as --without-gnu-ld > --with-ld=/usr/ccs/bin/ld --with-pkgversion='Built by D. Kirkby > gmp-5.0.1 mpfr-3.0.1 mpc-0.9' > Thread model: posix > gcc version 4.6.0 (Built by D. Kirkby gmp-5.0.1 mpfr-3.0.1 mpc-0.9) > > > your program compiles ok > > kirkby@t2:64 ~$ cat hello.cc > #include<iostream> > using namespace std; > int main() > { > cout << "hello" <<endl; > return 1; > } > > kirkby@t2:64 ~$ g++ hello.cc > kirkby@t2:64 ~$ ./a.out > hello > > I'm using Solaris 10 update 5 > > kirkby@t2:64 ~$ cat /etc/release > Solaris 10 5/09 s10s_u7wos_08 SPARC > Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. > Use is subject to license terms. > Assembled 30 March 2009 > > > I'm also using gcc 4.6.0 on OpenSolaris 06/2009 on x86, and get no problems. > > Dave > -- Regards Qi Zuo School Of Computer Science and Technology Beijng Institute of Technology, China, 100081