Opened 4 months ago

Closed 3 months ago

#5764 closed defect (fixed)

PostGIS make install fails when building against meson-built PostgreSQL

Reported by: robe Owned by: strk
Priority: medium Milestone: PostGIS 3.4.3
Component: install Version: 3.4.x
Keywords: Cc:

Description (last modified by robe)

These could be specific to how I configured meson on each system.

On debbie, I built PostgreSQL 17 with this:

export PG_VER=17
export OS_BUILD=64
cd pg17git
rm -rf ../meson-pg${PG_VER}-build
meson setup ../meson-pg${PG_VER}-build && cd ../meson-pg${PG_VER}-build
meson configure -Dcassert=true --prefix=${WORKSPACE}/rel/pg${PG_VER}w${OS_BUILD}
meson compile
rm -rf ${WORKSPACE}/rel/pg${PG_VER}w${OS_BUILD}
meson install

My autoconf build works fine regressing against postgis master branch, however this meson build one fails at loader tests:

https://debbie.postgis.net/job/PostGIS_Regress/30767/consoleFull

01:31:47   PostGIS is now configured for x86_64-pc-linux-gnu
01:31:47 
01:31:47  -------------- Compiler Info ------------- 
01:31:47   C compiler:           gcc -std=gnu99 -g -O2 -fno-math-errno -fno-signed-zeros -Wall -O2
01:31:47   C++ compiler (Wagyu): cc -std=c++11 -x c++ 
01:31:47   C++ compiler (FlatGeobuf): cc -std=c++11 -x c++ 
01:31:47   CPPFLAGS:              -I/var/lib/jenkins/workspace/geos/rel-3.13w64/include   -I/usr/include/libxml2 -I/usr/include -I/usr/include/json-c  -DNDEBUG 
01:31:47   LDFLAGS:               -lm
01:31:47   SQL preprocessor:     /usr/bin/cpp -traditional-cpp -w -P -Upixel -Ubool
01:31:47   Archiver:             gcc-ar rs
01:31:47 
01:31:47  -------------- Additional Info ------------- 
01:31:47   POSTGIS lib file includes minor:   ENABLED
01:31:47   Interrupt Tests:   ENABLED
01:31:47 
01:31:47  -------------- Dependencies -------------- 
01:31:47   GEOS config:          /var/lib/jenkins/workspace/geos/rel-3.13w64/bin/geos-config
01:31:47   GEOS version:         3.13.0dev (31300)
01:31:47   GDAL config:          /var/lib/jenkins/workspace/gdal/rel-3.4w64/bin/gdal-config
01:31:47   GDAL version:         3.4.3
01:31:47   SFCGAL config:        /usr/bin/sfcgal-config
01:31:47   SFCGAL version:       1.3.8
01:31:47   PostgreSQL config:    /var/lib/jenkins/workspace/pg/rel/pg17w64/bin/pg_config
01:31:47   PostgreSQL version:   PostgreSQL 17beta2
01:31:47   PROJ version:         7.2.1 (70201)
01:31:47   Libxml2 config:       /usr/bin/xml2-config
01:31:47   Libxml2 version:      2.9.14
01:31:47   JSON-C support:       yes
01:31:47   protobuf support:     yes
01:31:47   protobuf-c version:   1003003
01:31:47   PCRE support:         not found
01:31:47   Perl:                 /usr/bin/perl
01:31:47 
01:31:47  --------------- Extensions --------------- 
01:31:47   PostgreSQL EXTENSION support:       enabled
01:31:47   PostGIS Raster:                     enabled
01:31:47   PostGIS Topology:                   enabled
01:31:47   SFCGAL support:                     enabled
01:31:47   Address Standardizer support:       disabled

This error is for all loader and dumper tests

01:34:49  regress/loader/Point ........ failed (dumper geog test: dumping loaded table: /var/lib/jenkins/workspace/postgis/tmp/3_5_pg17w64/dumper.err)
01:34:49 -----------------------------------------------------------------------------
01:34:49 could not connect to server: No such file or directory
01:34:49 	Is the server running locally and accepting
01:34:49 	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.3617"?
01:34:49 
01:34:49 -----------------------------------------------------------------------------
01:34:49  regress/loader/PointM ........ failed (dumper geog test: dumping loaded table: /var/lib/jenkins/workspace/postgis/tmp/3_5_pg17w64/dumper.err)
01:34:49 -----------------------------------------------------------------------------
01:34:49 could not connect to server: No such file or directory
01:34:49 	Is the server running locally and accepting
01:34:49 	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.3617"?
01:34:49

