adjust / parquet_fdw

Parquet foreign data wrapper for PostgreSQL
PostgreSQL License
351 stars 38 forks source link

Compiling on Oracle/RHEL Linux 7 fails due to C++ > 11 #46

Open chrisfw opened 2 years ago

chrisfw commented 2 years ago

Hello,

After much ado getting the arrow prerequisites installed on Oracle Linux 7, I discovered that the fdw won't compile with the version of g++ on version 7 (4.8.5) which seems only to support up to c++11. Is there any way you could create a branch that will compile with c++11? I totally understand if this is not something you would like to support, but we are currently pinned to Oracle Linux 7 which has created this predicament.

Regards, Chris Whelan

 make install CXXFLAGS='-std=c++11'
g++ -std=c++11 -fPIC -I. -I. -I/usr/include/pgsql/server -I/usr/include/pgsql/internal -D_GNU_SOURCE -I/usr/include/libxml2   -c
In file included from src/common.cpp:1:0:
src/common.hpp:18:0: warning: "DatumGetJsonbP" redefined [enabled by default]
 #define DatumGetJsonbP DatumGetJsonb
 ^
In file included from src/common.hpp:12:0,
                 from src/common.cpp:1:
./utils/jsonb.h:71:0: note: this is the location of the previous definition
 #define DatumGetJsonbP(d) ((Jsonb *) PG_DETOAST_DATUM(d))
 ^
In file included from src/common.cpp:1:0:
src/common.hpp:19:0: warning: "JsonbPGetDatum" redefined [enabled by default]
 #define JsonbPGetDatum JsonbGetDatum
 ^
In file included from src/common.hpp:12:0,
                 from src/common.cpp:1:
./utils/jsonb.h:73:0: note: this is the location of the previous definition
 #define JsonbPGetDatum(p) PointerGetDatum(p)
 ^
In file included from ./utils/array.h:65:0,
                 from ./utils/jsonb.h:16,
                 from src/common.hpp:12,
                 from src/common.cpp:1:
./utils/expandeddatum.h:67:43: error: typedef ‘EOM_get_flat_size_method’ is initialized (use decltype instead)
 typedef Size (*EOM_get_flat_size_method) (ExpandedObjectHeader *eohptr);
                                           ^
./utils/expandeddatum.h:67:43: error: ‘ExpandedObjectHeader’ was not declared in this scope
./utils/expandeddatum.h:67:65: error: ‘eohptr’ was not declared in this scope
 typedef Size (*EOM_get_flat_size_method) (ExpandedObjectHeader *eohptr);
                                                                 ^
./utils/expandeddatum.h:68:42: error: typedef ‘EOM_flatten_into_method’ is initialized (use decltype instead)
 typedef void (*EOM_flatten_into_method) (ExpandedObjectHeader *eohptr,
                                          ^
./utils/expandeddatum.h:68:42: error: ‘ExpandedObjectHeader’ was not declared in this scope
./utils/expandeddatum.h:68:64: error: ‘eohptr’ was not declared in this scope
 typedef void (*EOM_flatten_into_method) (ExpandedObjectHeader *eohptr,
                                                                ^
./utils/expandeddatum.h:69:12: error: expected primary-expression before ‘void’
            void *result, Size allocated_size);
            ^
./utils/expandeddatum.h:69:31: error: expected primary-expression before ‘allocated_size’
            void *result, Size allocated_size);
                               ^
./utils/expandeddatum.h:74:2: error: ‘EOM_get_flat_size_method’ does not name a type
  EOM_get_flat_size_method get_flat_size;
  ^
./utils/expandeddatum.h:75:2: error: ‘EOM_flatten_into_method’ does not name a type
  EOM_flatten_into_method flatten_into;
  ^
./utils/expandeddatum.h:48:59: error: ‘varatt_expanded’ was not declared in this scope
 #define EXPANDED_POINTER_SIZE (VARHDRSZ_EXTERNAL + sizeof(varatt_expanded))
                                                           ^
./utils/expandeddatum.h:110:19: note: in expansion of macro ‘EXPANDED_POINTER_SIZE’
  char  eoh_rw_ptr[EXPANDED_POINTER_SIZE];
                   ^
./utils/expandeddatum.h:48:59: error: ‘varatt_expanded’ was not declared in this scope
 #define EXPANDED_POINTER_SIZE (VARHDRSZ_EXTERNAL + sizeof(varatt_expanded))
                                                           ^
./utils/expandeddatum.h:113:19: note: in expansion of macro ‘EXPANDED_POINTER_SIZE’
  char  eoh_ro_ptr[EXPANDED_POINTER_SIZE];
                   ^
src/common.cpp: In function ‘void* exc_palloc(std::size_t)’:
src/common.cpp:38:26: error: ‘unlikely’ was not declared in this scope
  if (unlikely(ret == NULL))
                          ^
chrisfw commented 2 years ago

I managed to get a newer g++ compiler (9.3.1) installed via software collections, but unfortunately, the compile still fails. Any assistance in you can provide in order to resolve this issue would be greatly appreciated.

Regards, Chris

