Re: [BUG?] macOS (Intel) build warnings: "ranlib: file … has no symbols" for aarch64 objects

From: John Naylor <johncnaylorls(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Zhang Mingli <zmlpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [BUG?] macOS (Intel) build warnings: "ranlib: file … has no symbols" for aarch64 objects
Date: 2026-04-28 06:18:22
Message-ID: CANWCAZYFAP_fP0RSnor9Aa03aYAvQaM=+8oNeZSV432RNNynkQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 28, 2026 at 2:43 AM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
>
> On Sun, Apr 26, 2026 at 09:31:37PM -0500, Nathan Bossart wrote:
> > On Sun, Apr 26, 2026 at 10:18:33PM -0400, Tom Lane wrote:
> >> I previously suggested that we should teach the build systems not
> >> to build the foo_x86 and foo_aarch64 modules when not on those
> >> architectures. That was shot down for reasons that made no great
> >> amount of sense to me, but I think it'd be fairly easy and clean.
> >
> > Yeah, AFAICT that's our best bet. Will write it up in the morning.

The gift that keeps on giving. ;-)

> Here's what I have so far. Two notes:
>
> * Since pg_popcount_aarch64.c only builds symbols when USE_NEON is defined,
> I needed to teach the build code about that #define. So, this patch
> effectively moves USE_NEON and USE_SSE2 from c.h to pg_config.h, which
> happens to be the first #include within c.h. The reason that I bring this
> up is because back-patching it seems a little scary, although I don't see
> any concrete reasons it would be unsafe.

It'd be a bit unfortunate for those symbols to bleed out into the
build system, so it seems best to minimize the need for that and do as
much as possible with just architecture. src/port/meson.build could do
instead

if host_cpu == 'x86' or host_cpu == 'x86_64'
pgport_sources += files(
'pg_cpu_x86.c',
...etc

(Ditto arm / aarch64) Likewise autoconf.ac could set e.g. PG_ARCH_OBJS
since it knows the host CPU as well. Some files could still guard on
USE_NEON or HAVE_X86_64_POPCNTQ, but at least they wouldn't get built
on the wrong arch. Would that be enough?

--
John Naylor
Amazon Web Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-04-28 06:32:17 Re: Support logical replication of DDLs, take2
Previous Message vignesh C 2026-04-28 06:06:56 Re: Proposal: Conflict log history table for Logical Replication