| From: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
|---|---|
| To: | skandigraun(at)gmail(dot)com |
| Cc: | pgpool-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Compiling issues for 32-bit targets |
| Date: | 2025-09-17 23:58:16 |
| Message-ID: | 20250918.085816.1591426349627091974.ishii@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-hackers |
> Gyorgy Sarvari <skandigraun(at)gmail(dot)com> pointed out that snprintf.c has
> issues when compiled on 32-bit targets:
> https://github.com/pgpool/pgpool2/pull/128
>
>> the compiler was complaining about undefined isnan and ininf functions in
>> snprintf.c file
>
> (Moreover he pointed out another issue. will discuss later on)
>
>> When building for 32-bit arm arch, compilation fails with the following error:
>> | snprintf.c: In function 'fmtfloat':
>> | snprintf.c:1232:13: error: implicit declaration of function 'isnan' [-Wimplicit-function-declaration]
>> | 1232 | if (isnan(value))
>> | | ^~~~~
>> | snprintf.c:50:1: note: include '<math.h>' or provide a declaration of 'isnan'
>> | 49 | #include "postgresql/server/port.h"
>> | +++ |+#include <math.h>
>> | 50 |
>> | snprintf.c:1254:21: error: implicit declaration of function 'isinf' [-Wimplicit-function-declaration]
>> | 1254 | if (isinf(value))
>> | | ^~~~~
>> | snprintf.c:1254:21: note: include '<math.h>' or provide a declaration of 'isinf'
>>
>> To avoid the error, add math.h to snprintf.c.
>
> I think his idea is good. snprintf.c was imported from PostgreSQL long
> time ago. If we look into the original file (src/port/snprintf.c) it
> actually has "#include <math.h>" already.
>
> If there's no objection, I will push attached patch to all supported
> branches. It not only adds math.h, but remove ancient ruin "#if 0" and
> sort out the order of including files.
Patch pushd to all supported branches. Thanks.
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nadav Shatz | 2025-09-20 23:57:34 | Re: Proposal: recent access based routing for primary-replica setups |
| Previous Message | Tatsuo Ishii | 2025-09-17 10:47:36 | Compiling issues for 32-bit targets |