:
01:34:56  regress/dumper/mfiledmp .. failed (dumping: /var/lib/jenkins/workspace/postgis/tmp/3_5_pg17w64/dumper-mfiledmp.err)
01:34:56 -----------------------------------------------------------------------------
01:34:56 could not connect to server: No such file or directory
01:34:56 	Is the server running locally and accepting
01:34:56 	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.3617"?

On my windows new chain I have configured with meson, autoconf again works more or less okay(there are some regress failures but more to do with my new chain), however meson build completely falls on its face out of the gate and fails to install the extensions. strk thinks it's something with sed or grep, perhaps the use of PGXS is messing with it.

mkdir -p 'C:/ming64/projects/POSTGR~1/rel/pg17w64/share/contrib/postgis-3.5'
/bin/sh C:/ming64/projects/POSTGR~1/rel/pg17w64/lib/pgxs/src/MAKEFI~1/../../config/install-sh -c -m 644  postgis_comments.sql raster_comments.sql topology_comments.sql sfcgal_comments.sql 'C:/ming64/projects/POSTGR~1/rel/pg17w64/share/contrib/postgis-3.5/'
make[2]: Leaving directory '/projects/postgis/postgis-git/doc'
mkdir -p /projects/postgis/liblwgeom-3.5w64/share/man/man1
for f in man/shp2pgsql.1 man/pgsql2shp.1 man/pgtopo_export.1 man/pgtopo_import.1 man/postgis.1 man/postgis_restore.1; do \
        /usr/bin/install -c -m 644 $f /projects/postgis/liblwgeom-3.5w64/share/man/man1/`basename $f`; \
done
make[1]: Leaving directory '/projects/postgis/postgis-git/doc'
---- Making install in extensions
make[1]: Entering directory '/projects/postgis/postgis-git/extensions'
for DIR in postgis postgis_tiger_geocoder postgis_topology postgis_sfcgal; do \
        echo "---- Making install in ${DIR}"; \
        make -C "${DIR}" install || exit 1; \
done
---- Making install in postgis
make[2]: Entering directory '/projects/postgis/postgis-git/extensions/postgis'
mkdir -p 'C:/ming64/projects/POSTGR~1/rel/pg17w64/share/extension'
mkdir -p 'C:/ming64/projects/POSTGR~1/rel/pg17w64/share/extension'
mkdir -p "C:/ming64/projects/POSTGR~1/rel/pg17w64/share/extension"
/bin/sh ../../config/install-sh -c -m 644 "sql/postgis--ANY--3.5.0dev.sql" "C:/ming64/projects/POSTGR~1/rel/pg17w64/share/extension/postgis--ANY--3.5.0dev.sql"
/bin/sh: ../../config/install-sh: No such file or directory
make[2]: *** [../upgrade-paths-rules.mk:26: install-upgrade-paths] Error 127
make[2]: Leaving directory '/projects/postgis/postgis-git/extensions/postgis'
make[1]: *** [Makefile:36: install] Error 1
make[1]: Leaving directory '/projects/postgis/postgis-git/extensions'
make: *** [GNUmakefile:27: install] Error 1

Change History (12)

comment:1 by robe, 4 months ago

Description: modified (diff)

comment:2 by robe, 4 months ago

Okay I think I made progress on the debbie front.

Added to the PostGRIS_REGRESS of debbie jenkins job

export PGHOST=localhost

and that seemed to do the trick to get loader regress working.

However install fails with the same issue that my windows is having. I guess I always test after installing so assumed the issues were the different. I'm going to run my tests without installing to see if my loader stuff works okay.

