Hi, I found the problem. HP linker default linkinge ist dynamic and it try to link main.o with libstdc++.sl. However the installed shared version of libstdc++ does not go with the installed gcc version. (latest installed gcc was configured with "--disable-shared") After forcing a static linking (with -aarchive,-lstdc++) all was fine. Thomas ----- Forwarded message from Thomas Porschberg <thomas.porschberg@xxxxxxxxx> ----- X-Sieve: CMU Sieve 2.2 Mailing-List: contact gcc-help-help@xxxxxxxxxxx; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:gcc-help-unsubscribe-thomas.porschberg=osp-dd.de@xxxxxxxxxxx> List-Archive: <http://gcc.gnu.org/ml/gcc-help/> List-Post: <mailto:gcc-help@xxxxxxxxxxx> List-Help: <mailto:gcc-help-help@xxxxxxxxxxx> Delivered-To: mailing list gcc-help@xxxxxxxxxxx Date: Fri, 10 Jun 2005 18:46:06 +0200 From: Thomas Porschberg <thomas.porschberg@xxxxxxxxx> To: gcc-help@xxxxxxxxxxx Subject: [thomas.porschberg@xxxxxxxxx: Re: stringstream at HPUX] User-Agent: Mutt/1.4i X-Operating-System: Linux porschberg 2.4.20-4GB X-Virus-Scanned: by amavisd-new at osp-dd.de X-Virus-Scanned: by amavisd-new at osp-dd.de Hi, I did now a : 1) g++ -c main.cpp 2) g++ -W,l -v main.o to get more linker output and I see: Reading specs from /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.2.3/specs Configured with: ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as --with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 Thread model: posix gcc version 3.2.3 /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.2.3/collect2 -L/lib/pa1.1 -L/usr/lib/pa1.1 -z -u main /usr/ccs/lib/crt0.o -L/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.2.3 -L/usr/ccs/bin -L/usr/ccs/lib -L/opt/langtools/lib -L/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.2.3/../../.. main.o -lstdc++ -lm -lgcc -lc -lgcc /usr/ccs/bin/ld: Unsatisfied symbols: std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_stringstream [in-charge]()(first referenced in main.o) (code) std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream[in-charge](std::_Ios_Openmode)(first referenced in main.o) (code) collect2: ld returned 1 exit status gcc was built with "--disable-shared" so the linker does not try link against the shared libraries, but how can I verify that stdc++ library used is the wrong one ? BTW, on another HPUX a gcc3.2 is running built without the "--disable-shared" option and the program build fine. I did further a: nm main.o | grep stringstream and got U _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_Openmode U _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev Now I did a: my_host(my_user):/usr/local/lib> nm libstdc++.a | grep _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev 00000000 T _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev my_host(my_user):/usr/local/lib> nm libstdc++.a | grep _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcEEC1ESt13> 00000000 T _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_Openmode The symbols are found. What do I misunderstand ? Thomas ----- Forwarded message from Thomas Porschberg <thomas.porschberg@xxxxxxxxx> ----- X-Sieve: CMU Sieve 2.2 Date: Fri, 10 Jun 2005 09:54:02 +0200 From: Thomas Porschberg <thomas.porschberg@xxxxxxxxx> To: Thomas Porschberg <thomas.porschberg@xxxxxxxxx> Cc: gcc-help@xxxxxxxxxxx Subject: Re: stringstream at HPUX In-Reply-To: <20050610051938.GA28807@xxxxxxxxxxxxxxxxxxxx> User-Agent: Mutt/1.4i Organization: OSP X-Operating-System: Linux porschberg 2.4.20-4GB X-Virus-Scanned: by amavisd-new at osp-dd.de On another HPUX with gcc 3.2 the small progam compiles/run fine. So I think it is a installation problem. How can I verify what is the broken component ? On Fri, Jun 10, 2005 at 07:19:39AM +0200, Thomas Porschberg wrote: > Hi, > > the following program: > > #include <sstream> > #include <string> > #include <iostream> > > using namespace std; > > int main() > { > std::stringstream ss; > std::string str; > ss << 4; ss >> str; > std::cout << "str: " << str << std::endl; > return 0; > } > > does not build at a HP-UX B.11.11 U 9000/800 then I > try: "g++ main.cpp". > > I get a linker error: > > /usr/ccs/bin/ld: Unsatisfied symbols: > std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_stringstream > +[in-charge]()(first referenced in /var/tmp//ccvy3bfa.o) (code) > std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> > +>::basic_stringstream[in-charge](std::_Ios_Openmode)(first referenced in /var/tmp//ccvy3bfa.o) (code) > collect2: ld returned 1 exit status > > g++ -v gives me: > > Reading specs from /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.2.3/specs > Configured with: ./configure --prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 : (reconfigured) ./configure > +--prefix=/usr/local --enable-threads=posix --disable-shared --with-gnu-as > +--with-libiconv-prefix=/usr/local/lib --enable-languages=c,c++,f77 > Thread model: posix > gcc version 3.2.3 > > Quit recently at the same machine a gcc-3.0.2 was installed. > > I think/hope the installation of gcc or my environment is somehow broken. > How can I find out the problem ? > > Thomas > > -- > > -- ----- End forwarded message ----- -- ----- End forwarded message ----- --