g++ on HPUX - HP UX

This is a discussion on g++ on HPUX - HP UX ; 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 #include #include using namespace std; int main() { std::stringstream ss; std::string str; ss > str; std::cout return 0; } I ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: g++ on HPUX

  1. g++ on HPUX


    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
    #include
    #include

    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, std::allocator >::~basic_stringstream
    [in-charge]()(first referenced in /var/tmp//ccvy3bfa.o) (code)
    std::basic_stringstream, std::allocator
    ::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, std::allocator >::~basic_stringstream [in-charge]()(first referenced in
    +main.o) (code)
    std::basic_stringstream, std::allocator >::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_traitsIcESaIcE EC1ESt13_Ios_Openmode
    U _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcE ED1Ev

    Now I did a:

    my_host(my_user):/usr/local/lib> nm libstdc++.a | grep _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcE ED1Ev
    00000000 T _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcE ED1Ev

    my_host(my_user):/usr/local/lib> nm libstdc++.a | grep _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcE EC1ESt13>
    00000000 T _ZNSt18basic_stringstreamIcSt11char_traitsIcESaIcE EC1ESt13_Ios_Openmode

    The symbols are found. What do I missing ?
    How can I further analyze the problem ?

    Thomas

  2. Re: g++ on HPUX

    In article ,
    gelbeiche wrote:

    >gcc was built with "--disable-shared" so the linker does not try link against
    >the shared libraries.


    I don't think this is true. --disable-shared means that you won't
    create any shared libraries when building GCC, but I think it will still
    use them if they exist. When you do the link the linker is going to use
    its default behavour, which on HP-UX is to look for shared libraries
    first.

    Try adding -static to your link line. The linker may be finding
    an old shared libstdc++ from an earlier GCC build/installation.

    Steve Ellcey
    sje cup . hp . com

+ Reply to Thread