hapostgres / hapostgres/pg_auto_failover

Build error on centos-6 and oracle linux-6

Open
#200 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.4k
Forks
142
Avg merge
5h 8m
Merged PRs (30d)
1

Description

I have seen following error regarding use of _Static_assert that we recently introduced.

```
make -C pg_autoctl pg_autoctl
make[2]: Entering directory `/root/pg_auto_failover/src/bin/pg_autoctl'
gcc -std=c99 -D_GNU_SOURCE -g -I /usr/pgsql-10/include -I /usr/pgsql-10/include/server -I /usr/pgsql-10/include/internal -I -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wformat -Wall -Wno-missing-braces -I/root/pg_auto_failover/src/bin/pg_autoctl/../lib/pg -I/root/pg_auto_failover/src/bin/pg_autoctl/../lib/log/src/ -I/root/pg_auto_failover/src/bin/pg_autoctl/../lib/subcommands.c/ -I/root/pg_auto_failover/src/bin/pg_autoctl/../lib/libs/ -I/root/pg_auto_failover/src/bin/pg_autoctl/../lib/parson/ -c -o cli_common.o cli_common.c
In file included from monitor.h:17,
from keeper.h:16,
from cli_common.h:16,
from cli_common.c:17:
state.h:108: error: expected declaration specifiers or ‘...’ before ‘sizeof’
state.h:108: error: expected declaration specifiers or ‘...’ before string constant
state.h:108: warning: data definition has no type or storage class
state.h:108: warning: type defaults to ‘int’ in declaration of ‘_Static_assert’
```

Issue can be fixed by putting #ifdef around the line like below

```c
#ifdef _Static_assert
_Static_assert (sizeof(KeeperStateData) < PG_AUTOCTL_KEEPER_STATE_FILE_SIZE, "size of KeeperStateData is larger than expected. please review PG_AUTOCTL_KEEPER_STATE_FILE_SIZE");
#endif
```

We should probably tie this to GCC or OS version

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.