01:00:17 ---- Making install in postgis
01:00:17 make[2]: Entering directory '/var/lib/jenkins/workspace/postgis/branches/3.5/extensions/postgis'
01:00:17 /bin/mkdir -p '/var/lib/jenkins/workspace/pg/rel/pg17w64/share/postgresql/extension'
01:00:17 /bin/mkdir -p '/var/lib/jenkins/workspace/pg/rel/pg17w64/share/postgresql/extension'
01:00:17 mkdir -p "/var/lib/jenkins/workspace/pg/rel/pg17w64/share/postgresql/extension"
01:00:17 /bin/sh ../../config/install-sh -c -m 644 "sql/postgis--ANY--3.5.0dev.sql" "/var/lib/jenkins/workspace/pg/rel/pg17w64/share/postgresql/extension/postgis--ANY--3.5.0dev.sql"
01:00:17 /bin/sh: 0: cannot open ../../config/install-sh: No such file
01:00:17 make[2]: *** [../upgrade-paths-rules.mk:26: install-upgrade-paths] Error 2
01:00:17 make[2]: Leaving directory '/var/lib/jenkins/workspace/postgis/branches/3.5/extensions/postgis'
01:00:17 make[1]: *** [Makefile:36: install] Error 1
01:00:17 make[1]: Leaving directory '/var/lib/jenkins/workspace/postgis/branches/3.5/extensions'
01:00:17 make: *** [GNUmakefile:27: install] Error 1
01:00:17 Build step 'Execute shell' marked build as failure
01:00:17 [Gitea] do not publish assets due to build being non-Successfully
01:00:17 Triggering a new build of PostgreSQL stop
01:00:17 Finished: FAILURE
Last edited 4 months ago by robe (previous) (diff)

comment:3 by robe, 4 months ago

okay winnie mostly regresses if I don't try to do make install, with some errors which I think are issues with my new chain rather than issue with meson.

comment:4 by robe, 4 months ago

Summary: PostGIS regress issues when building PostgreSQL with mesonPostGIS make install fails when building against meson-built PostgreSQL

comment:5 by robe, 4 months ago

I'm wondering if this is a pathing issue.

One thing I noticed comparing debbie's postgresql autoconf build verses the postgresql meson built is that:

the autoconf build seems to use ../build-aux/install-sh

Where as the meson build uses var/lib/jenkins/workspace/pg/rel/pg17w64/lib/x86_64-linux-gnu/postgresql/pgxs/src/makefiles/../../config/install-sh

So the final make install for meson built fails cause it doesn't have pgxs any more trying to go by ../../config/install-sh which probably doesn't exist.

So I'm thinking this might work if doing an out of tree build. I'm dong in tree for both. Perhaps that is why packagers aren't complaining that they are doing all out of tree builds.

Will test out of tree next.

comment:6 by robe, 4 months ago

Okay just tried an out-of-tree build on my windows meson built postgresql and sadly that did not fix the issue

still the on make install get this

/bin/sh ../../../config/install-sh -c -m 644 "sql/postgis--ANY--3.5.0dev.sql" "C:/ming64/projects/POSTGR~1/rel/pg17w64/share/extension/postgis--ANY--3.5.0dev.sql"
/bin/sh: ../../../config/install-sh: No such file or directory
make[2]: *** [../../../extensions/postgis/../upgrade-paths-rules.mk:26: install-upgrade-paths] Error 127

This should be using the build-aux/install-sh but for some reason it is not

comment:7 by robe, 4 months ago

I think I narrowed it down to inherited from PGXS

INSTALL
INSTALL_DATA

Playing around with overriding these to see if I can get it to work for both autoconf and meson built postgresql.

There is a comment that we have PGXS to get these variables, which begs the question if we override these, do we need PGXS at all?

comment:8 by Regina Obe <lr@…>, 4 months ago

In 87a34bf2/git:

TRY TO FIX install of postgresql meson built

  • PGXS giving bad install / install_data so override

References #5764 for PostGIS 3.5.0

comment:9 by robe, 4 months ago

Yeh success, debbie's PG17 meson built just finished regressing.

@strk wants us to get rid of having to repeat the same lines in each extension make file. I think the cleanest way is to get rid of PGXS include entirely, however when I did that my meson build for some reason couldn't fine pe or link with lpgport etc. Might be something screwy with my build, so I'll save that for #5281 and close this out as soon as all bots are done regressing.

comment:10 by robe, 4 months ago

Milestone: PostGIS 3.5.0PostGIS 3.4.3

All still seems good, but I should probably backport to PostGIS 3.4.3 since I think Meson has been supported since PG16 and 3.4 probably has same issue.

comment:11 by robe, 3 months ago

Version: master3.4.x

This is interesting whatever change we did in 3.4 is what necessitates this fix. It seems the most recent run of debbie against her PG17 meson build, PostGIS 3.3 passed but PostGIS 3.4 (which I haven't patched yet) fails. That or we aren't testing make install on PostGIS 3.3

Last edited 3 months ago by robe (previous) (diff)

comment:12 by Regina Obe <lr@…>, 3 months ago

Resolution: fixed
Status: newclosed

In f81e686/git:

FIX install is when PostgreSQL is built with meson

  • PGXS giving bad install / install_data so override

Closes #5764 for PostGIS 3.4.3

Note: See TracTickets for help on using tickets.