knizhnik / imcs

In-Memory Columnar Store extension for PostgreSQL
Apache License 2.0
203 stars 33 forks source link

Can't rebuild using make option USE_DISK=1 #59

Closed pavitrakumar78 closed 4 years ago

pavitrakumar78 commented 4 years ago

Hi,

I wanted to test the disk mode so I edited the install.sh file to include the USE_DISK=1 option like below and executed it, but it results in some errors.

PATH=/usr/local/pgsql/bin/:$PATH make USE_PGXS=1 CFLAGS="-O3 -Wall -Wno-format-security"  LDFLAGS="-pthread" USE_DISK=1 install

Errors:

gcc -O3 -Wall -Wno-format-security -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o imcs.o imcs.c
gcc -O3 -Wall -Wno-format-security -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o func.o func.c
gcc -O3 -Wall -Wno-format-security -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o smp.o smp.c
gcc -O3 -Wall -Wno-format-security -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o btree.o btree.c
gcc -O3 -Wall -Wno-format-security -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o threadpool.o threadpool.c
gcc -O3 -Wall -Wno-format-security -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o fileio.o fileio.c
gcc -O3 -Wall -Wno-format-security -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o disk.o disk.c
disk.c:31:46: error: unknown type name ‘imcs_page_access_mode_t’
 imcs_page_t* imcs_load_page(imcs_page_t* pg, imcs_page_access_mode_t mode)
                                              ^~~~~~~~~~~~~~~~~~~~~~~
