Opened 2 years ago

Closed 18 months ago

Last modified 17 months ago

#5177 closed enhancement (fixed)

Can't build commandline tools only and --without-pgconfig seems broken

Reported by: robe Owned by: strk
Priority: medium Milestone: PostGIS 3.4.0
Component: postgis Version: master
Keywords: Cc:

Description (last modified by robe)

I thought we had solved this problem already, but it seems not.

I tried building the command-line tools on a CentOS, thinking I could do it with.

export PKG_CONFIG_PATH="/projects/rel/lib/pkgconfig"
export PATH="/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/projects/rel/lib:/projects/rel/bin:/projects/rel/include"

./configure --prefix=/projects/rel \
  --with-geosconfig=/projects/rel/bin/geos-config \
  --without-pgconfig --without-protobuf \
  --with-libiconv=/projects/rel

What happens with the above, even though I have GDAL installed in /projects/rel

I still get error:

configure: WARNING: gdal.h: present but cannot be compiled
configure: WARNING: gdal.h:     check for missing prerequisite headers?
configure: WARNING: gdal.h: see the Autoconf documentation
configure: WARNING: gdal.h:     section "Present But Cannot Be Compiled"
configure: WARNING: gdal.h: proceeding with the compiler's result
checking for gdal.h... no
configure: error: could not find GDAL headers

If I do

configure: WARNING: gdal.h: present but cannot be compiled
configure: WARNING: gdal.h:     check for missing prerequisite headers?
configure: WARNING: gdal.h: see the Autoconf documentation
configure: WARNING: gdal.h:     section "Present But Cannot Be Compiled"
configure: WARNING: gdal.h: proceeding with the compiler's result
checking for gdal.h... no
configure: error: could not find GDAL headers

If I do,

export PKG_CONFIG_PATH="/projects/rel/lib/pkgconfig"
export PATH="/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/projects/rel/lib:/projects/rel/bin:/projects/rel/include"

./configure --prefix=/projects/rel \
  --with-geosconfig=/projects/rel/bin/geos-config \
  --without-pgconfig --without-protobuf \
  --with-libiconv=/projects/rel \
  --without-raster

Then configure succeeds, and even make completes with:

/usr/bin/ar: creating .libs/liblwgeom.a
libtool: link: gcc-ranlib .libs/liblwgeom.a
libtool: link: rm -fr .libs/liblwgeom.lax
libtool: link: ( cd ".libs" && rm -f "liblwgeom.la" && ln -s "../liblwgeom.la" "liblwgeom.la" )

but make install just outputs

 make install
for s in liblwgeom; do \
        echo "---- Making install in ${s}"; \
        make -C ${s} install || exit 1; \
done;

I would have assumed the shp2pgsql would get installed in the —prefix folder, (pgsql2shp would get installed only if I have libpq dev), but no nothing. Even building with below the —prefix is ignored and all by commandline tools end up in /projects/rel/pg14/bin

export PKG_CONFIG_PATH="/projects/rel/lib/pkgconfig"
export PATH="/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/projects/rel/lib:/projects/rel/bin:/projects/rel/include"
export PGPATH=/projects/rel/pg14

./configure --prefix=/projects/rel --without-protobuf --with-pgconfig=${PGPATH}/bin/pg_config \
  --with-geosconfig=/projects/rel/bin/geos-config \
  --with-libiconv=/projects/rel

make && make install

What I am expecting, is that since shp2pgsql and raster2pgsql do not have ANY dependency on PostgreSQL or libpq for that matter, I should be able to get those built with below and they should be installed in —prefix=/projects/rel/bin

./configure --prefix=/projects/rel --without-protobuf \
  --with-geosconfig=/projects/rel/bin/geos-config \
  --without-pgconfig --without-protobuf \
  --with-libiconv=/projects/rel \
  --without-raster

make && make install

I thought this used to work, but perhaps was broken after our numerous changes to liblwgeom config

I'm going to try older versions to see

Change History (11)

comment:1 by robe, 2 years ago

Summary: Can't build commandline tools only and =-without-pgconfig seems brokenCan't build commandline tools only and --without-pgconfig seems broken

comment:2 by robe, 2 years ago

Description: modified (diff)

comment:3 by robe, 2 years ago

Description: modified (diff)

comment:4 by robe, 2 years ago

Milestone: PostGIS 3.3.0PostGIS 3.4.0

comment:5 by strk, 18 months ago

There are many uses of pg_config in the current configure.ac script: to set WAGYU_CXX ( [f4cdc57bc7099f8ffa63f065aff3d665228c5a78/git] ), to set FLATGEOBUF_CXX ( [3ae2c584400b6a04c59f70b0ca28e6a63331d9e1/git] ), to set GDAL test compile flags ( [7d3e4f0ef0c59f0acc4e243edeed02032b7ff52d/git] ).

Commit logs suggest the aim was to use the same compiler for multiple components, but then I don't know why different variables are then used for different components.

Unconditional use of PG_CONFIG results in ./configure warnings when —without-pgconfig is used, and corresponding components result as being unbuildable. Disabling the components is a viable solution as you found, but the flatgeobuf support cannot currently be set to off by a configure switch.

As for building commandlines, I don't see that working even in old branches either. I've tried as back as 3.0. We can do something for 3.4.0 I guess.

Passing --without-pgconfig --without-raster --disable-nls to configure allows to explicitly build shp2pgsql from loader/ dir: make -C loader shp2pgsql but an install target is still missing for that specific tool

comment:6 by strk, 18 months ago

I've fixed the build, check, install and uninstall targets for the loader/ tools and enabled woodie keeping an eye on them. See https://git.osgeo.org/gitea/postgis/postgis/pulls/126

I guess next step should be dealing with the raster loader.

comment:7 by Sandro Santilli <strk@…>, 18 months ago

Resolution: fixed
Status: newclosed

In 9ec3f4b/git:

Allow building commandline tools without PostgreSQL

Closes #5177
Have woodie guard after this

comment:8 by robe, 18 months ago

Resolution: fixed
Status: closedreopened

need NEWS

comment:9 by robe, 18 months ago

Owner: changed from pramsey to strk
Status: reopenednew

comment:10 by Sandro Santilli <strk@…>, 18 months ago

Resolution: fixed
Status: newclosed

In 653d83c/git:

Add NEWS entry for tools building support

Closes #5177 again

comment:11 by robe, 17 months ago

Type: defectenhancement
Note: See TracTickets for help on using tickets.