umitanuki / twitter_fdw

74 stars 11 forks source link

Compilation error #10

Open krisnamourt opened 3 years ago

krisnamourt commented 3 years ago

I'm trying to build a docker image with this wrapper

from postgres:13.2

RUN apt -y update &&  apt -y upgrade
#Elastic Wrapper
RUN apt-get install -y python python-pip
RUN apt-get install -y postgresql-11-python-multicorn 
RUN pip install "elasticsearch>=7,<8"
RUN pip install pg_es_fdw
#MySQL
RUN apt-get install -y postgresql-13-mysql-fdw
#ClickHouse
RUN apt-get install -y build-essential libcurl4-openssl-dev libpq-dev pkg-config
RUN apt-get install -y git wget cmake make gcc uuid-dev
RUN apt install -y postgresql-server-dev-13
RUN git clone https://github.com/adjust/clickhouse_fdw.git && cd clickhouse_fdw && mkdir build && cd build && cmake .. && make && make install
#TWITTER
RUN apt-get install -y libjson-c-dev
RUN git clone https://github.com/umitanuki/twitter_fdw.git && cd twitter_fdw && make && make install

And I'm getting this error

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -I. -I./ -I/usr/include/postgresql/13/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2   -c -o twitter_fdw.o twitter_fdw.c
twitter_fdw.c: In function ‘twitter_fdw_handler’:
twitter_fdw.c:180:29: warning: assignment to ‘GetForeignPlan_function’ {aka ‘struct ForeignScan * (*)(struct PlannerInfo *, struct RelOptInfo *, unsigned int,  struct ForeignPath *, struct List *, struct List *, struct Plan *)’} from incompatible pointer type ‘ForeignScan * (*)(PlannerInfo *, RelOptInfo *, Oid,  ForeignPath *, List *, List *)’ {aka ‘struct ForeignScan * (*)(struct PlannerInfo *, struct RelOptInfo *, unsigned int,  struct ForeignPath *, struct List *, struct List *)’} [-Wincompatible-pointer-types]
  fdwroutine->GetForeignPlan = twitterGetPlan;
                             ^
twitter_fdw.c:182:7: warning: extra tokens at end of #endif directive [-Wendif-labels]
 #endif;
       ^
In file included from /usr/include/postgresql/13/server/postgres.h:46,
                 from twitter_fdw.c:1:
twitter_fdw.c: In function ‘twitter_param’:
twitter_fdw.c:258:45: error: invalid type argument of ‘->’ (have ‘FormData_pg_attribute’ {aka ‘struct FormData_pg_attribute’})
   key = NameStr(tupdesc->attrs[varattno - 1]->attname);
                                             ^~
/usr/include/postgresql/13/server/c.h:615:25: note: in definition of macro ‘NameStr’
 #define NameStr(name) ((name).data)
                         ^~~~
twitter_fdw.c: In function ‘twitterGetPaths’:
twitter_fdw.c:409:13: warning: implicit declaration of function ‘relation_open’; did you mean ‘RelationClose’? [-Wimplicit-function-declaration]
  relation = relation_open(foreigntableid, AccessShareLock);
             ^~~~~~~~~~~~~
             RelationClose
twitter_fdw.c:409:11: warning: assignment to ‘Relation’ {aka ‘struct RelationData *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  relation = relation_open(foreigntableid, AccessShareLock);
           ^
twitter_fdw.c:412:2: warning: implicit declaration of function ‘relation_close’; did you mean ‘RelationClose’? [-Wimplicit-function-declaration]
  relation_close(relation, AccessShareLock);
  ^~~~~~~~~~~~~~
  RelationClose
twitter_fdw.c:416:57: error: incompatible type for argument 3 of ‘create_foreignscan_path’
   (Path *)create_foreignscan_path(root, baserel, baserel->rows,
                                                  ~~~~~~~^~~~~~
In file included from twitter_fdw.c:15:
/usr/include/postgresql/13/server/optimizer/pathnode.h:111:21: note: expected ‘PathTarget *’ {aka ‘struct PathTarget *’} but argument is of type ‘double’
 extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
                     ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/postgresql/13/server/access/tupdesc.h:19,
                 from /usr/include/postgresql/13/server/utils/relcache.h:18,
                 from /usr/include/postgresql/13/server/access/genam.h:21,
                 from /usr/include/postgresql/13/server/access/amapi.h:15,
                 from /usr/include/postgresql/13/server/access/reloptions.h:22,
                 from twitter_fdw.c:3:
/usr/include/postgresql/13/server/nodes/pg_list.h:65:19: error: incompatible type for argument 6 of ‘create_foreignscan_path’
 #define NIL      ((List *) NULL)
                  ~^~~~~~~~~~~~~~
twitter_fdw.c:417:15: note: in expansion of macro ‘NIL’
     10, 1000, NIL, NULL, NIL));
               ^~~