g++ -std=gnu++2a -fPIC -I. -I. -I/usr/include/pgsql/server -I/usr/include/pgsql/internal -D_GNU_SOURCE -I/usr/include/libxml2   -c -o src/common.o src/common.cpp
In file included from src/common.cpp:1:
src/common.hpp:18: warning: "DatumGetJsonbP" redefined
   18 | #define DatumGetJsonbP DatumGetJsonb
      |
In file included from src/common.hpp:12,
                 from src/common.cpp:1:
./utils/jsonb.h:71: note: this is the location of the previous definition
   71 | #define DatumGetJsonbP(d) ((Jsonb *) PG_DETOAST_DATUM(d))
      |
In file included from src/common.cpp:1:
src/common.hpp:19: warning: "JsonbPGetDatum" redefined
   19 | #define JsonbPGetDatum JsonbGetDatum
      |
In file included from src/common.hpp:12,
                 from src/common.cpp:1:
./utils/jsonb.h:73: note: this is the location of the previous definition
   73 | #define JsonbPGetDatum(p) PointerGetDatum(p)
      |
In file included from ./utils/array.h:65,
                 from ./utils/jsonb.h:16,
                 from src/common.hpp:12,
                 from src/common.cpp:1:
./utils/expandeddatum.h:67:16: error: typedef ‘EOM_get_flat_size_method’ is initialized (use decltype instead)
   67 | typedef Size (*EOM_get_flat_size_method) (ExpandedObjectHeader *eohptr);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~
./utils/expandeddatum.h:67:43: error: ‘ExpandedObjectHeader’ was not declared in this scope; did you mean ‘MakeExpandedObjectReadOnly’?
   67 | typedef Size (*EOM_get_flat_size_method) (ExpandedObjectHeader *eohptr);
      |                                           ^~~~~~~~~~~~~~~~~~~~
      |                                           MakeExpandedObjectReadOnly
./utils/expandeddatum.h:67:65: error: ‘eohptr’ was not declared in this scope
   67 | typedef Size (*EOM_get_flat_size_method) (ExpandedObjectHeader *eohptr);
      |                                                                 ^~~~~~
./utils/expandeddatum.h:68:16: error: typedef ‘EOM_flatten_into_method’ is initialized (use decltype instead)
   68 | typedef void (*EOM_flatten_into_method) (ExpandedObjectHeader *eohptr,
      |                ^~~~~~~~~~~~~~~~~~~~~~~
./utils/expandeddatum.h:68:42: error: ‘ExpandedObjectHeader’ was not declared in this scope; did you mean ‘MakeExpandedObjectReadOnly’?
   68 | typedef void (*EOM_flatten_into_method) (ExpandedObjectHeader *eohptr,
      |                                          ^~~~~~~~~~~~~~~~~~~~
      |                                          MakeExpandedObjectReadOnly
./utils/expandeddatum.h:68:64: error: ‘eohptr’ was not declared in this scope
   68 | typedef void (*EOM_flatten_into_method) (ExpandedObjectHeader *eohptr,
      |                                                                ^~~~~~
./utils/expandeddatum.h:69:12: error: expected primary-expression before ‘void’
   69 |            void *result, Size allocated_size);
      |            ^~~~
./utils/expandeddatum.h:69:31: error: expected primary-expression before ‘allocated_size’
   69 |            void *result, Size allocated_size);
      |                               ^~~~~~~~~~~~~~
./utils/expandeddatum.h:74:2: error: ‘EOM_get_flat_size_method’ does not name a type
   74 |  EOM_get_flat_size_method get_flat_size;
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
./utils/expandeddatum.h:75:2: error: ‘EOM_flatten_into_method’ does not name a type
   75 |  EOM_flatten_into_method flatten_into;
      |  ^~~~~~~~~~~~~~~~~~~~~~~
./utils/expandeddatum.h:48:59: error: ‘varatt_expanded’ was not declared in this scope
   48 | #define EXPANDED_POINTER_SIZE (VARHDRSZ_EXTERNAL + sizeof(varatt_expanded))
      |                                                           ^~~~~~~~~~~~~~~
./utils/expandeddatum.h:110:19: note: in expansion of macro ‘EXPANDED_POINTER_SIZE’
  110 |  char  eoh_rw_ptr[EXPANDED_POINTER_SIZE];
      |                   ^~~~~~~~~~~~~~~~~~~~~
./utils/expandeddatum.h:48:59: error: ‘varatt_expanded’ was not declared in this scope
   48 | #define EXPANDED_POINTER_SIZE (VARHDRSZ_EXTERNAL + sizeof(varatt_expanded))
      |                                                           ^~~~~~~~~~~~~~~
./utils/expandeddatum.h:113:19: note: in expansion of macro ‘EXPANDED_POINTER_SIZE’
  113 |  char  eoh_ro_ptr[EXPANDED_POINTER_SIZE];
      |                   ^~~~~~~~~~~~~~~~~~~~~
src/common.cpp: In function ‘void* exc_palloc(std::size_t)’:
src/common.cpp:38:6: error: ‘unlikely’ was not declared in this scope
   38 |  if (unlikely(ret == NULL))
      |      ^~~~~~~~
make: *** [<builtin>: src/common.o] Error 1