Bug 207314

Summary: databases/postgis20, databases/postgis21 have compile error
Product: Ports & Packages Reporter: Vladyslav <vladka>
Component: Individual Port(s)Assignee: Po-Chuan Hsieh <sunpoet>
Status: Closed FIXED    
Severity: Affects Only Me CC: harrison.grundy, kcwu
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description Vladyslav 2016-02-18 20:32:23 UTC
$ cd /usr/posts/databases/postgis2.1 
$ make config && make 
....

cc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2 -pipe  -fstack-protector -fno-strict-aliasing -fPIC -DPIC -I../liblwgeom -I../libpgcommon  -I/usr/local/include  -I/usr/local/include/libxml2 -I/usr/include  -I/usr/local/include -fPIC -I. -I./ -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal -I/usr/local/include -I/usr/local/include  -c -o lwgeom_accum.o lwgeom_accum.c
lwgeom_accum.c:109:48: error: no member named 'aggcontext' in 'struct AggState'; did you mean 'aggcontexts'?
                aggcontext = ((AggState *) fcinfo->context)->aggcontext;


It can be fixed with a small fix:

109 -                 aggcontext = ((AggState *) fcinfo->context)->aggcontext;
109 +                 aggcontext = ((AggState *) fcinfo->context)->aggcontexts;



Thats it.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2016-02-19 04:43:11 UTC
Fix Summary.  Assign to maintainer of postgis20 who is a committer; but also notify maintainer of postgis21, who is not.
Comment 2 Po-Chuan Hsieh freebsd_committer freebsd_triage 2016-03-13 14:49:51 UTC
I cannot reproduce this problem. This 2 ports build fine on our cluster [1][2].

% grep aggcontext */src/include/nodes/execnodes.h
postgresql-8.4.22/src/include/nodes/execnodes.h:        MemoryContext aggcontext;       /* memory context for long-lived data */
postgresql-9.0.23/src/include/nodes/execnodes.h:        MemoryContext aggcontext;       /* memory context for long-lived data */
postgresql-9.0.23/src/include/nodes/execnodes.h:        MemoryContext aggcontext;       /* context for each aggregate data */
postgresql-9.1.20/src/include/nodes/execnodes.h:        MemoryContext aggcontext;       /* memory context for long-lived data */
postgresql-9.1.20/src/include/nodes/execnodes.h:        MemoryContext aggcontext;       /* context for each aggregate data */
postgresql-9.2.15/src/include/nodes/execnodes.h:        MemoryContext aggcontext;       /* memory context for long-lived data */
postgresql-9.2.15/src/include/nodes/execnodes.h:        MemoryContext aggcontext;       /* context for each aggregate data */
postgresql-9.3.11/src/include/nodes/execnodes.h:        MemoryContext aggcontext;       /* memory context for long-lived data */
postgresql-9.3.11/src/include/nodes/execnodes.h:        MemoryContext aggcontext;       /* context for each aggregate data */
postgresql-9.4.6/src/include/nodes/execnodes.h: MemoryContext aggcontext;       /* memory context for long-lived data */
postgresql-9.4.6/src/include/nodes/execnodes.h: MemoryContext aggcontext;       /* shared context for aggregate working data */
postgresql-9.4.6/src/include/nodes/execnodes.h: MemoryContext curaggcontext;    /* current aggregate's working data */
postgresql-9.5.1/src/include/nodes/execnodes.h: ExprContext **aggcontexts;      /* econtexts for long-lived data (per GS) */
postgresql-9.5.1/src/include/nodes/execnodes.h: MemoryContext aggcontext;       /* shared context for aggregate working data */
postgresql-9.5.1/src/include/nodes/execnodes.h: MemoryContext curaggcontext;    /* current aggregate's working data */

With your patch applied, I got the following error:

cc -O2 -pipe  -fstack-protector -fno-strict-aliasing -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -fPIC -DPIC -I../liblwgeom -I../libpgcommon  -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/include -I. -I. -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal -I/usr/local/include -I/usr/local/include  -c -o lwgeom_accum.o lwgeom_accum.c
lwgeom_accum.c:109:48: error: no member named 'aggcontexts' in 'struct AggState'; did you mean 'aggcontext'?
                aggcontext = ((AggState *) fcinfo->context)->aggcontexts;
                                                             ^~~~~~~~~~~
                                                             aggcontext
/usr/local/include/postgresql/server/nodes/execnodes.h:1694:16: note: 'aggcontext' declared here
        MemoryContext aggcontext;       /* memory context for long-lived data */
                      ^
1 error generated.

[1] http://portsmon.freebsd.org/portoverview.py?category=databases&portname=postgis20
[2] http://portsmon.freebsd.org/portoverview.py?category=databases&portname=postgis21
Comment 3 Vladyslav 2016-03-14 09:30:56 UTC
# root@globalogic:/usr/ports/databases/postgis21 # pwd
/usr/ports/databases/postgis21
# root@globalogic:/usr/ports/databases/postgis21 # uname -a
FreeBSD globalogic.us 10.2-RELEASE FreeBSD 10.2-RELEASE #0 r286666: Wed Aug 12 15:26:37 UTC 2015     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
# root@globalogic:/usr/ports/databases/postgis21 # cc --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd10.2
Thread model: posix
# make clean && make 
...
...
cc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2 -pipe  -fstack-protector -fno-strict-aliasing -fPIC -DPIC -I../liblwgeom -I../libpgcommon  -I/usr/local/include  -I/usr/local/include/libxml2 -I/usr/include  -I/usr/local/include -fPIC -I. -I./ -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal -I/usr/local/include -I/usr/local/include  -c -o lwgeom_accum.o lwgeom_accum.c
lwgeom_accum.c:109:48: error: no member named 'aggcontext' in 'struct AggState'; did you mean 'aggcontexts'?
                aggcontext = ((AggState *) fcinfo->context)->aggcontext;
                                                             ^~~~~~~~~~
                                                             aggcontexts
/usr/local/include/postgresql/server/nodes/execnodes.h:1842:16: note: 'aggcontexts' declared here
        ExprContext **aggcontexts;      /* econtexts for long-lived data (per GS) */


Hope screenshots will help: 
https://webdevelop.pro/media/postgis21_1.png
https://webdevelop.pro/media/postgis21_2.png
Comment 4 kcwu 2016-04-12 08:39:29 UTC
This is because postgresql changed AggState in 9.5.

https://github.com/postgres/postgres/commit/f3d3118532175541a9a96ed78881a3b04a057128
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-12-04 10:44:40 UTC
A commit references this bug:

Author: sunpoet
Date: Sun Dec  4 10:44:08 UTC 2016
New revision: 427767
URL: https://svnweb.freebsd.org/changeset/ports/427767

Log:
  - Fix build with PostgreSQL 9.5+

  PR:		207314
  Reported by:	Vladyslav <vladka@webdevelop.pro>

Changes:
  head/databases/postgis20/files/
  head/databases/postgis20/files/patch-postgis-lwgeom_accum.c
Comment 6 commit-hook freebsd_committer freebsd_triage 2016-12-04 10:44:42 UTC
A commit references this bug:

Author: sunpoet
Date: Sun Dec  4 10:44:13 UTC 2016
New revision: 427768
URL: https://svnweb.freebsd.org/changeset/ports/427768

Log:
  - Fix build with PostgreSQL 9.5+

  PR:		207314
  Reported by:	Vladyslav <vladka@webdevelop.pro>
  Approved by:	maintainer (implicit)

Changes:
  head/databases/postgis21/files/
  head/databases/postgis21/files/patch-postgis-lwgeom_accum.c
Comment 7 Po-Chuan Hsieh freebsd_committer freebsd_triage 2016-12-04 10:46:33 UTC
Committed. Thanks!