In file included from twitter_fdw.c:15:
/usr/include/postgresql/13/server/optimizer/pathnode.h:111:21: note: expected ‘Cost’ {aka ‘double’} but argument is of type ‘List *’ {aka ‘struct List *’}
 extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
                     ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/postgresql/13/server/access/tupdesc.h:19,
                 from /usr/include/postgresql/13/server/utils/relcache.h:18,
                 from /usr/include/postgresql/13/server/access/genam.h:21,
                 from /usr/include/postgresql/13/server/access/amapi.h:15,
                 from /usr/include/postgresql/13/server/access/reloptions.h:22,
                 from twitter_fdw.c:3:
/usr/include/postgresql/13/server/nodes/pg_list.h:65:19: warning: passing argument 8 of ‘create_foreignscan_path’ from incompatible pointer type [-Wincompatible-pointer-types]
 #define NIL      ((List *) NULL)
                  ~^~~~~~~~~~~~~~
twitter_fdw.c:417:26: note: in expansion of macro ‘NIL’
     10, 1000, NIL, NULL, NIL));
                          ^~~
In file included from twitter_fdw.c:15:
/usr/include/postgresql/13/server/optimizer/pathnode.h:111:21: note: expected ‘Relids’ {aka ‘struct Bitmapset *’} but argument is of type ‘List *’ {aka ‘struct List *’}
 extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
                     ^~~~~~~~~~~~~~~~~~~~~~~
twitter_fdw.c:416:11: error: too few arguments to function ‘create_foreignscan_path’
   (Path *)create_foreignscan_path(root, baserel, baserel->rows,
           ^~~~~~~~~~~~~~~~~~~~~~~
In file included from twitter_fdw.c:15:
/usr/include/postgresql/13/server/optimizer/pathnode.h:111:21: note: declared here
 extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
                     ^~~~~~~~~~~~~~~~~~~~~~~
twitter_fdw.c: In function ‘twitterGetPlan’:
twitter_fdw.c:433:9: error: too few arguments to function ‘make_foreignscan’
  return make_foreignscan(tlist, keep_clauses, baserel->relid, NIL, baserel->fdw_private);
         ^~~~~~~~~~~~~~~~
In file included from twitter_fdw.c:16:
/usr/include/postgresql/13/server/optimizer/planmain.h:42:21: note: declared here
 extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual,
                     ^~~~~~~~~~~~~~~~
twitter_fdw.c: In function ‘twitterBegin’:
twitter_fdw.c:482:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
  int    ret;
         ^~~
twitter_fdw.c: In function ‘twitterIterate’:
twitter_fdw.c:571:40: error: invalid type argument of ‘->’ (have ‘FormData_pg_attribute’ {aka ‘struct FormData_pg_attribute’})
   Name attname = &rel->rd_att->attrs[i]->attname;
                                        ^~
twitter_fdw.c:601:2: warning: implicit declaration of function ‘ExecStoreTuple’; did you mean ‘ExecStoreHeapTuple’? [-Wimplicit-function-declaration]
  ExecStoreTuple(tuple, slot, InvalidBuffer, true);
  ^~~~~~~~~~~~~~
  ExecStoreHeapTuple
twitter_fdw.c: In function ‘twitterGetPlan’:
twitter_fdw.c:434:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [<builtin>: twitter_fdw.o] Error 1
mkgrgis commented 1 year ago

@krisnamourt twitter_fdw is yet not actual. There were many changes in Twitter API and access mode, especially touching twitterBegin , twitterGetPlan , twitterIterate. Some PostgreSQL C API for actual PostgreSQL 15 have been changed. If You have a time for actualising both API interactions please fork this repository and modify a new as owner.
@umitanuki , You can make this repository archived and add in README.md a link to fork liked by You. The newest fork with changes is https://github.com/elchinoo/twitter_fdw .