{"action":"opened","issue":{"url":"https://api.github.com/repos/2ndQuadrant/repmgr/issues/261","repository_url":"https://api.github.com/repos/2ndQuadrant/repmgr","labels_url":"https://api.github.com/repos/2ndQuadrant/repmgr/issues/261/labels{/name}","comments_url":"https://api.github.com/repos/2ndQuadrant/repmgr/issues/261/comments","events_url":"https://api.github.com/repos/2ndQuadrant/repmgr/issues/261/events","html_url":"https://github.com/2ndQuadrant/repmgr/issues/261","id":197830897,"number":261,"title":"Build fails if PG version < 9.6 and latest libpq ","user":{"login":"mnencia","id":104862,"avatar_url":"https://avatars.githubusercontent.com/u/104862?v=3","gravatar_id":"","url":"https://api.github.com/users/mnencia","html_url":"https://github.com/mnencia","followers_url":"https://api.github.com/users/mnencia/followers","following_url":"https://api.github.com/users/mnencia/following{/other_user}","gists_url":"https://api.github.com/users/mnencia/gists{/gist_id}","starred_url":"https://api.github.com/users/mnencia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnencia/subscriptions","organizations_url":"https://api.github.com/users/mnencia/orgs","repos_url":"https://api.github.com/users/mnencia/repos","events_url":"https://api.github.com/users/mnencia/events{/privacy}","received_events_url":"https://api.github.com/users/mnencia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-28T10:27:25Z","updated_at":"2016-12-28T10:27:25Z","closed_at":null,"body":"This makes impossible to build Debian/Ubuntu packages\r\n\r\nThe PG module part detects the libpq version instead of the postgres one, so the conditional tries to include `fe_utils/string_utils.h` instead of `compat.h` on ver < 9.6\r\n\r\n```\r\ngcc -g -O2 -fdebug-prefix-map=/build/postgresql-9.3-9zvUmb/postgresql-9.3-9.3.15=. -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/mit-krb5 -fPIC -pie -DLINUX_OOM_SCORE_ADJ=0 -fno-omit-frame-pointer -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -I/usr/include/postgresql/internal -I/usr/include/postgresql -I. -I./ -I/usr/include/postgresql/9.3/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/tcl8.6  -c -o check_dir.o check_dir.c\r\n07:53:43 gcc -g -O2 -fdebug-prefix-map=/build/postgresql-9.3-9zvUmb/postgresql-9.3-9.3.15=. -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/mit-krb5 -fPIC -pie -DLINUX_OOM_SCORE_ADJ=0 -fno-omit-frame-pointer -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -I/usr/include/postgresql/internal -I/usr/include/postgresql -I. -I./ -I/usr/include/postgresql/9.3/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/tcl8.6  -c -o repmgr.o repmgr.c\r\nrepmgr.c:69:35: fatal error: fe_utils/string_utils.h: No such file or directory\r\n#include \"fe_utils/string_utils.h\"\r\n                                    ^\r\ncompilation terminated.\r\n```\r\n\r\nThis happens because `PG_VERSION_NUM` is taken from `-I/usr/include/postgresql` instead of from `-I/usr/include/postgresql/9.3/server`. Both these path contain `pg_config.h`, and the first one takes precedence\r\n\r\nDebian packaging slightly patch the Makefile to make it working, you can find the patch here https://anonscm.debian.org/cgit/pkg-postgresql/repmgr.git/tree/debian/patches/makefile-libpq-internal.patch\r\nOne possible solution is to change pg_CPPFLAGS as the following\r\n\r\n```\r\nPG_CPPFLAGS = -I$(includedir_internal) -I$(includedir_server) -I$(libpq_srcdir)\r\n```\r\n\r\nbut the compiler will start complaining about redefined contants\r\n\r\n```\r\nIn file included from /usr/include/postgresql/internal/postgres_fe.h:25:0,\r\n                 from dirmod.c:26:\r\n/usr/include/postgresql/internal/c.h:312:0: warning: \"INT64_FORMAT\" redefined\r\n #define INT64_FORMAT \"%\" INT64_MODIFIER \"d\"\r\n\r\nIn file included from /usr/include/postgresql/internal/c.h:53:0,\r\n                 from /usr/include/postgresql/internal/postgres_fe.h:25,\r\n                 from dirmod.c:26:\r\n/usr/include/postgresql/9.3/server/pg_config.h:664:0: note: this is the location of the previous definition\r\n #define INT64_FORMAT \"%ld\"\r\n\r\nIn file included from /usr/include/postgresql/internal/postgres_fe.h:25:0,\r\n                 from dirmod.c:26:\r\n/usr/include/postgresql/internal/c.h:313:0: warning: \"UINT64_FORMAT\" redefined\r\n #define UINT64_FORMAT \"%\" INT64_MODIFIER \"u\"\r\n\r\nIn file included from /usr/include/postgresql/internal/c.h:53:0,\r\n                 from /usr/include/postgresql/internal/postgres_fe.h:25,\r\n                 from dirmod.c:26:\r\n/usr/include/postgresql/9.3/server/pg_config.h:759:0: note: this is the location of the previous definition\r\n #define UINT64_FORMAT \"%lu\"\r\n```\r\n\r\nThe root issue here is that the repmgr makefile mixes backend with frontend code. \r\n\r\nI think that the proper fix for that is too complex to be fixed by the packager."}}
{"actor":{"display_login":"mnencia"}}