AIX Open Source

AIX Open Source

Share your experiences and connect with fellow developers to discover how to build and manage open source software for the AIX operating system

 View Only
  • 1.  Questions about libstdc++.a for gcc

    Posted Fri October 28, 2022 02:17 AM

    We tried to compile official protobuf example on AIX7.1 with gcc8, the protobuf uses pthread and we encountered missing symbol problem

    $ ./add_person_cpp
    exec(): 0509-036 Cannot load program add_person_cpp because of the following errors:
            0509-130 Symbol resolution failed for /opt/freeware/lib64/libprotobuf.a[libprotobuf.so.30] because:
            0509-136   Symbol _ZSt11__once_call (number 10) is not exported from
                       dependent module /opt/freeware/lib64/libstdc++.a[libstdc++.so.6].
            0509-136   Symbol _ZSt15__once_callable (number 11) is not exported from
                       dependent module /opt/freeware/lib64/libstdc++.a[libstdc++.so.6].
            0509-136   Symbol __once_proxy (number 21) is not exported from
                       dependent module /opt/freeware/lib64/libstdc++.a[libstdc++.so.6].
            0509-192 Examine .loader section symbols with the
                     'dump -Tv' command.


    We have checked the libstdc++.a and found there are two libstdc++.a in the lib/gcc/powerpc-ibm-aix*/ directory

    $ ls -ls /opt/freeware/lib64/libstdc++.a
       0 lrwxrwxrwx    1 root     system           53 Sep 01 15:10 /opt/freeware/lib64/libstdc++.a@ -> ../lib/gcc/powerpc-ibm-aix7.1.0.0/8/ppc64/libstdc++.a*


    This problem could be solved by providing another pthread library with LIBPATH

    $ LIBPATH=/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/8/pthread ./add_person_cpp
    Usage:  ./add_person_cpp ADDRESS_BOOK_FILE


    We are curious that "Is it safe to use the pthread/libstdc++.a to replace the original ppc64/libstdc++.a in /opt/freeware/lib64?"



    ------------------------------
    yy
    ------------------------------


  • 2.  RE: Questions about libstdc++.a for gcc

    Posted Fri October 28, 2022 02:40 AM
    It's not a good thing to replace the libraries. 
    You need to hack the -blibpath to make sure "/opt/freeware/lib/pthread" is set in the libpath of the protobuf libraries.
    You can take a look at the Toolbox protobuf spec file --> https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/SPECS/protobuf-3.19.4-1.spec

    ------------------------------
    Ayappan P
    ------------------------------



  • 3.  RE: Questions about libstdc++.a for gcc

    Posted Fri October 28, 2022 03:23 AM
    We tried -blibpath and it works. Thank you.

    ------------------------------
    yy
    ------------------------------