Open Source Development

Power Open Source Development

Explore the open source tools and capabilities for building and deploying modern applications on IBM Power platforms including AIX, IBM i, and Linux.


#Power


#Power


#Servers
#Opensource
 View Only
  • 1.  Why the gcc runtime is AIX version specific?

    Posted 12/09/19 03:56 PM

    Originally posted by: H0W2_tomasz_lacki


    libgcc-6.3.0-1.aix7.1.ppc.rpm

    libstdcplusplus-6.3.0-1.aix7.1.ppc.rpm

     

    The gcc has package separate for each version of the AIX but why the gcc runtime is provided as OS version specific as well.

     

    The application is built on AIX 7.1

    > g++ --version

    g++ (GCC) 6.3.0

    > g++ -pthread a.cpp

    > dump -Hv a.out | grep "^0 "

    0      /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/pthread:/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/../../../pthread:/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0:/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/../../..:/usr/lib:/lib

    The libpath structure stored in the executable guarantees the correct (tested) runtime is taken in case the runtimes for the gcc 6 anf  gcc 8 is installed on the AIX 7.1. It is no longer true if the application is installed on AIX 7.2 and the AIX 7.2 specific gcc runtimes is installed as the first path in the executable stored libpath does not match.

    Shall the runtime packages for the AIX 7.1 be installed on AIX 7.2 as well to make the path /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0 valid?


    #AIXOpenSource
    #AIX-Open-Source-Software


  • 2.  Re: Why the gcc runtime is AIX version specific?

    Posted 12/10/19 04:06 AM

    Originally posted by: AyappanP


    This is a known behaviour with GCC in AIX.

    It adds the AIX version specific path in the executables library search path.

    That's the reason it is always recommended to pass the linker option "-Wl,-blibpath:<library-path>" while creating the executables. 

    AIX Toolbox packages are built with this linker option. For 64 bit,  " -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib " and for 32 bit , " -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib "

     


    #AIXOpenSource
    #AIX-Open-Source-Software


  • 3.  Re: Why the gcc runtime is AIX version specific?

    Posted 12/10/19 10:02 AM

    Originally posted by: H0W2_tomasz_lacki


    The -lblibpath linker option solves the issue for the AIXToolbox but you are in control when new C/C++ runtime libraries are introduced and you are doing this only if it does not break the already published packages.

    The /opt/freeware/lib/libstdc++.a is just link to the most recent C++ runtime.

    Using -blibpath is even worse for my scenario as it does not guarantee the correct C/C++ runtime for AIX version the application is built on. The problem I faced with the higher version of the AIX than the version application is built on now affects both AIX versions.

    e.g:

    AIX 7.1 built with
    /opt/freeware/lib/libstdc++.a -> gcc/powerpc-ibm-aix7.1.0.0/6.3.0/libstdc++.a

    AIX 7.2 potentially deployed with

    /opt/freeware/lib/libstdc++.a -> gcc/powerpc-ibm-aix7.2.0.0/8.3.0/libstdc++.a

    AIX 7.1 potentially deployed with

    /opt/freeware/lib/libstdc++.a -> gcc/powerpc-ibm-aix7.1.0.0/8.3.0/libstdc++.a

    The solution for my case seems to be using the $LIBPATH environment variable.

    The environment my application is running on already uses custom PATH, LIBPATH and LDR_CNTRL=NAMEDSHLIB to allow deployment of many application version on the same AIX instance. The /opt/freeware/lib is not in my LIBPATH as the application does not depend on the AIX Toolbox other than build by GCC. I will install the C/C++ runtime my application is built, tested and released on and I will allow installation of higher C/C++ runtimes the AIX Toolbox provides or will provide in the future.

    I will set my desired C/C++ runtime by adding it to the LIBPATH. As a result the correct library is used e.g:

    LIBPATH=$LIBPATH:/opt/freeware/lib/gcc/powerpc-ibm-aix`oslevel`/6.3.0/pthread

    This will guarantee the application picks correct C/C++ runtime library or not start at all.


    #AIX-Open-Source-Software
    #AIXOpenSource


  • 4.  Re: Why the gcc runtime is AIX version specific?

    Posted 12/10/19 10:17 AM

    Originally posted by: AyappanP


    We haven't seen any gcc (APIs) problems with packages built using gcc 6.3.0 in AIX 6.1 and deployed in AIX 7.2 having gcc 8.3.0. 

     

     


    #AIX-Open-Source-Software
    #AIXOpenSource


  • 5.  Re: Why the gcc runtime is AIX version specific?

    Posted 12/10/19 11:10 AM

    Originally posted by: H0W2_tomasz_lacki


    It is good and thank you for that. Anyway the application has to guarantee it works in the tested environments only. This includes all shared libraries used.

    Thank you for your answer.


    #AIX-Open-Source-Software
    #AIXOpenSource


  • 6.  Re: Why the gcc runtime is AIX version specific?

    Posted 12/24/19 10:08 AM

    Originally posted by: H0W2_tomasz_lacki


    The Last question: If I decide to go through the -Wl,-blibpath option what path to gcc 6 runtime libraries shall I use?

    The

    /opt/freeware/lib

    or

    /opt/freeware/gcc6/lib

    Why the second location to the GCC 6 rpm packages is introduced? Is it permanent?


    #AIX-Open-Source-Software
    #AIXOpenSource


  • 7.  Re: Why the gcc runtime is AIX version specific?

    Posted 01/06/20 09:20 AM

    Originally posted by: sanket


    We have change our strategy and want to have one default version of gcc for all releases of AIX as of now it is gcc 8.3

    So when you install using yum and AIX toolbox repo a gcc on AIX it will be gcc 8.3

    But in some cases people would like to have other gcc release or want to have multiple gcc version installed on their system hence we are providing other gcc releases as gcc6/gcc7. 

    gcc6 will create its separate install location in /opt/freeware/gcc6 and all libraries and binaries under that. 

     

     


    #AIXOpenSource
    #AIX-Open-Source-Software


  • 8.  Re: Why the gcc runtime is AIX version specific?

    Posted 01/06/20 09:38 AM

    Originally posted by: H0W2_tomasz_lacki


    The below link solved issue with AIX version specific runtime need without introducing "-Wl,-blibpath" linker option.

    AIX72:/opt/freeware/lib/gcc> ls -l
    total 0
    lrwxrwxrwx 1 root system  22 Dec 23 08:29 powerpc-ibm-aix7.1.0.0 -> powerpc-ibm-aix7.2.0.0
    drwxr-xr-x 3 root system 256 Dec 20 2018  powerpc-ibm-aix7.2.0.0

     


    #AIXOpenSource
    #AIX-Open-Source-Software