View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000830 | Pgpool-II | Bug | public | 2024-03-06 16:25 | 2024-03-07 19:23 |
| Reporter | changqing li | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | new | Resolution | open | ||
| Product Version | 4.4.1 | ||||
| Summary | 0000830: build failure for snprintf.c | ||||
| Description | in src/parser/snprintf.c, PG_STRERROR_R_BUFLEN is used, but it is defined by postgresql. libpq-dev: postgresql/internal/port.h or postgresql-server-dev: postgresql/[version]/server/port.h But in src/parser/snprintf.c, None of above header is included, so when build for 32-bit target, it will failed like: | snprintf.c:770:64: error: 'PG_STRERROR_R_BUFLEN' undeclared (first use in this function) | 770 | char errbuf[PG_STRERROR_R_BUFLEN]; | | ^~~~~~~~~~~~~~~~~~~~ I tried to add #include <postgresql/server/port.h> above issue is fixed. but we might met another error: In file included from snprintf.c:49: TOPDIR/build/tmp/work/core2-32-yoe-linux/pgpool2/4.4.1/recipe-sysroot/usr/include/postgresql/server/port.h:488:28: error: a parameter list without types is only allowed in a function definition 488 | typedef void (*pqsigfunc) (SIGNAL_ARGS); | so finnally we need to add following headers. but I am not quite sure if this is ok, so please help to review it. Thanks. #include <postgresql/server/port.h> #include <postgresql/server/postgres_fe.h> | ||||
| Steps To Reproduce | I am doing cross compile using yocto project, the steps maybe a little complicate. if you have a patch to fix this, I can test it in my environment. Of course, if you need, I can also add my steps here. | ||||
| Tags | No tags attached. | ||||
|
|
NOTE: About following issue: in file included from snprintf.c:49: TOPDIR/build/tmp/work/core2-32-yoe-linux/pgpool2/4.4.1/recipe-sysroot/usr/include/postgresql/server/port.h:488:28: error: a parameter list without types is only allowed in a function definition 488 | typedef void (*pqsigfunc) (SIGNAL_ARGS); This issue can be reproduce with postgresql 16.2, but cannot reproduce with postgresql 15.5, since postgresql 16.2 have some changes in port.h |
|
|
And I think snprintf.c need to include port.h, so PG_STRERROR_R_BUFLEN can be found. About SIGNAL_ARGS, it should be postgresql's issue, I will report it to postgresql |
|
|
On most linux platforms src/parser/snprintf.c does not need to be compiled because pgpool uses glibc's snprintf. Is your target platform something exotic? |
|
|
in postgresql, SIGNAL_ARGS is defined in c.h, so I tried locally, include c.h in port.h, this error " error: a parameter list without types is only allowed in a function definition" disappear. But I met another issue: | In file included from snprintf.c:49: | In file included from /builds/systemd/tmp/work/core2-32-poky-linux/pgpool2/4.4.1/recipe-sysroot/usr/include/postgresql/server/port.h:17: | /builds/systemd/tmp/work/core2-32-poky-linux/pgpool2/4.4.1/recipe-sysroot/usr/include/postgresql/server/c.h:888:13: error: conflicting types for 'ExceptionalCondition' | 888 | extern void ExceptionalCondition(const char *conditionName, | | ^ | ../../src/include/parser/../pool_type.h:114:13: note: previous declaration is here | 114 | extern void ExceptionalCondition(const char *conditionName, both pool_type.h under pgpool2 and c.h under postgresql have ExceptionalCondition. Any suggestion about how to fix this? one idea is just define PG_STRERROR_R_BUFLEN as 256, same as port.h, so that we don't need to include port.h. But hardcode is not good. if value of PG_STRERROR_R_BUFLEN changed in port.h, we hard to know it unless we met issue. |
|
|
The target platform is qemux86, a 32bit platform. And after study configure.ac of pgpool2, seems that for 32bits platform, snprintf.c will be compiled. but for 64bits, it will not. |
|
|
seems that under pgpool2, there is a files src/include/parser/pg_config_manual.h, which seems like got from postgresql, and will updated as postgresql upgraded. So I think maybe it is ok to get definition of PG_STRERROR_R_BUFLEN from postgresql, and put it in pg_config_manual.h? |
|
|
Any suggestion about how to fix this? only define PG_STRERROR_R_BUFLEN is not enough. upstream postgresql suggest to include postgresql.h, but it will met above conflict ExceptionalCondition issue. |
|
|
> So I think maybe it is ok to get definition of PG_STRERROR_R_BUFLEN from postgresql, and put it in pg_config_manual.h? I think putting it in pg_config_manual.h should be fine. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2024-03-06 16:25 | changqing li | New Issue | |
| 2024-03-06 16:39 | changqing li | Note Added: 0004493 | |
| 2024-03-06 16:45 | changqing li | Note Added: 0004494 | |
| 2024-03-06 17:31 | t-ishii | Note Added: 0004495 | |
| 2024-03-06 17:37 | changqing li | Note Added: 0004496 | |
| 2024-03-06 17:40 | changqing li | Note Added: 0004497 | |
| 2024-03-06 18:00 | changqing li | Note Added: 0004498 | |
| 2024-03-07 11:47 | changqing li | Note Added: 0004499 | |
| 2024-03-07 19:23 | t-ishii | Note Added: 0004500 |