help-gplusplus@gnu.org
[Top] [All Lists]

g++ on HPUX

Subject: g++ on HPUX
From: gelbeiche
Date: 11 Jun 2005 08:08:29 +0200
Newsgroups: comp.sys.hp.hpux, gnu.g++.help
I have problems to build the following
small C++ programm with g++ 3.2.3 at a 
HP-UX B.11.11 U 9000/800.

#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;
}

I get a linker error from HPs linker:

/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
 

To get more information I did a:

1) g++ -c main.cpp
2) g++ -W,l -v main.o

Here comes the output:

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.

How can I check the gcc installation/enivronment ?
In the specified directory: 
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.2.3/../../..
there exist a libstdc++.

I did 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 missing ?
How can I further analyze the problem ?

Thomas
_______________________________________________
Help-gplusplus mailing list
Help-gplusplus@xxxxxxx
http://lists.gnu.org/mailman/listinfo/help-gplusplus

<Prev in Thread] Current Thread [Next in Thread>