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.

Reply via email to