Thread: lib and share are installed differently, but why?

lib and share are installed differently, but why?

From
Mario Emmenlauer
Date:
Dear All,

I've been building and using PostgreSQL from source for a few years
now, thanks for the awesome work!

Since upgrading from 12.5 to 12.8, I've found a problem that I can
not resolve myself. We build PostgreSQL twice, once to folder A, and
once to folder B. This is because A is more easily deployable, while
B holds all our development build targets. The only difference in
the two builds is the change in `--prefix` for configure. Everything
else is identical, and both builds start from a clean directory.

But I see a difference in the installations:
 - The contents of `share` go to A/share/ vs B/share/postgresql/
 - The contents of `lib` go to B/lib vs B/lib/postgresql/

I've played with all sorts of --libdir, --datarootdir and the like,
but the behaviour stays the same. I fail to understand why in the
case of --prefix=B (the target where we host a lot of other stuff),
the install will use subdirectory 'postgresql', whereas for the
--prefix=A (which is an empty directory) the install will not use
a subdirectory.

Whats more, when I try to run the server in A, initdb will complain
that the file in A/share/postgresql/postgresql.bki is missing, which
indeed is true (because the file is at A/share/postgresql.bki).

Any help would be appreciated!

All the best,

    Mario Emmenlauer


--
BioDataAnalysis GmbH, Mario Emmenlauer      Tel. Buero: +49-89-74677203
Balanstr. 43                   mailto: memmenlauer * biodataanalysis.de
D-81669 München                          http://www.biodataanalysis.de/



Re: lib and share are installed differently, but why?

From
Adrian Klaver
Date:
On 8/30/21 3:53 AM, Mario Emmenlauer wrote:
> 
> Dear All,
> 
> I've been building and using PostgreSQL from source for a few years
> now, thanks for the awesome work!
> 
> Since upgrading from 12.5 to 12.8, I've found a problem that I can
> not resolve myself. We build PostgreSQL twice, once to folder A, and
> once to folder B. This is because A is more easily deployable, while
> B holds all our development build targets. The only difference in
> the two builds is the change in `--prefix` for configure. Everything
> else is identical, and both builds start from a clean directory.

What are the complete config commands for each build?

Does clean directory refer to the build directory?

> 
> But I see a difference in the installations:
>   - The contents of `share` go to A/share/ vs B/share/postgresql/
>   - The contents of `lib` go to B/lib vs B/lib/postgresql/

Is that really B/lib or is it A/lib?

To me it looks like in the past a different configuration or install 
method was used and you now have a mixed install.

> 
> I've played with all sorts of --libdir, --datarootdir and the like,
> but the behaviour stays the same. I fail to understand why in the
> case of --prefix=B (the target where we host a lot of other stuff),
> the install will use subdirectory 'postgresql', whereas for the
> --prefix=A (which is an empty directory) the install will not use
> a subdirectory.
> 
> Whats more, when I try to run the server in A, initdb will complain
> that the file in A/share/postgresql/postgresql.bki is missing, which
> indeed is true (because the file is at A/share/postgresql.bki).
> 
> Any help would be appreciated!
> 
> All the best,
> 
>      Mario Emmenlauer
> 
> 
> --
> BioDataAnalysis GmbH, Mario Emmenlauer      Tel. Buero: +49-89-74677203
> Balanstr. 43                   mailto: memmenlauer * biodataanalysis.de
> D-81669 München                          http://www.biodataanalysis.de/
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: lib and share are installed differently, but why?

From
Tom Lane
Date:
Mario Emmenlauer <mario@emmenlauer.de> writes:
> I've been building and using PostgreSQL from source for a few years
> now, thanks for the awesome work!

> Since upgrading from 12.5 to 12.8, I've found a problem that I can
> not resolve myself. We build PostgreSQL twice, once to folder A, and
> once to folder B. This is because A is more easily deployable, while
> B holds all our development build targets. The only difference in
> the two builds is the change in `--prefix` for configure. Everything
> else is identical, and both builds start from a clean directory.

> But I see a difference in the installations:
>  - The contents of `share` go to A/share/ vs B/share/postgresql/
>  - The contents of `lib` go to B/lib vs B/lib/postgresql/

You didn't say exactly what "A" and "B" stand for, but I'll bet
that the string "A" includes "pgsql" or "postgres".  Makefile.global
makes some installation path changes when that's not true, e.g.

pkglibdir = $(libdir)
ifeq "$(findstring pgsql, $(pkglibdir))" ""
ifeq "$(findstring postgres, $(pkglibdir))" ""
override pkglibdir := $(pkglibdir)/postgresql
endif
endif

This behavior is pretty ancient; I'm quite sure it didn't change
between 12.5 and 12.8.  So I speculate that you made some change
in your build process that you didn't mention.

            regards, tom lane



Re: lib and share are installed differently, but why?

From
Mario Emmenlauer
Date:
On 30.08.21 16:24, Tom Lane wrote:
> Mario Emmenlauer <mario@emmenlauer.de> writes:
>> I've been building and using PostgreSQL from source for a few years
>> now, thanks for the awesome work!
> 
>> Since upgrading from 12.5 to 12.8, I've found a problem that I can
>> not resolve myself. We build PostgreSQL twice, once to folder A, and
>> once to folder B. This is because A is more easily deployable, while
>> B holds all our development build targets. The only difference in
>> the two builds is the change in `--prefix` for configure. Everything
>> else is identical, and both builds start from a clean directory.
> 
>> But I see a difference in the installations:
>>  - The contents of `share` go to A/share/ vs B/share/postgresql/
>>  - The contents of `lib` go to B/lib vs B/lib/postgresql/
> 
> You didn't say exactly what "A" and "B" stand for, but I'll bet
> that the string "A" includes "pgsql" or "postgres".  Makefile.global
> makes some installation path changes when that's not true, e.g.
> 
> pkglibdir = $(libdir)
> ifeq "$(findstring pgsql, $(pkglibdir))" ""
> ifeq "$(findstring postgres, $(pkglibdir))" ""
> override pkglibdir := $(pkglibdir)/postgresql
> endif
> endif

Ahhh! This is very likely what I am tripped over! Thanks a million!
Indeed my path A does *not* contain "postgres" while B is set to
"A/postgresql". This explains the difference in the install.


> This behavior is pretty ancient; I'm quite sure it didn't change
> between 12.5 and 12.8.  So I speculate that you made some change
> in your build process that you didn't mention.

I'm pretty sure there is no change in my build. But my provided
information may still be incorrect. What I can see is that since
postgres 12.8 I get the aforementioned error that the file
"A/share/postgresql/postgresql.bki" would be missing. I did not
get this error before, and therefore never investigated if the
folder layout was the same between A and B. So, as you say, it may
have been different since basically forever.

But a new thing seems to be this error.

After this find, I will change my build not to compile twice any
more. Therefore the issue is resolved for me!

But it may be good to keep this email for future reference, if
someone else trips over the problem of a missing "postgresql.bki".
Hint to this future person: does your install path contain the
strings "pgsql" or "postgres", then search in this area for the
error...

All the best, and thanks a lot,

    Mario Emmenlauer