```
$ mkdir base
$ cd base
$ mkdir bin lib
$ echo "main(){}" > main.c
$ gcc main.c -o bin/main -Wl,-rpath,'$ORIGIN/../lib' -lxml2
$ ldd bin/main | grep libxml2
libxml2.so.2 => /lib64/libxml2.so.2 (0x00007f99a11dc000)
$ cp -a /lib64/libxml2.so* lib/
$ ldd bin/main | grep libxml2
libxml2.so.2 => /tmp/base/bin/../lib/libxml2.so.2 (0x00007fc1d0622000)
$ cd ..
$ mv base newbase
$ cd newbase
$ ldd bin/main | grep libxml2
libxml2.so.2 => /tmp/newbase/bin/../lib/libxml2.so.2 (0x00007f4c891fa000)
```
In short the program main lookup libxml2.so first in the dir ../lib before system default paths, so in our case we could let gpdb find our own version of libxml2.so w/o the use of LD_LIBRARY_PATH.
However I don't know whether $ORIGIN is supported on old compilers, so this might not be an acceptable answer.
BTW, here is the description in `man ld.so`
```
Rpath token expansion
ld.so understands certain strings in an rpath specification (DT_RPATH or DT_RUNPATH); those
strings are substituted as follows
$ORIGIN (or equivalently ${ORIGIN})
This expands to the directory containing the application executable. Thus, an
application located in somedir/app could be compiled with
gcc -Wl,-rpath,'$ORIGIN/../lib'
so that it finds an associated shared library in somedir/lib no matter where somedir
is located in the directory hierarchy. This facilitates the creation of "turn-key"
applications that do not need to be installed into special directories, but can
instead be unpacked into any directory and still find their own shared libraries.
$LIB (or equivalently ${LIB})
This expands to lib or lib64 depending on the architecture (e.g., on x86-64, it
expands to lib64 and on x86-32, it expands to lib).
$PLATFORM (or equivalently ${PLATFORM})
This expands to a string corresponding to the processor type of the host system
(e.g., "x86_64"). On some architectures, the Linux kernel doesn't provide a plat‐
form string to the dynamic linker. The value of this string is taken from the
AT_PLATFORM value in the auxiliary vector (see getauxval(3)).
```