pgaudit安装(未完)

git clone https://github.com/pgaudit/pgaudit.git
cd pgaudit/
git branch -a
git checkout REL9_5_STABLE
# pg/gp的安装路径
make install USE_PGXS=1 PG_CONFIG=/usr/local/gpdb/bin/pg_config

可能遇到问题:

[gpadmin@dw2-master pgaudit]$ make USE_PGXS=1 PG_CONFIG=/usr/local/gpdb_7/bin/pg_config
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-but-set-variable -Werror=implicit-fallthrough=3 -Wno-format-truncation -Wno-stringop-truncation -O3 -Werror=uninitialized -Werror=implicit-function-declaration -fPIC -I. -I./ -I/usr/local/gpdb_7/include/postgresql/server -I/usr/local/gpdb_7/include/postgresql/internal -D_GNU_SOURCE -I/usr/include/libxml2 -c -o pgaudit.o pgaudit.c
pgaudit.c: In function ‘log_audit_event’:
pgaudit.c:540:24: error: this statement may fall through [-Werror=implicit-fallthrough=]
 if (stackItem->auditEvent.commandText != NULL)
 ^
pgaudit.c:581:17: note: here
 case T_GrantStmt:
 ^~~~
cc1: some warnings being treated as errors
make: *** [<builtin>: pgaudit.o] Error 1

解决方法
这里是编译器将warning当做error了。"src/Makefile.global"中有选项-Werror=implicit-fallthrough=3

参考pg config说明,如下解决

# 推荐
# 这样是在CFLAGS中追加新的选项
export COPT='-Wno-error=implicit-fallthrough'
make USE_PGXS=1 PG_CONFIG=/usr/local/gpdb_7/bin/pg_config
# 或者(不推荐)
# 这样会覆盖原来的CFLAGS
make USE_PGXS=1 CFLAGS='-Wno-error=implicit-fallthrough' PG_CONFIG=/usr/local/gpdb_7/bin/pg_config

https://github.com/pgaudit/pg...
https://github.com/pgaudit/pg...
https://github.com/2ndQuadran...
https://blog.csdn.net/pg_hgdb...
https://stackoverflow.com/que...

作者:黑暗森林原文地址:https://segmentfault.com/a/1190000043129906

%s 个评论

要回复文章请先登录注册