Error compiling stl on AIX 5.3 using GCC 4.0 - Aix

This is a discussion on Error compiling stl on AIX 5.3 using GCC 4.0 - Aix ; Hello, I am working on AIX 5.3 and using GCC 4.0, i try to compile a very simple CPP program that uses stl: ------------------------------------- #include using namespace std; int main() { string MyString; return 0; } ----------------------------------- and i fail: ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Error compiling stl on AIX 5.3 using GCC 4.0

  1. Error compiling stl on AIX 5.3 using GCC 4.0

    Hello,

    I am working on AIX 5.3 and using GCC 4.0, i try to compile a very
    simple CPP program that uses stl:


    -------------------------------------
    #include

    using namespace std;
    int main()
    {
    string MyString;
    return 0;
    }


    -----------------------------------

    and i fail:


    ------------------------------------
    -bash-2.05b$ g++ -o myTest myTest.cpp -v
    Using built-in specs.
    Target: powerpc-ibm-aix5.3.0.0
    Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/
    bin/
    ld --disable-nls --enable-languages=c,c++ --prefix=/opt/freeware --
    enable-threads --enable-version-specific-runtime-libs --host=powerpc-
    ibm-aix5.3.0.0
    Thread model: aix
    gcc version 4.0.0
    /opt/freeware/libexec/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/cc1plus -
    quiet
    -v -D_ALL_SOURCE myTest.cpp -quiet -dumpbase myTest.cpp -auxbase
    myTest -version -o /tmp//cchecZL7.s
    ignoring nonexistent directory "/opt/freeware/lib/gcc/powerpc-ibm-
    aix5.3.0.0/4.0.0/../../../../powerpc-ibm-aix5.3.0.0/include"
    #include "..." search starts here:
    #include <...> search starts here:
    /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/include/c++
    /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/include/c++/
    powerpc-ibm-aix5.3.0.0
    /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/include/c++/
    backward
    /usr/local/include
    /opt/freeware/include
    /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/include
    /usr/include
    End of search list.
    GNU C++ version 4.0.0 (powerpc-ibm-aix5.3.0.0)
    compiled by GNU C version 4.0.0.
    GGC heuristics: --param ggc-min-expand=100 --param ggc-min-
    heapsize=32768
    /usr/bin/as -u -mppc -o /tmp//ccrlwHjj.o /tmp//cchecZL7.s
    /opt/freeware/libexec/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/collect2 -
    bpT:
    0x10000000 -bpD:0x20000000 -btextro -bnodelcsect -o myTest /lib/
    crt0.o
    -L/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0 -L/opt/freeware/
    lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/../../.. /tmp//ccrlwHjj.o -lstdc
    +
    + -lm -lgcc_s /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/
    libgcc.a -lc -lgcc_s /opt/freeware/lib/gcc/powerpc-ibm-
    aix5.3.0.0/4.0.0/libgcc.a
    ld: 0711-317 ERROR: Undefined symbol: .std::basic_string std::char_traits, std::allocator >::basic_string()
    ld: 0711-317 ERROR: Undefined symbol: .std::basic_string std::char_traits, std::allocator >::~basic_string()
    ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
    information.
    collect2: ld returned 8 exit status
    ---------------------------------------------------------------------------*-

    I have installed GCC using RPM's from IBM's site:


    ---------------------------------------------------------------------------
    -bash-2.05b$ rpm -qa
    mtools-3.9.8-1
    libgcc-4.0.0-1
    mkisofs-1.13-4
    libstdc++-4.0.0-1
    bash-2.05b-1
    gcc-4.0.0-1
    binutils-2.14-3
    make-3.80-1
    gcc-c++-4.0.0-1
    openssl-0.9.6m-1
    openssl-devel-0.9.6m-1
    gdb-2.9.aix51.020209-4
    prngd-0.9.23-3
    sudo-1.6.7p5-3
    cdrecord-1.9-6
    AIX-rpm-5.3.0.40-2
    libstdc++-devel-4.0.0-1
    ---------------------------------------------------------------------------


    Any ideas?
    Thanks,
    Hagai.


  2. Re: Error compiling stl on AIX 5.3 using GCC 4.0

    In <1185273799.274519.233280@m3g2000hsh.googlegroups.c om> hagaiy@yahoo.com writes:

    [del]
    >heapsize=3D32768
    > /usr/bin/as -u -mppc -o /tmp//ccrlwHjj.o /tmp//cchecZL7.s


    This and:

    > /opt/freeware/libexec/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/collect2 -
    >bpT:
    >0x10000000 -bpD:0x20000000 -btextro -bnodelcsect -o myTest /lib/
    >crt0.o
    >-L/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0 -L/opt/freeware/
    >lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/../../.. /tmp//ccrlwHjj.o -lstdc
    >+
    >+ -lm -lgcc_s /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/
    >libgcc.a -lc -lgcc_s /opt/freeware/lib/gcc/powerpc-ibm-
    >aix5.3.0.0/4.0.0/libgcc.a
    >ld: 0711-317 ERROR: Undefined symbol: .std::basic_string
    [del]

    This error message looks like you are using the assembler and linker from
    AIX rather than the GNU ones. It depends on how the GCC has been build
    if you have to do that or not, my guess is that you have to correct your
    PATH environment variable so that the GNU-utilities will be found first.

    HTH,
    Uli
    --
    Dipl. Inf. Ulrich Teichert|e-mail: Ulrich.Teichert@gmx.de
    Stormweg 24 |listening to: Channel 13 Is Haunted (Hex Dispensers)
    24539 Neumuenster, Germany|Adrenalin (Supabond), Ne Me Touch Pas (Opération S)

  3. Re: Error compiling stl on AIX 5.3 using GCC 4.0

    Hello,

    thanks for your help.
    I am using IBM's linker and assembler acording to IBM recomendaiton
    when working with GCC on AIX (http://www.ibm.com/developerworks/aix/
    library/au-gnu.html):

    "You cannot use the GNU linker on AIX as this will cause incorrectly
    linked binaries. By default, the AIX linker is used when using GCC on
    AIX. You should only use the default AIX linker. "

    Hagai.


  4. Re: Error compiling stl on AIX 5.3 using GCC 4.0

    In <1185288627.929896.17730@q75g2000hsh.googlegroups.c om> hagaiy@yahoo.com writes:

    >Hello,


    >thanks for your help.
    >I am using IBM's linker and assembler acording to IBM recomendaiton
    >when working with GCC on AIX (http://www.ibm.com/developerworks/aix/
    >library/au-gnu.html):


    >"You cannot use the GNU linker on AIX as this will cause incorrectly
    >linked binaries. By default, the AIX linker is used when using GCC on
    >AIX. You should only use the default AIX linker. "


    I see. Then you should perhaps ask IBM why the AIX linker fails now.

    Or build your own GCC - it's not as hard as it sounds and for me, it worked
    better then installing IBM freeware packages with strange/unusual/broken
    settings.

    HTH,
    Uli
    --
    Dipl. Inf. Ulrich Teichert|e-mail: Ulrich.Teichert@gmx.de
    Stormweg 24 |listening to: Channel 13 Is Haunted (Hex Dispensers)
    24539 Neumuenster, Germany|Adrenalin (Supabond), Ne Me Touch Pas (Opération S)

  5. Re: Error compiling stl on AIX 5.3 using GCC 4.0

    hagaiy@yahoo.com wrote:
    > Hello,
    >
    > I am working on AIX 5.3 and using GCC 4.0, i try to compile a very
    > simple CPP program that uses stl:


    I'm no expert on g++ but don't you need to specify the STL library on
    the command line?

    Those are undefined symbols; find out where they're defined and include
    a reference (on the link command) to the defining file.

    --
    -------------------------------------
    http://www.photo.net/photos/garyrhook
    Vocatus atque non vocatus deus aderit

  6. Re: Error compiling stl on AIX 5.3 using GCC 4.0

    "Gary R. Hook" writes:

    > I'm no expert on g++ but don't you need to specify the STL library on
    > the command line?


    No, you don't: STL is all inline templates; there is no library that
    goes with it [1].

    > Those are undefined symbols; find out where they're defined and include
    > a reference (on the link command) to the defining file.


    The symbols are *supposed* to be defined in libstdc++.a, which is
    automatically added to the link by 'g++'.

    The real questions are:
    - is there /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/libstdc++.a
    - if so, does it define proper symbols (if it doesn't, this gcc build
    is useless).

    Cheers,

    [1] Except for common string and iostream methods which are imported
    from libstdc++
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

  7. Re: Error compiling stl on AIX 5.3 using GCC 4.0

    Paul Pluzhnikov wrote:
    > "Gary R. Hook" writes:
    >
    >> I'm no expert on g++ but don't you need to specify the STL library on
    >> the command line?

    >
    > No, you don't: STL is all inline templates; there is no library that
    > goes with it [1].


    Ah. Good to know.

    --
    -------------------------------------
    http://www.photo.net/photos/garyrhook
    Vocatus atque non vocatus deus aderit