disk.c:134:1: error: expected identifier or ‘(’ before ‘{’ token
 {
 ^
disk.c:160:25: error: macro "imcs_disk_open" passed 1 arguments, but takes just 0
 void imcs_disk_open(void)
                         ^
disk.c:161:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
disk.c:165:26: error: macro "imcs_disk_close" passed 1 arguments, but takes just 0
 void imcs_disk_close(void)
                          ^
disk.c:166:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
disk.c:177:26: error: macro "imcs_disk_flush" passed 1 arguments, but takes just 0
 void imcs_disk_flush(void)
                          ^
disk.c:178:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
disk.c:170:12: warning: ‘compare_page_offset’ defined but not used [-Wunused-function]
 static int compare_page_offset(void const* p, void const* q)
            ^~~~~~~~~~~~~~~~~~~
<builtin>: recipe for target 'disk.o' failed
make: *** [disk.o] Error 1

imcs_page_access_mode_t is present in disk.h but not sure why I'm getting this issue.

knizhnik commented 4 years ago

It is not correct to build extension in this way because by setting CFLAGS you actually override compiler options set by makefile. You can build it using make USE_PGXS=1 USE_DISK=1 clean all install or explicitly set IMCS_DISK_SUPPORT flags: make USE_PGXS=1 CFLAGS="-O3 -Wall -Wno-format-security -DIMCS_DISK_SUPPORT" LDFLAGS="-pthread" USE_DISK=1 install

pavitrakumar78 commented 4 years ago

It is not correct to build extension in this way because by setting CFLAGS you actually override compiler options set by makefile. You can build it using make USE_PGXS=1 USE_DISK=1 clean all install or explicitly set IMCS_DISK_SUPPORT flags: make USE_PGXS=1 CFLAGS="-O3 -Wall -Wno-format-security -DIMCS_DISK_SUPPORT" LDFLAGS="-pthread" USE_DISK=1 install

Thanks for the suggestion! I tried both and still got the same error I mentioned in my original issue post. Here's what I tried: In the install.sh file, I added only this:

PATH=/usr/local/pgsql/bin/:$PATH make USE_PGXS=1 USE_DISK=1 clean all install

and in the next try, I added only this:

PATH=/usr/local/pgsql/bin/:$PATH make USE_PGXS=1 CFLAGS="-O3 -Wall -Wno-format-security -DIMCS_DISK_SUPPORT" LDFLAGS="-pthread" USE_DISK=1 install

and ran sudo ./install.sh. For the former command (clean all...), I get additional errors:

disk.c:31:46: error: unknown type name 'imcs_page_access_mode_t'
imcs_page_t* imcs_load_page(imcs_page_t* pg, imcs_page_access_mode_t mode)
^
disk.c:52:25: error: use of undeclared identifier 'PM_READ_ONLY'
if (mode != PM_READ_ONLY) { /* page will be updated */
^
disk.c:59:20: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99
[-Wimplicit-function-declaration]
return IMCS_PAGE_DATA(cache, pid);
^
disk.c:59:20: warning: incompatible integer to pointer conversion returning 'int' from a function with result type
'imcs_page_t *' (aka 'struct imcs_page_t_ *') [-Wint-conversion]
return IMCS_PAGE_DATA(cache, pid);
^~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:88:18: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99
[-Wimplicit-function-declaration]
pg = IMCS_PAGE_DATA(cache, pid);
^
disk.c:88:16: warning: incompatible integer to pointer conversion assigning to 'imcs_page_t *'
(aka 'struct imcs_page_t_ *') from 'int' [-Wint-conversion]
pg = IMCS_PAGE_DATA(cache, pid);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:94:17: error: use of undeclared identifier 'PM_NEW'
if (mode != PM_NEW) {
^
disk.c:96:14: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99
[-Wimplicit-function-declaration]
pg = IMCS_PAGE_DATA(cache, pid);
^
disk.c:96:12: warning: incompatible integer to pointer conversion assigning to 'imcs_page_t *'
(aka 'struct imcs_page_t_ *') from 'int' [-Wint-conversion]
pg = IMCS_PAGE_DATA(cache, pid);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:102:17: error: use of undeclared identifier 'PM_READ_ONLY'
if (mode != PM_READ_ONLY) { /* include page in dirty list */
^
disk.c:114:12: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99
[-Wimplicit-function-declaration]
return IMCS_PAGE_DATA(cache, pid)
disk.c:114:12: warning: incompatible integer to pointer conversion returning 'int' from a function with result type
'imcs_page_t *' (aka 'struct imcs_page_t_ *') [-Wint-conversion]
return IMCS_PAGE_DATA(cache, pid);
^~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:134:1: error: expected identifier or '('
{
^
disk.c:160:21: error: too many arguments provided to function-like macro invocation
void imcs_disk_open(void)
^
./disk.h:72:9: note: macro 'imcs_disk_open' defined here
#define imcs_disk_open()
^
disk.c:160:6: error: variable has incomplete type 'void'
void imcs_disk_open(void)
^
disk.c:160:20: error: expected ';' after top level declarator
void imcs_disk_open(void)
^
;
disk.c:165:22: error: too many arguments provided to function-like macro invocation
void imcs_disk_close(void)
^
./disk.h:73:9: note: macro 'imcs_disk_close' defined here
#define imcs_disk_close()
^
disk.c:177:22: error: too many arguments provided to function-like macro invocatio
void imcs_disk_flush(void)
^
./disk.h:74:9: note: macro 'imcs_disk_flush' defined here
#define imcs_disk_flush()
^
8 warnings and 10 errors generated.
/usr/lib/postgresql/12/lib/pgxs/src/makefiles/../../src/Makefile.global:1044: recipe for target 'disk.bc' failed
make: *** [disk.bc] Error 1                                                                                               

Am I missing something?

knizhnik commented 4 years ago

Can you send me complete ouput of the following command:

'PATH=/usr/local/pgsql/bin/:$PATH make USE_PGXS=1 USE_DISK=1 clean all install'

pavitrakumar78 commented 4 years ago

Can you send me complete ouput of the following command:

'PATH=/usr/local/pgsql/bin/:$PATH make USE_PGXS=1 USE_DISK=1 clean all install'

pk@PavitrakumarPC:/mnt/c/Users/Pavitrakumar-PC/Desktop$ byobu
pk@PavitrakumarPC:/mnt/c/Users/Pavitrakumar-PC/Desktop$ cd imcs-mod/
pk@PavitrakumarPC:/mnt/c/Users/Pavitrakumar-PC/Desktop/imcs-mod$ PATH=/usr/local/pgsql/bin/:$PATH make USE_PGXS=1 USE_DISK=1 clean all install
rm -f imcs.so   libimcs.a  libimcs.pc
rm -f imcs.o func.o smp.o btree.o threadpool.o fileio.o disk.o imcs.bc func.bc smp.bc btree.bc threadpool.bc fileio.bc disk.bc
rm -rf results/ regression.diffs regression.out tmp_check/ tmp_check_iso/ log/ output_iso/
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o imcs.o imcs.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o func.o func.c
func.c: In function ‘imcs_window_iargmax_int8_next’:
func.c:1765:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1778:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int8, int8, window_iargmax, IMCS_WINDOW_IARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_iargmax_int16_next’:
func.c:1765:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1779:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int16, int16, window_iargmax, IMCS_WINDOW_IARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_iargmax_int32_next’:
func.c:1765:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1780:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int32, int32, window_iargmax, IMCS_WINDOW_IARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_iargmax_int64_next’:
func.c:1765:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1781:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int64, int64, window_iargmax, IMCS_WINDOW_IARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_iargmax_float_next’:
func.c:1765:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1782:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(float, float, window_iargmax, IMCS_WINDOW_IARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_iargmax_double_next’:
func.c:1765:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1783:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(double, double, window_iargmax, IMCS_WINDOW_IARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_argmax_int8_next’:
func.c:1788:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                   \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_ARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1801:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int8, int8, window_argmax, IMCS_WINDOW_ARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_argmax_int16_next’:
func.c:1788:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                   \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_ARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1802:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int16, int16, window_argmax, IMCS_WINDOW_ARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_argmax_int32_next’:
func.c:1788:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                   \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_ARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1803:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int32, int32, window_argmax, IMCS_WINDOW_ARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_argmax_int64_next’:
func.c:1788:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                   \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_ARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1804:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int64, int64, window_argmax, IMCS_WINDOW_ARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_argmax_float_next’:
func.c:1788:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                   \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_ARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1805:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(float, float, window_argmax, IMCS_WINDOW_ARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_argmax_double_next’:
func.c:1788:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                   \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_ARGMAX_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1806:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(double, double, window_argmax, IMCS_WINDOW_ARGMAX_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_iargmin_int8_next’:
func.c:1812:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMIN_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1825:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int8, int8, window_iargmin, IMCS_WINDOW_IARGMIN_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_iargmin_int16_next’:
func.c:1812:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMIN_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1826:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int16, int16, window_iargmin, IMCS_WINDOW_IARGMIN_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_iargmin_int32_next’:
func.c:1812:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMIN_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1827:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int32, int32, window_iargmin, IMCS_WINDOW_IARGMIN_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_iargmin_int64_next’:
func.c:1812:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMIN_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1828:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(int64, int64, window_iargmin, IMCS_WINDOW_IARGMIN_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_iargmin_float_next’:
func.c:1812:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMIN_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1829:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(float, float, window_iargmin, IMCS_WINDOW_IARGMIN_NEXT, 0)
 ^~~~~~~~~~~~~~~~~~~
func.c: In function ‘imcs_window_iargmin_double_next’:
func.c:1812:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t j, n;                                                                                 \
     ^
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_IARGMIN_NEXT’
         NEXT(TYPE, AGG_TYPE, iterator->tile.arr_##AGG_TYPE[i], ctx->accumulator.val_##AGG_TYPE, ctx->history.arr_##TYPE[iterator->next_pos % ctx->interval], iterator->opd[0]->tile.arr_##TYPE[i]); \
         ^~~~
func.c:1830:1: note: in expansion of macro ‘IMCS_WINDOW_AGG_DEF’
 IMCS_WINDOW_AGG_DEF(double, double, window_iargmin, IMCS_WINDOW_IARGMIN_NEXT, 0)
func.c:1835:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
func.c:1643:9: note: in expansion of macro ‘IMCS_WINDOW_ARGMIN_NEXT’
disk.c:59:20: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99 [-Wimplicit-function-declaration]
            return IMCS_PAGE_DATA(cache, pid);
                   ^
disk.c:59:20: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'imcs_page_t *' (aka 'struct imcs_page_t_ *') [-Wint-conversion]
            return IMCS_PAGE_DATA(cache, pid);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:88:18: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99 [-Wimplicit-function-declaration]
            pg = IMCS_PAGE_DATA(cache, pid);
                 ^
disk.c:88:16: warning: incompatible integer to pointer conversion assigning to 'imcs_page_t *' (aka 'struct imcs_page_t_ *') from 'int' [-Wint-conversion]
            pg = IMCS_PAGE_DATA(cache, pid);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:94:17: error: use of undeclared identifier 'PM_NEW'
    if (mode != PM_NEW) {
                ^
disk.c:96:14: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99 [-Wimplicit-function-declaration]
        pg = IMCS_PAGE_DATA(cache, pid);
             ^
disk.c:96:12: warning: incompatible integer to pointer conversion assigning to 'imcs_page_t *' (aka 'struct imcs_page_t_ *') from 'int' [-Wint-conversion]
        pg = IMCS_PAGE_DATA(cache, pid);
           ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:102:17: error: use of undeclared identifier 'PM_READ_ONLY'
    if (mode != PM_READ_ONLY) { /* include page in dirty list */
                ^
disk.c:114:12: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99 [-Wimplicit-function-declaration]
    return IMCS_PAGE_DATA(cache, pid);
           ^
disk.c:114:12: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'imcs_page_t *' (aka 'struct imcs_page_t_ *') [-Wint-conversion]
    return IMCS_PAGE_DATA(cache, pid);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:134:1: error: expected identifier or '('
{
^
disk.c:160:21: error: too many arguments provided to function-like macro invocation
void imcs_disk_open(void)
                    ^
./disk.h:72:9: note: macro 'imcs_disk_open' defined here
#define imcs_disk_open()
        ^
disk.c:160:6: error: variable has incomplete type 'void'
void imcs_disk_open(void)
     ^
disk.c:160:20: error: expected ';' after top level declarator
void imcs_disk_open(void)
                   ^
                   ;
disk.c:165:22: error: too many arguments provided to function-like macro invocation
void imcs_disk_close(void)
                     ^
./disk.h:73:9: note: macro 'imcs_disk_close' defined here
#define imcs_disk_close()
        ^
disk.c:177:22: error: too many arguments provided to function-like macro invocation
void imcs_disk_flush(void)
                     ^
./disk.h:74:9: note: macro 'imcs_disk_flush' defined here
#define imcs_disk_flush()
        ^
8 warnings and 10 errors generated.
/usr/lib/postgresql/12/lib/pgxs/src/makefiles/../../src/Makefile.global:1044: recipe for target 'disk.bc' failed
make: *** [disk.bc] Error 1
2 pk@PavitrakumarPC:/mnt/c/Users/Pavitrakumar-PC/Desktop/imcs-mod$
knizhnik commented 4 years ago

Sorry, which branch of IMCS you are using? I can not reproduce this problem with master branch. And line number for the reported errors and warning doesn't match master branch sources.

pavitrakumar78 commented 4 years ago

Sorry, which branch of IMCS you are using? I can not reproduce this problem with master branch. And line number for the reported errors and warning doesn't match master branch sources.

I'm using the same disk.h and disk.c code as master. I have added few additional functions in the func.c file (they all work well) in my fork of imcs so you might see line mismatch for func.c. But I have not touched disk.c and disk.h and the error lines correspond to the file here: https://github.com/knizhnik/imcs/blob/master/disk.c

I will try to pull and install freshly from the source and report back.

pavitrakumar78 commented 4 years ago

I can not reproduce this problem with the master branch.

I just cloned the master branch and executed the command you suggested. Here's the log (it's the same as reported above):

pk@PavitrakumarPC:/mnt/c/Users/Pavitrakumar-PC/Desktop$ cd imcs
pk@PavitrakumarPC:/mnt/c/Users/Pavitrakumar-PC/Desktop/imcs$ ls -l
total 3425
-rw-rw-rw- 1 pk pk    2605 Sep 22 18:47 CHANGES
-rw-rw-rw- 1 pk pk     160 Sep 22 18:47 INSTALL
-rw-rw-rw- 1 pk pk   11527 Sep 22 18:47 LICENSE
-rw-rw-rw- 1 pk pk    1320 Sep 22 18:47 META.json
-rw-rw-rw- 1 pk pk    1315 Sep 22 18:47 Makefile
-rw-rw-rw- 1 pk pk      65 Sep 22 18:47 README.md
-rw-rw-rw- 1 pk pk    7923 Sep 22 18:47 about.txt
-rwxrwxrwx 1 pk pk   34204 Sep 22 18:55 btree.bc
-rw-rw-rw- 1 pk pk   43423 Sep 22 18:47 btree.c
-rw-rw-rw- 1 pk pk    3453 Sep 22 18:47 btree.h
-rwxrwxrwx 1 pk pk  177432 Sep 22 18:55 btree.o
-rw-rw-rw- 1 pk pk    9797 Sep 22 18:47 disk.c
-rw-rw-rw- 1 pk pk    2768 Sep 22 18:47 disk.h
-rwxrwxrwx 1 pk pk  115032 Sep 22 18:55 disk.o
-rw-rw-rw- 1 pk pk    4161 Sep 22 18:47 example.sql
drwxrwxrwx 1 pk pk     512 Sep 22 18:47 expected
-rwxrwxrwx 1 pk pk    4828 Sep 22 18:55 fileio.bc
-rw-rw-rw- 1 pk pk    2997 Sep 22 18:47 fileio.c
-rw-rw-rw- 1 pk pk     549 Sep 22 18:47 fileio.h
-rwxrwxrwx 1 pk pk  104096 Sep 22 18:55 fileio.o
-rwxrwxrwx 1 pk pk  984572 Sep 22 18:55 func.bc
-rw-rw-rw- 1 pk pk  377279 Sep 22 18:47 func.c
-rw-rw-rw- 1 pk pk   16253 Sep 22 18:47 func.h
-rwxrwxrwx 1 pk pk 1968856 Sep 22 18:55 func.o
-rw-rw-rw- 1 pk pk   80435 Sep 22 18:47 imcs--1.1.sql
-rwxrwxrwx 1 pk pk  302056 Sep 22 18:55 imcs.bc
-rw-rw-rw- 1 pk pk  218653 Sep 22 18:47 imcs.c
-rw-rw-rw- 1 pk pk      55 Sep 22 18:47 imcs.conf
-rw-rw-rw- 1 pk pk     135 Sep 22 18:47 imcs.control
-rw-rw-rw- 1 pk pk   10643 Sep 22 18:47 imcs.h
-rwxrwxrwx 1 pk pk  718696 Sep 22 18:54 imcs.o
-rwxrwxrwx 1 pk pk 1978928 Sep 22 18:55 imcs.so
-rwxrwxrwx 1 pk pk     221 Sep 22 18:47 install.sh
-rwxrwxrwx 1 pk pk   10148 Sep 22 18:55 smp.bc
-rw-rw-rw- 1 pk pk   11026 Sep 22 18:47 smp.c
-rw-rw-rw- 1 pk pk    1978 Sep 22 18:47 smp.h
-rwxrwxrwx 1 pk pk   36688 Sep 22 18:55 smp.o
drwxrwxrwx 1 pk pk     512 Sep 22 18:47 sql
-rw-rw-rw- 1 pk pk    1288 Sep 22 18:47 sysv_shmem.patch
-rwxrwxrwx 1 pk pk    6124 Sep 22 18:55 threadpool.bc
-rw-rw-rw- 1 pk pk    3678 Sep 22 18:47 threadpool.c
-rwxrwxrwx 1 pk pk    9352 Sep 22 18:55 threadpool.o
-rw-rw-rw- 1 pk pk    5983 Sep 22 18:47 tpch.sql
-rw-rw-rw- 1 pk pk  114787 Sep 22 18:47 user_guide.html
pk@PavitrakumarPC:/mnt/c/Users/Pavitrakumar-PC/Desktop/imcs$ PATH=/usr/local/pgsql/bin/:$PATH make USE_PGXS=1 USE_DISK=1 clean all install
rm -f imcs.so   libimcs.a  libimcs.pc
rm -f imcs.o func.o smp.o btree.o threadpool.o fileio.o disk.o imcs.bc func.bc smp.bc btree.bc threadpool.bc fileio.bc disk.bc
rm -rf results/ regression.diffs regression.out tmp_check/ tmp_check_iso/ log/ output_iso/
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o imcs.o imcs.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o func.o func.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o smp.o smp.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o btree.o btree.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o threadpool.o threadpool.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o fileio.o fileio.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o disk.o disk.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -shared -o imcs.so imcs.o func.o smp.o btree.o threadpool.o fileio.o disk.o -L/usr/lib/x86_64-linux-gnu  -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -L/usr/lib/llvm-6.0/lib  -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,--as-needed -O0 -Wall -pthread -DIMCS_DISK_SUPPORT  -lm
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o imcs.bc imcs.c
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o func.bc func.c
func.c:6206:30: warning: field 'fcinfo' with variable sized type 'FunctionCallInfoBaseData' (aka 'struct FunctionCallInfoBaseData') not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
    FunctionCallInfoBaseData fcinfo;
                             ^
1 warning generated.
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o smp.bc smp.c
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o btree.bc btree.c
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o threadpool.bc threadpool.c
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o fileio.bc fileio.c
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o disk.bc disk.c
disk.c:31:46: error: unknown type name 'imcs_page_access_mode_t'
imcs_page_t* imcs_load_page(imcs_page_t* pg, imcs_page_access_mode_t mode)
                                             ^
disk.c:52:25: error: use of undeclared identifier 'PM_READ_ONLY'
            if (mode != PM_READ_ONLY) { /* page will be updated */
                        ^
disk.c:59:20: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99 [-Wimplicit-function-declaration]
            return IMCS_PAGE_DATA(cache, pid);
                   ^
disk.c:59:20: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'imcs_page_t *' (aka 'struct imcs_page_t_ *') [-Wint-conversion]
            return IMCS_PAGE_DATA(cache, pid);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:88:18: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99 [-Wimplicit-function-declaration]
            pg = IMCS_PAGE_DATA(cache, pid);
                 ^
disk.c:88:16: warning: incompatible integer to pointer conversion assigning to 'imcs_page_t *' (aka 'struct imcs_page_t_ *') from 'int' [-Wint-conversion]
            pg = IMCS_PAGE_DATA(cache, pid);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:94:17: error: use of undeclared identifier 'PM_NEW'
    if (mode != PM_NEW) {
                ^
disk.c:96:14: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99 [-Wimplicit-function-declaration]
        pg = IMCS_PAGE_DATA(cache, pid);
             ^
disk.c:96:12: warning: incompatible integer to pointer conversion assigning to 'imcs_page_t *' (aka 'struct imcs_page_t_ *') from 'int' [-Wint-conversion]
        pg = IMCS_PAGE_DATA(cache, pid);
           ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:102:17: error: use of undeclared identifier 'PM_READ_ONLY'
    if (mode != PM_READ_ONLY) { /* include page in dirty list */
                ^
disk.c:114:12: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99 [-Wimplicit-function-declaration]
    return IMCS_PAGE_DATA(cache, pid);
           ^
disk.c:114:12: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'imcs_page_t *' (aka 'struct imcs_page_t_ *') [-Wint-conversion]
    return IMCS_PAGE_DATA(cache, pid);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:134:1: error: expected identifier or '('
{
^
disk.c:160:21: error: too many arguments provided to function-like macro invocation
void imcs_disk_open(void)
                    ^
./disk.h:72:9: note: macro 'imcs_disk_open' defined here
#define imcs_disk_open()
        ^
disk.c:160:6: error: variable has incomplete type 'void'
void imcs_disk_open(void)
     ^
disk.c:160:20: error: expected ';' after top level declarator
void imcs_disk_open(void)
                   ^
                   ;
disk.c:165:22: error: too many arguments provided to function-like macro invocation
void imcs_disk_close(void)
                     ^
./disk.h:73:9: note: macro 'imcs_disk_close' defined here
#define imcs_disk_close()
        ^
disk.c:177:22: error: too many arguments provided to function-like macro invocation
void imcs_disk_flush(void)
                     ^
./disk.h:74:9: note: macro 'imcs_disk_flush' defined here
#define imcs_disk_flush()
        ^
8 warnings and 10 errors generated.
/usr/lib/postgresql/12/lib/pgxs/src/makefiles/../../src/Makefile.global:1044: recipe for target 'disk.bc' failed
make: *** [disk.bc] Error 1
pk@PavitrakumarPC:/mnt/c/Users/Pavitrakumar-PC/Desktop/imcs$

I've been running all my experiments on a Ubuntu WSL (18.04) in Win10. So far, I have not had any compilations issues (other than when you had to port it to PG12 - but that was fixed).

knizhnik commented 4 years ago

Sorry, but it seems to be not exactly the master branch. At least size of Makefile is different:

total 968
-rw-r--r-- 1 knizhnik knizhnik   7836 сен  7 20:00 about.txt
-rw-r--r-- 1 knizhnik knizhnik  54118 сен  7 20:00 btree.c
-rw-r--r-- 1 knizhnik knizhnik   3367 сен  7 20:00 btree.h
-rw-r--r-- 1 knizhnik knizhnik   2546 сен  7 20:00 CHANGES
-rw-r--r-- 1 knizhnik knizhnik   9533 сен  7 20:00 disk.c
-rw-r--r-- 1 knizhnik knizhnik   2689 сен  7 20:00 disk.h
-rw-r--r-- 1 knizhnik knizhnik   4062 сен  7 20:00 example.sql
drwxr-xr-x 2 knizhnik knizhnik   4096 сен  7 20:00 expected
-rw-r--r-- 1 knizhnik knizhnik   2886 сен  7 20:00 fileio.c
-rw-r--r-- 1 knizhnik knizhnik    526 сен  7 20:00 fileio.h
-rw-r--r-- 1 knizhnik knizhnik 370747 сен  7 20:19 func.c
-rw-r--r-- 1 knizhnik knizhnik  15988 сен  7 20:00 func.h
-rw-r--r-- 1 knizhnik knizhnik  79380 сен  7 20:00 imcs--1.1.sql
-rw-r--r-- 1 knizhnik knizhnik 212909 сен  7 20:00 imcs.c
-rw-r--r-- 1 knizhnik knizhnik    130 сен  7 20:00 imcs.control
-rw-r--r-- 1 knizhnik knizhnik  10273 сен  7 20:00 imcs.h
-rw-r--r-- 1 knizhnik knizhnik    154 сен  7 20:00 INSTALL
-rwxr-xr-x 1 knizhnik knizhnik    220 сен  7 20:00 install.sh
-rw-r--r-- 1 knizhnik knizhnik  11325 сен  7 20:00 LICENSE
-rw-r--r-- 1 knizhnik knizhnik   1201 сен  7 20:00 Makefile
-rw-r--r-- 1 knizhnik knizhnik   1499 сен  7 20:00 META.json
-rw-r--r-- 1 knizhnik knizhnik     61 сен  7 20:00 README.md
-rw-r--r-- 1 knizhnik knizhnik  10602 сен  7 20:00 smp.c
-rw-r--r-- 1 knizhnik knizhnik   1919 сен  7 20:00 smp.h
drwxr-xr-x 2 knizhnik knizhnik   4096 сен  7 20:00 sql
-rw-r--r-- 1 knizhnik knizhnik   1249 сен  7 20:00 sysv_shmem.patch
-rw-r--r-- 1 knizhnik knizhnik   3565 сен  7 20:00 threadpool.c
-rw-r--r-- 1 knizhnik knizhnik   5840 сен  7 20:00 tpch.sql
-rw-r--r-- 1 knizhnik knizhnik 113088 сен  7 20:00 user_guide.html

I do not understand why in your case -DIMCS_DISK_SUPPORT is not appended to CFLAGS. But as you can see - it is not present in the listing. Here is output of IMCS build in my case:

 make USE_PGXS=1 USE_DISK=1 clean all install
rm -f imcs.so   libimcs.a  libimcs.pc
rm -f imcs.o func.o smp.o btree.o threadpool.o fileio.o disk.o imcs.bc func.bc smp.bc btree.bc threadpool.bc fileio.bc disk.bc
rm -rf results/ regression.diffs regression.out tmp_check/ tmp_check_iso/ log/ output_iso/
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 -g -O2 -O3 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/home/knizhnik/postgresql.vanilla/dist/include/server -I/home/knizhnik/postgresql.vanilla/dist/include/internal  -D_GNU_SOURCE   -c -o imcs.o imcs.c
imcs.c: In function ‘cs_const_dt’:
imcs.c:2500:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
         val = imcs_timestamp2date(val);
         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
imcs.c:2502:7: note: here
       case TID_int32:
       ^~~~
imcs.c:2506:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
         val = imcs_timestamp2time(val);
         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
imcs.c:2508:7: note: here
       case TID_int64:
       ^~~~
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 -g -O2 -O3 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/home/knizhnik/postgresql.vanilla/dist/include/server -I/home/knizhnik/postgresql.vanilla/dist/include/internal  -D_GNU_SOURCE   -c -o func.o func.c
func.c: In function ‘murmur_hash3_32’:
func.c:4835:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
         k1 ^= tail[2] << 16;
         ~~~^~~~~~~~~~~~~~~~
func.c:4837:7: note: here
       case 2:
       ^~~~
func.c:4838:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
         k1 ^= tail[1] << 8;
         ~~~^~~~~~~~~~~~~~~
func.c:4840:7: note: here
       case 1:
       ^~~~
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 -g -O2 -O3 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/home/knizhnik/postgresql.vanilla/dist/include/server -I/home/knizhnik/postgresql.vanilla/dist/include/internal  -D_GNU_SOURCE   -c -o smp.o smp.c
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 -g -O2 -O3 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/home/knizhnik/postgresql.vanilla/dist/include/server -I/home/knizhnik/postgresql.vanilla/dist/include/internal  -D_GNU_SOURCE   -c -o btree.o btree.c
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 -g -O2 -O3 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/home/knizhnik/postgresql.vanilla/dist/include/server -I/home/knizhnik/postgresql.vanilla/dist/include/internal  -D_GNU_SOURCE   -c -o threadpool.o threadpool.c
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 -g -O2 -O3 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/home/knizhnik/postgresql.vanilla/dist/include/server -I/home/knizhnik/postgresql.vanilla/dist/include/internal  -D_GNU_SOURCE   -c -o fileio.o fileio.c
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 -g -O2 -O3 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/home/knizhnik/postgresql.vanilla/dist/include/server -I/home/knizhnik/postgresql.vanilla/dist/include/internal  -D_GNU_SOURCE   -c -o disk.o disk.c
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 -g -O2 -O3 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -shared -o imcs.so imcs.o func.o smp.o btree.o threadpool.o fileio.o disk.o -L/home/knizhnik/postgresql.vanilla/dist/lib    -Wl,--as-needed -Wl,-rpath,'/home/knizhnik/postgresql.vanilla/dist/lib',--enable-new-dtags -O3 -Wall -pthread -DIMCS_DISK_SUPPORT  -lm 
/bin/mkdir -p '/home/knizhnik/postgresql.vanilla/dist/lib'
/bin/mkdir -p '/home/knizhnik/postgresql.vanilla/dist/share/extension'
/bin/mkdir -p '/home/knizhnik/postgresql.vanilla/dist/share/extension'
/usr/bin/install -c -m 755  imcs.so '/home/knizhnik/postgresql.vanilla/dist/lib/imcs.so'
/usr/bin/install -c -m 644 .//imcs.control '/home/knizhnik/postgresql.vanilla/dist/share/extension/'
/usr/bin/install -c -m 644 .//imcs--1.1.sql  '/home/knizhnik/postgresql.vanilla/dist/share/extension/'

May be you are using some other make version (not GNU make?)

pavitrakumar78 commented 4 years ago

Sorry, but it seems to be not exactly the master branch. At least size of Makefile is different:

I was cloning the repo into a different filesystem so the sizes were a bit different, but I'm now downloading it on the same filesystem as ubuntu installation and here are the outputs:

pk@PavitrakumarPC:~$ git clone -b master https://github.com/knizhnik/imcs.git
Cloning into 'imcs'...
remote: Enumerating objects: 26, done.
remote: Counting objects: 100% (26/26), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 604 (delta 13), reused 18 (delta 7), pack-reused 578
Receiving objects: 100% (604/604), 658.27 KiB | 998.00 KiB/s, done.
Resolving deltas: 100% (412/412), done.
pk@PavitrakumarPC:~$ cd imcs
pk@PavitrakumarPC:~/imcs$ ls -l
total 1209
-rw-r--r-- 1 pk pk   2546 Sep 24 13:34 CHANGES
-rw-r--r-- 1 pk pk    154 Sep 24 13:34 INSTALL
-rw-r--r-- 1 pk pk  11325 Sep 24 13:34 LICENSE
-rw-r--r-- 1 pk pk   1285 Sep 24 13:34 META.json
-rw-r--r-- 1 pk pk   1268 Sep 24 13:34 Makefile
-rw-r--r-- 1 pk pk     61 Sep 24 13:34 README.md
-rw-r--r-- 1 pk pk   7836 Sep 24 13:34 about.txt
-rw-r--r-- 1 pk pk  42518 Sep 24 13:34 btree.c
-rw-r--r-- 1 pk pk   3367 Sep 24 13:34 btree.h
-rw-r--r-- 1 pk pk   9533 Sep 24 13:34 disk.c
-rw-r--r-- 1 pk pk   2689 Sep 24 13:34 disk.h
-rw-r--r-- 1 pk pk   4062 Sep 24 13:34 example.sql
drwxr-xr-x 1 pk pk    512 Sep 24 13:34 expected
-rw-r--r-- 1 pk pk   2886 Sep 24 13:34 fileio.c
-rw-r--r-- 1 pk pk    526 Sep 24 13:34 fileio.h
-rw-r--r-- 1 pk pk 370695 Sep 24 13:34 func.c
-rw-r--r-- 1 pk pk  15988 Sep 24 13:34 func.h
-rw-r--r-- 1 pk pk  79380 Sep 24 13:34 imcs--1.1.sql
-rw-r--r-- 1 pk pk 212891 Sep 24 13:34 imcs.c
-rw-r--r-- 1 pk pk     54 Sep 24 13:34 imcs.conf
-rw-r--r-- 1 pk pk    130 Sep 24 13:34 imcs.control
-rw-r--r-- 1 pk pk  10273 Sep 24 13:34 imcs.h
-rwxr-xr-x 1 pk pk    220 Sep 24 13:34 install.sh
-rw-r--r-- 1 pk pk  10602 Sep 24 13:34 smp.c
-rw-r--r-- 1 pk pk   1919 Sep 24 13:34 smp.h
drwxr-xr-x 1 pk pk    512 Sep 24 13:34 sql
-rw-r--r-- 1 pk pk   1249 Sep 24 13:34 sysv_shmem.patch
-rw-r--r-- 1 pk pk   3565 Sep 24 13:34 threadpool.c
-rw-r--r-- 1 pk pk   5840 Sep 24 13:34 tpch.sql
-rw-r--r-- 1 pk pk 113088 Sep 24 13:34 user_guide.html
pk@PavitrakumarPC:~/imcs$ cat Makefile
# *-------------------------------------------------------------------------
# *
# * Makefile
# *
# *
# *
# * Copyright (c) 2013, Konstantin Knizhnik, ww.garret.ru
# * Author: Konstantin Knizhnik <knizhnik@garret.ru>
# *
# *       $Id: Makefile 28 2013-10-10 17:18:31Z lptolik $
# *
# *-------------------------------------------------------------------------

MODULE_big = imcs

CUSTOM_COPT = -O0 -Wall -pthread
IMCS_VERSION=1.06

ifdef USE_DISK
OBJS = imcs.o func.o smp.o btree.o threadpool.o fileio.o disk.o
CUSTOM_COPT += -DIMCS_DISK_SUPPORT
else
OBJS = imcs.o func.o smp.o btree.o threadpool.o
endif

EXTENSION = imcs
DATA = imcs--1.1.sql
REGRESS = create span operators math datetime transform scalarop grandagg groupbyagg gridagg windowagg hashagg cumagg sort spec drop
REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/imcs/imcs.conf

SHLIB_LINK += $(filter -lm, $(LIBS))

ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/imcs
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif

distrib:
        rm -f *.o
        rm -rf results/ regression.diffs regression.out tmp_check/ log/
        cd .. ; tar --exclude=.svn -chvzf imcs-$(IMCS_VERSION).tar.gz imcs
pk@PavitrakumarPC:~/imcs$ make USE_PGXS=1 USE_DISK=1 clean all install
rm -f imcs.so   libimcs.a  libimcs.pc
rm -f imcs.o func.o smp.o btree.o threadpool.o fileio.o disk.o imcs.bc func.bc smp.bc btree.bc threadpool.bc fileio.bc disk.bc
rm -rf results/ regression.diffs regression.out tmp_check/ tmp_check_iso/ log/ output_iso/
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o imcs.o imcs.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o func.o func.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o smp.o smp.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o btree.o btree.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o threadpool.o threadpool.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o fileio.o fileio.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o disk.o disk.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread -DIMCS_DISK_SUPPORT -fPIC -shared -o imcs.so imcs.o func.o smp.o btree.o threadpool.o fileio.o disk.o -L/usr/lib/x86_64-linux-gnu  -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -L/usr/lib/llvm-6.0/lib  -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,--as-needed -O0 -Wall -pthread -DIMCS_DISK_SUPPORT  -lm
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o imcs.bc imcs.c
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o func.bc func.c
func.c:6206:30: warning: field 'fcinfo' with variable sized type 'FunctionCallInfoBaseData' (aka
      'struct FunctionCallInfoBaseData') not at the end of a struct or class is a GNU extension
      [-Wgnu-variable-sized-type-not-at-end]
    FunctionCallInfoBaseData fcinfo;
                             ^
1 warning generated.
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o smp.bc smp.c
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o btree.bc btree.c
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o threadpool.bc threadpool.c
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o fileio.bc fileio.c
/usr/bin/clang-6.0 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5 -flto=thin -emit-llvm -c -o disk.bc disk.c
disk.c:31:46: error: unknown type name 'imcs_page_access_mode_t'
imcs_page_t* imcs_load_page(imcs_page_t* pg, imcs_page_access_mode_t mode)
                                             ^
disk.c:52:25: error: use of undeclared identifier 'PM_READ_ONLY'
            if (mode != PM_READ_ONLY) { /* page will be updated */
                        ^
disk.c:59:20: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99
      [-Wimplicit-function-declaration]
            return IMCS_PAGE_DATA(cache, pid);
                   ^
disk.c:59:20: warning: incompatible integer to pointer conversion returning 'int' from a function with result type
      'imcs_page_t *' (aka 'struct imcs_page_t_ *') [-Wint-conversion]
            return IMCS_PAGE_DATA(cache, pid);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:88:18: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99
      [-Wimplicit-function-declaration]
            pg = IMCS_PAGE_DATA(cache, pid);
                 ^
disk.c:88:16: warning: incompatible integer to pointer conversion assigning to 'imcs_page_t *'
      (aka 'struct imcs_page_t_ *') from 'int' [-Wint-conversion]
            pg = IMCS_PAGE_DATA(cache, pid);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:94:17: error: use of undeclared identifier 'PM_NEW'
    if (mode != PM_NEW) {
                ^
disk.c:96:14: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99
      [-Wimplicit-function-declaration]
        pg = IMCS_PAGE_DATA(cache, pid);
             ^
disk.c:96:12: warning: incompatible integer to pointer conversion assigning to 'imcs_page_t *'
      (aka 'struct imcs_page_t_ *') from 'int' [-Wint-conversion]
        pg = IMCS_PAGE_DATA(cache, pid);
           ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:102:17: error: use of undeclared identifier 'PM_READ_ONLY'
    if (mode != PM_READ_ONLY) { /* include page in dirty list */
                ^
disk.c:114:12: warning: implicit declaration of function 'IMCS_PAGE_DATA' is invalid in C99
      [-Wimplicit-function-declaration]
    return IMCS_PAGE_DATA(cache, pid);
           ^
disk.c:114:12: warning: incompatible integer to pointer conversion returning 'int' from a function with result type
      'imcs_page_t *' (aka 'struct imcs_page_t_ *') [-Wint-conversion]
    return IMCS_PAGE_DATA(cache, pid);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
disk.c:134:1: error: expected identifier or '('
{
^
disk.c:160:21: error: too many arguments provided to function-like macro invocation
void imcs_disk_open(void)
                    ^
./disk.h:72:9: note: macro 'imcs_disk_open' defined here
#define imcs_disk_open()
        ^
disk.c:160:6: error: variable has incomplete type 'void'
void imcs_disk_open(void)
     ^
disk.c:160:20: error: expected ';' after top level declarator
void imcs_disk_open(void)
                   ^
                   ;
disk.c:165:22: error: too many arguments provided to function-like macro invocation
void imcs_disk_close(void)
                     ^
./disk.h:73:9: note: macro 'imcs_disk_close' defined here
#define imcs_disk_close()
        ^
disk.c:177:22: error: too many arguments provided to function-like macro invocation
void imcs_disk_flush(void)
                     ^
./disk.h:74:9: note: macro 'imcs_disk_flush' defined here
#define imcs_disk_flush()
        ^
8 warnings and 10 errors generated.
/usr/lib/postgresql/12/lib/pgxs/src/makefiles/../../src/Makefile.global:1044: recipe for target 'disk.bc' failed
make: *** [disk.bc] Error 1
pk@PavitrakumarPC:~/imcs$ make -v
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
pk@PavitrakumarPC:~/imcs$

The file sizes pretty much match up and the minor differences are due to OS differences probably?

I do not understand why in your case -DIMCS_DISK_SUPPORT is not appended to CFLAGS. But as you can see - it is not present in the listing.

And also DIMCS_DISK_SUPPORT is added in the gcc command flags - is that what you were referring to?

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -O0 -Wall -pthread **-DIMCS_DISK_SUPPORT** -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o imcs.o imcs.c

May be you are using some other make version (not GNU make?)

Nope. I'm using GNU Make 4.1 (default in Ubuntu I think?) and I've also added the output of make -v to the log above.

This is very weird... Could the differences between wsl and pure ubuntu installation be throwing this off? I'll try to spin up a fresh instance (non-WSL) and let you know the results.

pavitrakumar78 commented 4 years ago

@knizhnik I just launched a fresh Ubuntu instance and tested this out. Still getting the same error. Can I send you the credentials of the server (ssh) via email that is on your github profile so that you can test it out?

knizhnik commented 4 years ago

The problem ius caused by --enable-llvm support. It is using clang to generate LLVM code and is not substituting CUSTOM_COPTS in this case. I sent the question to hackers mailing list and hope that Andres will help me to find the solution. Right now I can only recommend you either not to configure Postgres with LLVM support, either hardcode #define IMCS_DISK_SUPPORT in imcs.h

pavitrakumar78 commented 4 years ago

Thanks for figuring out the cause of the issue. I just tried your suggestion of just adding #define IMCS_DISK_SUPPORT in imcs.h it installed without any issues, but on restarting db, I get now get this error:

2020-09-24 22:26:58.031 IST [11560] FATAL:  58P01: could not load library "/usr/lib/postgresql/12/lib/imcs.so": /usr/lib/postgresql/12/lib/imcs.so: undefined symbol: imcs_unload_page                                                      
2020-09-24 22:26:58.031 IST [11560] LOCATION:  internal_load_library, dfmgr.c:248
knizhnik commented 4 years ago

Sorry, I can not reproduce the problem,. Please check that you have done "make clean"

pavitrakumar78 commented 4 years ago

Sorry, I can not reproduce the problem,. Please check that you have done "make clean"

Thank you. I can now install without any errors and can verify that imcs does save the loaded table on the drive.

Should I leave this issue open incase you hear back from your mailing list question?

knizhnik commented 4 years ago

I already committed the suggested patch

pavitrakumar78 commented 4 years ago

I already committed the suggested patch

Sorry, I did not notice. Thank you! I will close this now.