Re: Broken build on macOS (Universal / Intel): cpuid instruction not available

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tobias Bussmann <t(dot)bussmann(at)gmx(dot)net>
Cc: John Naylor <johncnaylorls(at)gmail(dot)com>, Lukas Fittl <lukas(at)fittl(dot)com>, Jakob Egger <jakob(at)eggerapps(dot)at>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>
Subject: Re: Broken build on macOS (Universal / Intel): cpuid instruction not available
Date: 2026-06-02 18:57:14
Message-ID: bafed2f7-1760-4521-8886-778d5075caa8@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2026-06-02 Tu 11:20 AM, Tom Lane wrote:
> I wrote:
>> However, it definitely is a regression that the build fails
>> altogether. Too bad nobody tried the x86 -> ARM case earlier.
> I replicated this on longfin's host (x86_64 mac mini).
> It seems there are two problems:
>
> 1. pg_cpu.h believes that x86-specific code can be conditional on
>
> #if defined(USE_SSE2) || defined(__i386__)
>
> but macOS doesn't define __i386__, only __x86_64__. It works
> anyway on single-arch builds because the test to set USE_SSE2
> succeeds, but not on multi-arch builds.
>
> 2. checksum.c believes that it's okay to call x86_feature_available
> if USE_AVX2_WITH_RUNTIME_CHECK is set. I didn't track down just
> why that's getting set in a multi-arch build when USE_SSE2 is not,
> but it is, and that's probably good since it means we get at least
> some optimization for x86 Macs. But we have to disregard it when
> we're doing the ARM side.
>
> The attached quick hack makes the build work on my machine.
> I'm hesitant to shove it into the tree though because I'm
> not too certain whether there could be side-effects on
> other platforms. I think the way to proceed for now is for
> EDB to apply this patch in their build of beta1, and we can
> review the patch at leisure afterwards.
>
>

Sandeep tells me he's going to look at that tomorrow.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2026-06-02 19:03:57 Re: BackgroundPsql swallowing errors on windows
Previous Message Andrey Borodin 2026-06-02 18:46:52 Re: injection_points: Switch wait/wakeup to use atomics rather than latches