#5090 closed defect (fixed)
configure --with-protobuf-lib / --with-protobufdir broken
Reported by: | tbussmann | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.2.1 |
Component: | build | Version: | master |
Keywords: | Cc: |
Description
Currently it is not possible to compile PostGIS with protobuf-c by specifying the path to the library using --with-protobuf-lib=
or --with-protobufdir=
, only if the installation can be found by pkg-config
it can be overridden by PROTOBUFC_LIBS
. Effectively, the -lprotobuf-c
is missing in LDFLAGS.
The first option broke by commit [6eeee128815/git] as an attempt to fix #4964. Part of this change broke building with pkg-config
as its output was now overwritten and thus the -L
went missing which resulted in #4977. That again was fixed by an attempt to roll back the first change by [86a8a5979/git]. Unfortunately that finally broke --with-protobufdir
and resulted in the current situation.
To fix, we need to add -lprotobuf-c
back to line source:git/configure.ac@98c1ed85#L1031 and source:git/configure.ac@98c1ed85#L1043.
For the original issue, #4964 I can imagine to further develop the idea from the first attempt but guard that a bit by replacing source:git/configure.ac@98c1ed85#L1062 with something like that:
[if test "x$PROTOBUF_LDFLAGS" = "x"; then PROTOBUF_LDFLAGS="-lprotobuf-c" fi],
Change History (6)
comment:2 by , 3 years ago
tbussmann: you can file pull requests on the official repository ( https://git.osgeo.org/gitea/postgis/postgis ) or on any of the mirrors (github included, so your PR is ok)
It would be nice to add CI checking for corner cases, we love having more bots
comment:3 by , 3 years ago
I'm going to give your pull request on my local and accept if it doesn't break my build. Unfortunately I'm not sure how to test this corner case.
comment:6 by , 3 years ago
thanks for applying the patches!
Unfortunately I'm not sure how to test this corner case.
Something among the following may work:
- configure postgis with the
--with-protobufdir
or--with-protobuf-lib
/--with-protobuf-inc
set to yourprotobuf-c
installation - without the first patch, the configure will be successful but the build will fail.
- apply the first patch, repeat configure, verify that it now builds
For the second patch (original intention of #4964):
- remove the
libprotobuf-c.pc
from yourpkgconfig
directory - make sure the
protobuf-c
library can be found in your default lib / include paths - configure postgis w/o any protbuf related parameters.
- without the second patch, the configure will be successful but the build will fail.
- apply the second patch, repeat configure, verify that it now builds
Make sure this does not interfere with pkg-config builds (#4977)
- move the
libprotobuf-c.pc
file back to yourpkgconfig
directory - configure postgis w/o any protbuf related parameters.
- with the patches applied, configure and build should still be successful (I think, that was already verified by the CI)
as I haven't contributed before - would it be preferred to send a .patch or raise a pull request on GitHub for issues like this? Edit: I've looked around a bit and it seems GitHub is a usual way these days. Unfortunately, the nice CI integration will likely not cover this corner case. Here are my Pull Requests: https://github.com/postgis/postgis/pull/662 and https://github.com/postgis/postgis/pull/663