Odd linking on aix 5.3 - Aix

This is a discussion on Odd linking on aix 5.3 - Aix ; Hi I am trying to link a program on aix 5.3 with g++-4.1.1 and am getting strange results (The following program is just to show the problem, so no coding style discussion pls). echo " #include #include class APO { ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Odd linking on aix 5.3

  1. Odd linking on aix 5.3

    Hi I am trying to link a program on aix 5.3 with g++-4.1.1 and am
    getting strange results (The following program is just to show the
    problem, so no coding style discussion pls).

    echo "
    #include
    #include
    class APO
    {
    public:
    APO() { std::cout << \"xxxxxxx\" << std::endl; }
    };
    static APO apoxx;
    int main(int *, char **) {
    return 0;
    }
    " > foo.cpp


    g++-4.1.1 -c foo.cpp -I /baphome/boost/include/boost-1_34_1/
    /usr/local/bin/g++-4.1.1 foo.o -L/baphome/boost/lib -lboost_filesystem-
    gcc41 -lpthread -ofoo -v
    echo version 1
    ../foo
    /usr/local/bin/g++-4.1.1 -L/baphome/boost/lib -lboost_filesystem-
    gcc41 foo.o -lpthread -ofoo -v
    echo version 2
    ../foo
    echo end


    ==== OUTPUT ====
    Es werden eingebaute Spezifikationen verwendet.
    Ziel: powerpc-ibm-aix5.3.0.0
    Konfiguriert mit: /baphome/tmp/inst/gcc-4.1.1/configure --program-
    suffix=-4.1.1
    Thread-Modell: aix
    gcc-Version 4.1.1
    /usr/local/libexec/gcc/powerpc-ibm-aix5.3.0.0/4.1.1/collect2 -bpT:
    0x10000000 -bpD:0x20000000 -btextro -bnodelcsect -ofoo /lib/crt0.o -L/
    baphome/boost/lib -L
    /usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1 -L/usr/local/lib/gcc/
    powerpc-ibm-aix5.3.0.0/4.1.1/../../.. foo.o -lboost_filesystem-gcc41 -
    lpthread -lstdc++
    -lm -lgcc_s /usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1/libgcc.a -
    lc -lgcc_s /usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1/libgcc.a
    version 1
    xxxxxxx
    Es werden eingebaute Spezifikationen verwendet.
    Ziel: powerpc-ibm-aix5.3.0.0
    Konfiguriert mit: /baphome/tmp/inst/gcc-4.1.1/configure --program-
    suffix=-4.1.1
    Thread-Modell: aix
    gcc-Version 4.1.1
    /usr/local/libexec/gcc/powerpc-ibm-aix5.3.0.0/4.1.1/collect2 -bpT:
    0x10000000 -bpD:0x20000000 -btextro -bnodelcsect -ofoo /lib/crt0.o -L/
    baphome/boost/lib -L
    /usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1 -L/usr/local/lib/gcc/
    powerpc-ibm-aix5.3.0.0/4.1.1/../../.. -lboost_filesystem-gcc41 foo.o -
    lpthread -lstdc++
    -lm -lgcc_s /usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1/libgcc.a -
    lc -lgcc_s /usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1/libgcc.a
    version 2
    end



    Any ideas?

    Thx in advance,
    Florian

    P.S.: If you need additional information, just tell me...

  2. Re: Odd linking on aix 5.3

    My guess it's because of the position of foo.o.

    Normally linkers pull bits out of libraries only if required, so as no
    object files have been mentioned when the boost_filesystem library was
    mentioned, the linker has decided that it can't be needed. The order is
    significant in a link line, with left hand elements used first. With
    statically linked libraries you can fail if you end up with circular
    dependencies.


  3. Re: Odd linking on aix 5.3

    On Nov 26, 2:55 am, "porter2" wrote:
    > My guess it's because of the position of foo.o.
    >
    > Normally linkers pull bits out of libraries only if required, so as no
    > object files have been mentioned when the boost_filesystem library was
    > mentioned, the linker has decided that it can't be needed. The order is
    > significant in a link line, with left hand elements used first. With
    > statically linked libraries you can fail if you end up with circular
    > dependencies.


    I tested now on two other aix 5.3 machines and it turned out that we
    might have run into this bug:
    http://www.ibm.com/developerworks/fo...hreadID=119546

    I am currently running make, and hopefully the problem will be gone
    afterwards. But thx for your efforts.

  4. Re: Odd linking on aix 5.3

    porter2 wrote:
    > My guess it's because of the position of foo.o.
    >
    > Normally linkers pull bits out of libraries only if required, so as no
    > object files have been mentioned when the boost_filesystem library was
    > mentioned, the linker has decided that it can't be needed. The order is
    > significant in a link line, with left hand elements used first. With
    > statically linked libraries you can fail if you end up with circular
    > dependencies.
    >


    Not on AIX, it doesn't. All symbols are seen in the order they're
    encountered on the command line, archives included. This is a behavior
    that is distinctly different from other Unix systems.

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

+ Reply to Thread