| From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Andres Freund <andres(at)anarazel(dot)de> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Defend against -ffast-math in meson builds |
| Date: | 2026-03-12 07:11:45 |
| Message-ID: | abJnMYy0R/HRdlJ+@ip-10-97-1-34.eu-west-3.compute.internal |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Wed, Mar 11, 2026 at 02:10:54PM -0400, Andres Freund wrote:
> Hi,
>
> > it compiles fine with CFLAGS="-ffast-math" CC="gcc" meson setup meson_build but
> > produces issues during the regression tests.
>
> This fails to build here as expected.
>
> Are you sure that you actually specified it during meson setup and then didn't
> reconfigure while the CFLAGs aren't specified?
I was doing:
CFLAGS="-ffast-math" CC="gcc" meson setup meson_build
cd meson_build
meson configure -Db_coverage=true -Dbuildtype=debug -Dprefix=${PGINSTROOT} -Dpgport=${PGPORT} -Ddtrace=enabled -Dc_args="-Og -frecord-gcc-switches"
ninja -v
ninja -v install
to produce the oddity.
>
> > I just had a closer look and it looks like that the reason is that it's being
> > added at link time:
> >
> > $ cat meson_build/build.ninja | grep LINK_ARGS | grep -c "ffast-math"
> > 254
>
> It's added to both, compile and link args, afaict?
>
> andres(at)awork3:/tmp/pg-fast-math$ grep ffast-math build.ninja |awk '{print $1}'|sort|uniq -c
> 1679 ARGS
> 255 LINK_ARGS
That's right (and fails at compilation time) if doing a one step approach:
CFLAGS="-ffast-math -Og -frecord-gcc-switches" CC="gcc" meson setup meson_build -Db_coverage=true -Dbuildtype=debug -Dprefix=${PGINSTROOT} -Dpgport=${PGPORT} -Ddtrace=enabled
So, it's possible to produce this oddity with meson with the 2 steps approach,
while I don't think that would be possible with autoconf. That's why I think
the guard in meson.build would be a good thing to have, thoughts?
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Frédéric Yhuel | 2026-03-12 07:47:02 | Re: n_dead_tup could be way off just after a vacuum |
| Previous Message | Pavel Stehule | 2026-03-12 07:00:19 | Re: POC: PLpgSQL FOREACH IN JSON ARRAY |