same behaviour for 8.2.2; same workaround.
> On 2 Sep 2023, at 21:11, Liviu Ionescu <i...@livius.net> wrote:
>
> When trying to build 8.1.0 on an Ubuntu 18.04 aarch64, I get the above error.
>
> The offending code in `/util/cpuinfo-aarch64.c` is:
>
> ```c
> #ifdef CONFIG_LINUX
> unsigned long hwcap = qemu_getauxval(AT_HWCAP);
> info |= (hwcap & HWCAP_ATOMICS ? CPUINFO_LSE : 0);
> info |= (hwcap & HWCAP_USCAT ? CPUINFO_LSE2 : 0);
> info |= (hwcap & HWCAP_AES ? CPUINFO_AES: 0);
> #endif
> ```
>
> The reason is that on this distribution the <bits/hwcap.h> header file does
> not define HWCAP_USCAT:
>
> ```
> root@9c7ad90af4f8:/# cat /usr/include/aarch64-linux-gnu/bits/hwcap.h
> /* Defines for bits in AT_HWCAP. AArch64 Linux version.
> Copyright (C) 2016-2018 Free Software Foundation, Inc.
> This file is part of the GNU C Library.
>
> The GNU C Library is free software; you can redistribute it and/or
> modify it under the terms of the GNU Lesser General Public
> License as published by the Free Software Foundation; either
> version 2.1 of the License, or (at your option) any later version.
>
> The GNU C Library is distributed in the hope that it will be useful,
> but WITHOUT ANY WARRANTY; without even the implied warranty of
> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> Lesser General Public License for more details.
>
> You should have received a copy of the GNU Lesser General Public
> License along with the GNU C Library; if not, see
> <http://www.gnu.org/licenses/>. */
>
> #if !defined (_SYS_AUXV_H)
> # error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
> #endif
>
> /* The following must match the kernel's <asm/hwcap.h>. */
> #define HWCAP_FP (1 << 0)
> #define HWCAP_ASIMD (1 << 1)
> #define HWCAP_EVTSTRM (1 << 2)
> #define HWCAP_AES (1 << 3)
> #define HWCAP_PMULL (1 << 4)
> #define HWCAP_SHA1 (1 << 5)
> #define HWCAP_SHA2 (1 << 6)
> #define HWCAP_CRC32 (1 << 7)
> #define HWCAP_ATOMICS (1 << 8)
> #define HWCAP_FPHP (1 << 9)
> #define HWCAP_ASIMDHP (1 << 10)
> #define HWCAP_CPUID (1 << 11)
> #define HWCAP_ASIMDRDM (1 << 12)
> #define HWCAP_JSCVT (1 << 13)
> #define HWCAP_FCMA (1 << 14)
> #define HWCAP_LRCPC (1 << 15)
> #define HWCAP_DCPOP (1 << 16)
> #define HWCAP_SHA3 (1 << 17)
> #define HWCAP_SM3 (1 << 18)
> #define HWCAP_SM4 (1 << 19)
> #define HWCAP_ASIMDDP (1 << 20)
> #define HWCAP_SHA512 (1 << 21)
> #define HWCAP_SVE (1 << 22)
> root@9c7ad90af4f8:/#
> ```
>
> The full list of definitions should include:
>
> ```
> #define HWCAP_ASIMDFHM (1 << 23)
> #define HWCAP_DIT (1 << 24)
> #define HWCAP_USCAT (1 << 25)
> #define HWCAP_ILRCPC (1 << 26)
> #define HWCAP_FLAGM (1 << 27)
> #define HWCAP_SSBS (1 << 28)
> ```
>
> I don't know the meaning behind these bits, and how important is for QEMU to
> correctly identify them all.
>
> Since I know my build environment, my quick and dirty workaround was to pass
> the definition via the preprocessor options:
>
> ```
> CPPFLAGS+=" -DHWCAP_USCAT=(1<<25)"
> ```
>
> However, for QEMU this is not a solution.
>
> A possible solution would be to compile the code conditionally:
>
> ```
> #ifdef CONFIG_LINUX
> unsigned long hwcap = qemu_getauxval(AT_HWCAP);
> info |= (hwcap & HWCAP_ATOMICS ? CPUINFO_LSE : 0);
> #ifdef HWCAP_USCAT
> info |= (hwcap & HWCAP_USCAT ? CPUINFO_LSE2 : 0);
> #endif
> info |= (hwcap & HWCAP_AES ? CPUINFO_AES: 0);
> #endif
> ```
>
> I don't know if other distributions are also affected, my build platform for
> all xPack standalone binaries is Ubuntu 18.04 LTS.
>
> I know that 18.04 is an old version, but I use the xPack QEMU mainly to run
> unit tests, and in some enterprise environments the machines used for testing
> are sometimes pretty outdated, thus 18.04 will remain the base build platform
> for a while.
>
> It would be very nice if QEMU would still compile on Ubuntu 18.04, as it did
> before 8.1.0.
>
>
>
> Regards,
>
> Liviu
>