Re: Compile error on the aarch64 platform: Missing asm/hwcap.h

John Naylor <johncnaylorls@gmail.com>

From: John Naylor <johncnaylorls@gmail.com>
To: 高增琦 <pgf00a@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-14T05:06:08Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix pg_popcount_aarch64.c to build with ancient glibc releases.

  2. Fix pg_crc32c_armv8_choose.c to build with ancient glibc releases.

On Fri, Nov 14, 2025 at 11:02 AM 高增琦 <pgf00a@gmail.com> wrote:
> Compile error on CentOS Linux release 7.6.1810 (AltArch) with the message “‘HWCAP_CRC32’ undeclared”.

We still have at least one CentOS 7 aarch64 machine that gets regular
testing (not sure of the reason, since it's been EOL for a year and a
half IIUC), and it builds fine:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=arowana&dt=2025-11-04%2004%3A56%3A57

> After modifying the code to add `include <asm/hwcap.h>`, the compilation succeeded.

We already have the following, so I'm not sure what you mean (or even
what architecture you're running on):

#if defined(HAVE_ELF_AUX_INFO) || defined(HAVE_GETAUXVAL)
#include <sys/auxv.h>
#if defined(__linux__) && !defined(__aarch64__) && !defined(HWCAP2_CRC32)
#include <asm/hwcap.h>
#endif
#endif

-- 
John Naylor
Amazon Web Services