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