#3604 closed defect (fixed)
pgcommon/Makefile.in orders CFLAGS incorrectly leading to wrong liblwgeom.h
Reported by: | gdt | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.2.3 |
Component: | build | Version: | master |
Keywords: | Cc: |
Description
In both libpgcommon and postgis, CFLAGS end up with -I of system libraries before -I../liblwgeom. This causes the installed version of liblwgeom.h to be picked up, instead of the version from the postgis sources, resulting in a build failure.
I have observed the problem on NetBSD 6, and it has also been reported on FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211203
The workaround is to remove the installed version.
To fix, adjust CFLAGS/CPPFLAGS so that -I../liblwgeom is before includes of any directory that might have an installed version of postgis (e.g. -I/usr/pkg/include on NetBSD).
Attachments (1)
Change History (11)
by , 8 years ago
Attachment: | avoid-installed.patch added |
---|
comment:1 by , 8 years ago
Component: | postgis → build/upgrade/install |
---|---|
Owner: | changed from | to
comment:2 by , 8 years ago
This is harder than it seems. In addition to putting liblwgeom first, pgxs.mk has -I/usr/pkg/include (on pkgsrc systems) in CFLAGS, which is before CPPFLAGS. So the patch also moves the liblwgeom include to CFLAGS via an override. Needs review/discussion.
comment:3 by , 8 years ago
strk have any input on this. I could just try it and see if it breaks my build and the bot builds.
comment:6 by , 8 years ago
Milestone: | PostGIS 2.3.0 → PostGIS 2.2.3 |
---|
I was having this issue on FreeBSD because I think the postgis 2.3 liblwgeom I just installed was trying to be used by the 2.2 I was trying to compile.
The error looked like this:
rtpg_geometry.c:105:42: error: too many arguments to function call, expected 2, have 3 gser = gserialized_from_lwgeom(geom, 0, &gser_size); ~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~ /usr/local/include/liblwgeom.h:1957:1: note: 'gserialized_from_lwgeom' declared here extern GSERIALIZED* gserialized_from_lwgeom(LWGEOM *geom, size_t *size); ^ rtpg_geometry.c:184:42: error: too many arguments to function call, expected 2, have 3 gser = gserialized_from_lwgeom(geom, 0, &gser_size); ~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~ /usr/local/include/liblwgeom.h:1957:1: note: 'gserialized_from_lwgeom' declared here extern GSERIALIZED* gserialized_from_lwgeom(LWGEOM *geom, size_t *size); ^ rtpg_geometry.c:326:81: error: too many arguments to function call, expected 2, have 3 gser = gserialized_from_lwgeom(lwpoly_as_lwgeom(geomval2[call_cntr].geom), 0, &gser_size); ~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~ /usr/local/include/liblwgeom.h:1957:1: note: 'gserialized_from_lwgeom' declared here extern GSERIALIZED* gserialized_from_lwgeom(LWGEOM *geom, size_t *size); ^ rtpg_geometry.c:628:59: error: too many arguments to function call, expected 2, have 3 gser = gserialized_from_lwgeom(pix2[call_cntr].geom, 0, &gser_size); ~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~ /usr/local/include/liblwgeom.h:1957:1: note: 'gserialized_from_lwgeom' declared here extern GSERIALIZED* gserialized_from_lwgeom(LWGEOM *geom, size_t *size); ^ 4 errors generated. gmake[3]: *** [<builtin>: rtpg_geometry.o] Error 1 gmake[3]: Leaving directory '/usr/home/robe/sources/postgis-2.2.2/raster/rt_pg' gmake[2]: *** [Makefile:28: pglib] Error 2 gmake[2]: Leaving directory '/usr/home/robe/sources/postgis-2.2.2/raster' gmake[1]: *** [GNUmakefile:16: all] Error 1 gmake[1]: Leaving directory '/usr/home/robe/sources/postgis-2.2.2' *** Error code 2
This patch fixed the issue after I committed to 2.2, thanks Greg.
comment:7 by , 7 years ago
I guess it would be too much to hope that you're also the pgSQl packager and could move that -I/usr/pkg/include to CPPFLAGS where it belongs? The result of this change is that the postgis build loses all the flags it should be inheriting from the pgsql build. (The one that gets me is the loss of the -g debug flag, but I'm sure there's others of import).
comment:10 by , 7 years ago
No, I am not the pgsql packager. Generally we try to minimally munge upstreams, but I see your point about -I belonging in CPPFLAGS.
I think the real difficulty is making sure includes of files that are in the source tree find those rather than the previous installed version. But perhaps this can be avoided - I'll have a look when I have a chance.
patch to avoid installed liblwgeom/ includes