Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#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:1 by tbussmann, 2 years ago

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

Last edited 2 years ago by tbussmann (previous) (diff)

comment:2 by strk, 2 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 robe, 2 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:4 by Regina Obe <lr@…>, 2 years ago

In 4053205/git:

Patches from Tobias Bussmann
References #5090 for PostGIS 3.3.0
Closes https://github.com/postgis/postgis/pull/662, Closes
https://github.com/postgis/postgis/pull/663atches from Tobias Bussmann
References #5090 for PostGIS 3.3.0
Closes https://github.com/postgis/postgis/pull/662, Closes https://github.com/postgis/postgis/pull/663

comment:5 by Regina Obe <lr@…>, 2 years ago

Resolution: fixed
Status: newclosed

In ecad675/git:

Closes #5090 for PostGIS 3.2.1
Closes #5091 for PostGIS 3.2.1
Fix —with-protobuf-lib / —with-protobufdir broken
References https://github.com/postgis/postgis/pull/662
References https://github.com/postgis/postgis/pull/663

comment:6 by tbussmann, 2 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 your protobuf-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 your pkgconfig 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 your pkgconfig 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)
Note: See TracTickets for help on using tickets.