Ask a Question related to AIX, Design and Development.

  1. #1

    Default g++ 3.3 and AIX

    Hello,

    Is there any way that I can force a static linking of libstdc++.a into a
    binary produced by g++ 3.3 on AIX 5.1?

    Even if I put the libstdc++.a file directly on the command line, it still ends
    up linking it dynamically. If I use -bnso, then ALL libraries are linked
    statically, but I don't want libc.a linked statically into the executable,
    only libstdc++.a.

    Any ideas on how to fix it? Thanks.

    -pete
    Peter Keller Guest

  2. #2

    Default Re: g++ 3.3 and AIX

    Peter Keller wrote:
    > Is there any way that I can force a static linking of libstdc++.a into a
    > binary produced by g++ 3.3 on AIX 5.1?
    >
    > Even if I put the libstdc++.a file directly on the command line, it still ends
    > up linking it dynamically. If I use -bnso, then ALL libraries are linked
    > statically, but I don't want libc.a linked statically into the executable,
    > only libstdc++.a.
    Try "... -bstatic -lstdc++ -bdynamic ..." as long as g++ maintains
    command line ordering when it calls the linker.

    --
    Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE
    __________________________________________________ ______________________

    Gary R. Hook Guest

  3. #3

    Default Re: g++ 3.3 and AIX

    Gary R. Hook <nospam@nospammers.net> wrote:
    > Try "... -bstatic -lstdc++ -bdynamic ..." as long as g++ maintains
    > command line ordering when it calls the linker.
    I thought -b was for choosing a target machine when you have a compiler
    that can compile for multiple architectures. -B(in case this is what you
    meant to say) is for fixing the search paths for things like ld and cpp.

    I think you meant: -Bstatic and -Bdynamic supplied to the _GNU Linker_.
    Trouble is, I'm not using the GNU linker for this phase of the link.
    I'm using collect2 under gcc which uses the AIX linker, which doesn't
    understand -Bstatic and -Bdynamic in the capacity I need it.

    I found -bnso and -bso for the AIX linker, but it seems all or nothing.

    Is there anyway I can ask for SOME .a files(which contain .so files) to be
    statically brought in, but leave other libraries shared. Basically
    the -Bstatic/-Bdynamic effect for the AIX linker?

    Thanks.

    -pete
    Peter Keller Guest

  4. #4

    Default Re: g++ 3.3 and AIX

    Peter Keller <psilord@buzzard.cs.wisc.edu> wrote:
    > Is there anyway I can ask for SOME .a files(which contain .so files) to be
    > statically brought in, but leave other libraries shared. Basically
    > the -Bstatic/-Bdynamic effect for the AIX linker?
    My mistake. You are correct.

    If my command line looks like this:

    AIX aix-machine > /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3/collect2
    -bpT:0x10000000 -bpD:0x20000000 -btextro -bnodelcsect
    /lib/crt0.o -L/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3
    -L/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3/../../.. foo.o
    -bstatic -lstdc++ -bdynamic -lm
    /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3/libgcc.a
    /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3/libgcc_eh.a
    -lc /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3/libgcc.a
    /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3/libgcc_eh.a -m

    then it works as expected. I didn't know that -bstatic and -bdynamic were
    valid flags for the AIX linker. But now, after careful reading of the man
    page, I see what you are talking about. I've tried it and it works.

    Thank you VERY much.

    -pete
    Peter Keller Guest

  5. #5

    Default Re: g++ 3.3 and AIX

    Peter Keller wrote:
    > Peter Keller <psilord@buzzard.cs.wisc.edu> wrote:
    >
    >>Is there anyway I can ask for SOME .a files(which contain .so files) to be
    >>statically brought in, but leave other libraries shared. Basically
    >>the -Bstatic/-Bdynamic effect for the AIX linker?
    >
    > My mistake. You are correct.
    Well, it is what I do :-)
    > Thank you VERY much.
    Happy to assist.

    --
    Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE
    __________________________________________________ ______________________

    Gary R. Hook Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139