Opened 3 years ago

Closed 3 years ago

Last modified 3 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, 3 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?

Version 0, edited 3 years ago by tbussmann (next)

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