Bug 210453

Summary: databases/postgis22: compile error: unknown type name 'LWORD'
Product: Ports & Packages Reporter: O. Hartmann <ohartmann>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed Not Enough Information    
Severity: Affects Many People CC: rhurlin, robert.kruus
Priority: --- Flags: bugzilla: maintainer-feedback? (rhurlin)
Version: Latest   
Hardware: Any   
OS: Any   

Description O. Hartmann 2016-06-22 06:12:52 UTC
On recent CURRENT (11.0-ALPHA4 FreeBSD 11.0-ALPHA4 #3 r302024: Mon Jun 20 07:22:02 CEST 2016 amd64), port databases/postgis22 fails to compile due to shown error:

[...]
---- Making all in libpgcommon
gmake[4]: Entering directory '/usr/ports/databases/postgis22/work/postgis-2.2.2/libpgcommon'
cc -O2 -pipe -O3 -march=native  -I/usr/local/include -fstack-protector -fno-strict-aliasing -I../liblwgeom -I/usr/local/include/postgresql/server   -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o gserialized_gist.o gserialized_gist.c
cc -O2 -pipe -O3 -march=native  -I/usr/local/include -fstack-protector -fno-strict-aliasing -I../liblwgeom -I/usr/local/include/postgresql/server   -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwgeom_transform.o lwgeom_transform.c
In file included from lwgeom_transform.c:27:
In file included from ./lwgeom_cache.h:19:
../liblwgeom/liblwgeom_internal.h:157:45: error: unknown type name 'LWORD'
void ptarray_swap_ordinates(POINTARRAY *pa, LWORD o1, LWORD o2);
                                            ^
../liblwgeom/liblwgeom_internal.h:157:55: error: unknown type name 'LWORD'
void ptarray_swap_ordinates(POINTARRAY *pa, LWORD o1, LWORD o2);
                                                      ^
../liblwgeom/liblwgeom_internal.h:441:8: error: unknown type name 'lwinterrupt_callback'
extern lwinterrupt_callback *_lwgeom_interrupt_callback;
       ^
3 errors generated.
Comment 1 O. Hartmann 2016-06-22 07:45:23 UTC
The problem occurs as long databases/postgis21 is installed. Deleting that specific port first, solve the problem. Updating/replacing databases/postgis21 via

portmaster -o databases/postgis22 databases/postgis21 results in the reported error.

I'm not sure wether the "updating" or "migration" via the above shown command is correct, so I close the PR.
Comment 2 Robert Kruus 2016-07-18 16:05:06 UTC
The problem is due to the order of the includes in the compile statement:

cc -O2 -pipe -O3 -march=native  -I/usr/local/include -fstack-protector -fno-strict-aliasing -I../liblwgeom -I/usr/local/include/postgresql/server   -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o gserialized_gist.o gserialized_gist.c

moving the "-I/usr/local/include" to after the "-I../liblwgeom" in the compile fixes the issue as it will use the newer header files.

cc -O2 -pipe -O3 -march=native   -fstack-protector -fno-strict-aliasing -I../liblwgeom -I/usr/local/include/postgresql/server -I/usr/local/include  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o gserialized_gist.o gserialized_gist.c

The fix would be to patch the Makefile in appropriate directory.

Might try to kludge an example fix together.
Comment 3 Rainer Hurling freebsd_committer freebsd_triage 2016-07-18 16:48:25 UTC
(In reply to Robert Kruus from comment #2)
Thanks for your analysis and suggestion.

I was just preparing exactly the same patch, you published in bug #211203. Is there any reason, to not append that patch to this one (no 210453)?

Some short test of the patched databases/postgis22 did no show me any misbehaviour. So probably, the patch should be ok?