As the original IBM GCC RPM package which I used as the starting point used the
--enable-version-specific-runtime-libs configure switch the consequence is that when you compile/link a program with gcc/g++ that this version-specific runtime search path for shared libraries is compiled into the binary unless you use some precaution with the "
-blibpath" linker flag. In order to stay compatible I had to keep that switch, i.e., stick to the same behavior as before.
The four runtime libraries are:
- libgcc (
libgcc_s.a, GCC C runtime library)
- libstdc++ (
libstdc++.a, GCC C++ runtime library)
- libgomp (
libgomp.a, GCC OpenMP runtime library)
- libgfortran (
libgfortran.a, GCC Fortran runtime library)
The GCC version-specific runtime libraries are contained in
<architecture_AIX_level> = powerpc-ibm-aix184.108.40.206
<GCC_Level> = your GCC version, e.g., 4.7.2
In this directory (
<prefix>) you find the runtime libraries for the following cases:
- 32-bit compilation, non-thread-safe (
- 32-bit compilation, thread-safe (
- 64-bit compilation, non-thread-safe (
- 64-bit compilation, thread-safe (
|So in order to not have a fixed version-specific runtime library search path contained in your binary you should use a generic search path like |
/opt/freeware/lib (for 32-bit shared libraries (mostly)) and
/opt/freeware/lib/64 (for 64-bit shared libraries).
- If you use such a generic search path, though, you need symbolic links from
/opt/freeware/lib64 to the specific GCC version that you have installed!
- This works fine until you change (e.g., update) the GCC version, e.g.,
- If the GCC version is changed these symbolic links must also be updated.
- As a consequence, all newer GCC RPM packages contain the following symbolic links to the four runtime libraries listed above (here as an example I only show it for
/opt/freeware/lib/libgcc_s.a -> <prefix>/libgcc_s.a, 32-bit non-thread-safe
/opt/freeware/lib64/libgcc_s.a -> <prefix>/ppc64/libgcc_s.a, 64-bit non thread-safe
/opt/freeware/lib/pthread/libgcc_s.a -- <prefix>/pthread/libgcc_s.a, 32-bit, thread-safe
/opt/freeware/lib/pthread/ppc64/libgcc_s.a -> <prefix>/pthread/ppc64/libgcc_s.a, 64-bit thread-safe
- Whenever the GCC RPM packages are updated these symbolic links are also updated as part of the RPM package.
- Consequences for 64-bit compilation:
$CFLAGS must contain "
-L/opt/freeware/lib64 -L/opt/freeware/lib" in that order!
$LDFLAGS must contain "
-Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib" in that order!