0

Previously, binary files of Postgres 10 could be downloaded from the site and they worked on any Linux. I need to build binaries for Postgres 15 in the same way so that they work on any distributions.

cd /home/username/postgres-15/build_postgres
../configure --prefix=/home/username/postgres-15/install
make
make install

I tried to build in Ubuntu 16, but it doesn't work in Centos 7. I tried to build in Centos 7 and it worked for Ubuntu 16, but now it doesn't work in Ubuntu 22 (error while loading shared libraries: libldap_r-2.4.so.2: cannot open shared object file: No such file or directory).

Is it possible to make a universal assembly ?

1 Answers1

2

Building a "universal binary" is effectively impossible when there are shared libraries involved, because different distributions (and distribution versions) may have incompatible versions of the library (as you see with libldap in your question).

Your best option is creating a self contained package that includes both the binary and any necessary libraries. This will work in many cases.

The simplest solution is to run your service in a container, because this gives you complete control over the runtime environment visible to the service. I can docker run -d -e POSTGRES_PASSWORD=secret postgres:15 on CentOS 7, Fedora 38, Ubuntu 22, etc. If you choose this option, the work has already been done for you; you can just use the official postgres image.


Alternatives to containers would be something like AppImage, a distribution format created to solve exactly the problem you've encountered. I've never developed an appimage myself, so I can't really comment on ease of use.

I would just use the official postgres container and be done with it.

larsks
  • 277,717
  • 41
  • 399
  • 399