RE: AIX support

From: Srirama Kucherlapati <sriram(dot)rk(at)in(dot)ibm(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Aditya Kamath <Aditya(dot)Kamath1(at)ibm(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Noah Misch <noah(at)leadboat(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, "peter(at)eisentraut(dot)org" <peter(at)eisentraut(dot)org>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "hlinnaka(at)iki(dot)fi" <hlinnaka(at)iki(dot)fi>, "tristan(at)partin(dot)io" <tristan(at)partin(dot)io>, "postgres-ibm-aix(at)wwpdl(dot)vnet(dot)ibm(dot)com" <postgres-ibm-aix(at)wwpdl(dot)vnet(dot)ibm(dot)com>
Subject: RE: AIX support
Date: 2026-02-13 08:49:56
Message-ID: SJ4PPFB8177832657EBF2FE43646F77B3F7DB61A@SJ4PPFB81778326.namprd15.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tom,

Thank you for comments.

>exec(): 0509-036 Cannot load program initdb because of the following errors:
> 0509-150 Dependent module libpq.a(libpq.so.5) could not be loaded.
> 0509-022 Cannot load module libpq.a(libpq.so.5).
> 0509-026 System error: A file or directory in the path name does not exist.

This issue can occur when gmake install installs the build into a custom directory using the DESTDIR flag. After installation, the loader inspects the binary’s library path to locate the required libpq.a libraries.

If the installation directory differs from the default location, we need to set the LIBPATH environment variable to point to the custom directory where the libraries have been placed.

Example:
If “gmake install DESTDIR=$PWD/<new_dir>", then all the binaries will be placed in $PWD/<new_dir>/usr/local/pgsql/bin and the libraries will be at $PWD/<new_dir>/usr/local/pgsql/lib.
So we have to export the LIBPATH to $PWD/<new_dir>/usr/local/pgsql/lib. To allow the loader to find the library, what initdb expects.
## export LIBPATH=" $PWD/<new_dir>/usr/local/pgsql/lib"

This command lists the paths the runtime linker will check when resolving shared libraries

## dump -X64 -Hov tmp_install/usr/local/pgsql/bin/initdb
***Import File Strings***
INDEX PATH BASE MEMBER
0 ../../../src/port:../../../src/common:../../../src/fe_utils:../../../src/interfaces/libpq:/opt/freeware/lib:/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/13/ppc64:/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/13/../../../ppc64:/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/13:/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/13/../../..:/usr/lib:/lib
1 libc.a shr_64.o
2 libpthread.a shr_xpg5_64.o
3 libpq.a libpq.so.5
4 libicuuc73.a libicuuc73.so
5 libicui18n73.a libicui18n73.so
6 libicudata73.a libicudata73.so

If we export the destination directory path where the library will be installed via LDFLAGS=“-Wl,-blibpath=<dest_lib_path>”, then at build time itself the compiler will add this path in the binaries libpath, there by not requiring to export the LIBPATH.

During our packaging for customers, we install the libraries into "/opt/freeware/lib/“ path, which is always present in the binary libpath as shown above. So user doesn't have to export the LIBPATH.

Let me know, if exporting the LIBPATH to the custom directory works for you.

Warm regards,
Sriram.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2026-02-13 09:19:59 Re: COMMENTS are not being copied in CREATE TABLE LIKE
Previous Message Zsolt Parragi 2026-02-13 08:31:50 Re: Odd usage of errmsg_internal in bufmgr.c