Many PostgreSQL extensions are built using a build base for extensions called PGXS. Building with PGXS also generates files related to llvm. Depending on which version of llvm you are using, follow these steps:
PGXS builds also set DT_RUNPATH to the built binaries. See "4.7.12.4 Setting DT_RUNPATH" for more information.
The default version of llvm is described in "2.1 Required Operating System". If you want to use the default version of llvm, use the OSS documentation to build and install OSS.
As superuser, copy the Makefile.global corresponding to the version of llvm you want to use. The following is an example of using version 9 of llvm. Makefile.global is overwritten when an emergency fix is applied or removed from Fujitsu Enterpise Postgres, this procedure should be performed each time a build is performed.
$ su - Password:****** # cp /opt/fsepv<x>server64/lib/pgxs/src/Makefile.global-vsn9 /opt/fsepv<x>server64/lib/pgxs/src/Makefile.global
Follow the OSS documentation to build and install OSS.
As superuser, run the following command:. The following is an example of using version 9 of llvm:.
$ su - Password:****** # mv /opt/fsepv<x>server64/lib/bitcode/<OSS name>* /opt/fsepv<x>server64/lib/bitcode-vsn9/
If you do not use llvm, use the with _ llvm = no option when performing the build, as shown below. For other options, follow the OSS documentation.
# make USE_PGXS=1 with_llvm=no
The default values for DT_RUNPATH are <Fujitsu Enterprise Postgres installation directory in the build environment>/lib, and $ORIGIN /../ lib.
If your build and production environments have the same Fujitsu Enterprise Postgres installation directory, you can run the built program without setting the environment variable LD_LIBRARY_PATH to <Fujitsu Enterprise Postgres installationdirectory in the operating environment>/lib.
If the installation directories of Fujitsu Enterprise Postgres for the build and production environments cannot be in the same location, or the production installation directory cannot be pre-determined, you can run a program built without <Fujitsu Enterprise Postgres installationdirectory in the operating environment>/lib in the LD_LIBRARY_PATH by doing the following:
Set the DT_RUNPATH attribute to any path.
In your production environment, create a symbolic link to <Fujitsu Enterprise Postgres installationdirectory in the operating environment>/lib in the appropriate path.
To do this, set the DT_RUNPATH attribute in the environment variable PG_LDFLAGS(*1).
If this is not possible, set LD_LIBRARY_PATH to <Fujitsu Enterprise Postgres installationdirectory in the operating environment>/lib when you run the program.
For notes on setting the environment variable LD_LIBRARY_PATH, see "When DT_RUNPATH cannot be set" in "How to Build and Run an Application that Uses Shared Libraries" in the Application Development Guide.
*1:For more information about the PG_LDFLAGS environment variable, see "Extension Building Infrastructure" in the PostgreSQL Documentation. For example, "make USE_PGXS = 1 PG_LDFLAGS =" -Wl, -rpath, '$$ORIGIN /../ libdummy', --enable-new-dtags ".