Thread: https://wiki.postgresql.org/wiki/Compile_and_Install_from_source_code

https://wiki.postgresql.org/wiki/Compile_and_Install_from_source_code

From
"Joel Jacobson"
Date:
Hi,

Looking at the Ubuntu requirements:

sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc

I note there are quite a few additional packages required to build PostgreSQL with all configure features/options.

Could it be an idea to list those as well, maybe a map showing what packages are needed for each --with/--enable option?

Here are all the packages I needed to build with almost all features/options enabled on Ubuntu 20.04.2 LTS:

liblog-agent-perl lcov systemtap-sdt-dev llvm clang pkg-config libicu-dev libxml2-dev liblz4-dev libreadline-dev bison flex python-is-python3 zlib1g-dev libkrb5-dev libssl-dev libgss-dev libpam0g-dev libxslt1-dev libldap2-dev libsystemd-dev gettext tcl tcl-dev libperl-dev libpython3.8-dev libipc-run-perl dbtoepub fop libxml2-utils xsltproc libterm-table-perl libterm-readkey-perl libterm-size-any-perl

This list was derived using a little tool [1] I created for the specific purpose of finding suitable -dev Ubuntu packages to build any project, instead of having to download and compile all such dependencies manually.

If we think such a map between --with/--enable option and package(s), I volunteer to put together such a list, to be included in the Wiki.


Kind regards,

Joel

Re: https://wiki.postgresql.org/wiki/Compile_and_Install_from_source_code

From
Peter Eisentraut
Date:
On 09.05.21 11:37, Joel Jacobson wrote:
> Could it be an idea to list those as well, maybe a map showing what 
> packages are needed for each --with/--enable option?
> 
> Here are all the packages I needed to build with almost all 
> features/options enabled on Ubuntu 20.04.2 LTS:
> 
> liblog-agent-perl lcov systemtap-sdt-dev llvm clang pkg-config 
> libicu-dev libxml2-dev liblz4-dev libreadline-dev bison flex 
> python-is-python3 zlib1g-dev libkrb5-dev libssl-dev libgss-dev 
> libpam0g-dev libxslt1-dev libldap2-dev libsystemd-dev gettext tcl 
> tcl-dev libperl-dev libpython3.8-dev libipc-run-perl dbtoepub fop 
> libxml2-utils xsltproc libterm-table-perl libterm-readkey-perl 
> libterm-size-any-perl
> 
> This list was derived using a little tool [1] I created for the specific 
> purpose of finding suitable -dev Ubuntu packages to build any project, 
> instead of having to download and compile all such dependencies manually.

Another option would be to look at what the Debian/Ubuntu packages have 
for build dependencies.  That list is more likely to be up to date, and 
tuned and trimmed to policy.  (For example, listing "libpython3.8-dev" 
will probably get out of date soon; there might be a better way to write 
that in a more timeless way.)

In general, this would be useful, though.  I don't know what half the 
Perl modules you list are for, for example.




Re: https://wiki.postgresql.org/wiki/Compile_and_Install_from_source_code

From
Andres Freund
Date:
On 2021-05-11 17:04:57 +0200, Peter Eisentraut wrote:
> Another option would be to look at what the Debian/Ubuntu packages have for
> build dependencies.  That list is more likely to be up to date, and tuned
> and trimmed to policy.  (For example, listing "libpython3.8-dev" will
> probably get out of date soon; there might be a better way to write that in
> a more timeless way.)

Yea, I typically just do an 'apt-get build-dep postgresql' to get ready
for building PG on a system. Especially handy for the docs tooling.



Re: https://wiki.postgresql.org/wiki/Compile_and_Install_from_source_code

From
Alvaro Herrera
Date:
On 2021-May-09, Joel Jacobson wrote:

> liblog-agent-perl lcov systemtap-sdt-dev llvm clang pkg-config libicu-dev libxml2-dev liblz4-dev libreadline-dev
bisonflex python-is-python3 zlib1g-dev libkrb5-dev libssl-dev libgss-dev libpam0g-dev libxslt1-dev libldap2-dev
libsystemd-devgettext tcl tcl-dev libperl-dev libpython3.8-dev libipc-run-perl dbtoepub fop libxml2-utils xsltproc
libterm-table-perllibterm-readkey-perl libterm-size-any-perl
 

BTW, what did you need "fop" for?


-- 
Álvaro Herrera                            39°49'30"S 73°17'W
"Puedes vivir sólo una vez, pero si lo haces bien, una vez es suficiente"



Re: https://wiki.postgresql.org/wiki/Compile_and_Install_from_source_code

From
Alvaro Herrera
Date:
On 2021-May-14, Alvaro Herrera wrote:

> On 2021-May-09, Joel Jacobson wrote:
> 
> > liblog-agent-perl lcov systemtap-sdt-dev llvm clang pkg-config libicu-dev libxml2-dev liblz4-dev libreadline-dev
bisonflex python-is-python3 zlib1g-dev libkrb5-dev libssl-dev libgss-dev libpam0g-dev libxslt1-dev libldap2-dev
libsystemd-devgettext tcl tcl-dev libperl-dev libpython3.8-dev libipc-run-perl dbtoepub fop libxml2-utils xsltproc
libterm-table-perllibterm-readkey-perl libterm-size-any-perl
 
> 
> BTW, what did you need "fop" for?

Ah, it's for generating the PDF. Nevermind ...

-- 
Álvaro Herrera       Valdivia, Chile
"La conclusión que podemos sacar de esos estudios es que
no podemos sacar ninguna conclusión de ellos" (Tanenbaum)



Re: https://wiki.postgresql.org/wiki/Compile_and_Install_from_source_code

From
"Joel Jacobson"
Date:
On Wed, May 12, 2021, at 22:33, Andres Freund wrote:
On 2021-05-11 17:04:57 +0200, Peter Eisentraut wrote:
> Another option would be to look at what the Debian/Ubuntu packages have for
> build dependencies.  That list is more likely to be up to date, and tuned
> and trimmed to policy.  (For example, listing "libpython3.8-dev" will
> probably get out of date soon; there might be a better way to write that in
> a more timeless way.)

Yea, I typically just do an 'apt-get build-dep postgresql' to get ready
for building PG on a system. Especially handy for the docs tooling.


Thanks for the advise on using 'apt-get build-dep postgresql'.

I added a "deb-src" line in /etc/apt/sources.list.d/pgdg.list:

I then ran 'sudo apt-get update'

However, there still seems to be a long list of missing packages, required to compile PostgreSQL with all features enabled:

/configure --prefix="$HOME/pg-head" --enable-nls --with-perl --with-python --with-tcl --with-icu --with-llvm --with-ssl=openssl --with-gssapi --with-ldap --with-pam --with-systemd --with-libxml --with-libxslt --with-lz4 --with-pgport=54321 --enable-debug --enable-cassert --enable-tap-tests --enable-depend --enable-coverage --enable-profiling --enable-dtrace

For instance, lcov, systemtap-sdt-dev, clang, pkg-config libicu-dev liblz4-dev, just to name a few.

Am I doing something wrong? Perhaps I should use a different deb-src url?

If not, and if packages are really missing, then maybe the could be added to the build-dep,
or if we don't want to include all such packages since one might want to build without the additional options,
then what about adding a table to the Wiki that shows what packages are needed for each --with/--enable option?
If we like that idea, I can put together such a table, or if you have other ideas on how to improve the situation, I'm happy to implement any solution you think is feasible.

/Joel