/util/cpuinfo-aarch64.c:58:22: error: 'HWCAP_USCAT' undeclared

2023-09-02 Thread Liviu Ionescu
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  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
   .  */

#if !defined (_SYS_AUXV_H)
# error "Never include  directly; use  instead."
#endif

/* The following must match the kernel's .  */
#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




Re: /util/cpuinfo-aarch64.c:58:22: error: 'HWCAP_USCAT' undeclared

2023-09-02 Thread Marcin Juszkiewicz

W dniu 2.09.2023 o 20:11, Liviu Ionescu pisze:

When trying to build 8.1.0 on an Ubuntu 18.04 aarch64, I get the
above error.


Ubuntu 18.04 is not supported anymore by Canonical. End-Of-Life was in
May 2023.


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  header
file does not define HWCAP_USCAT:


I would recommend either upgrading your distro or staying at QEMU 8.1
release.

HWCAP_USCAT was added to glibc in June 2018. As your distribution is not 
supported anymore you can also patch glibc in your system.



I don't know if other distributions are also affected, my build
platform for all xPack standalone binaries is Ubuntu 18.04 LTS.


I do not know any supported distribution release without it.


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.




Re: /util/cpuinfo-aarch64.c:58:22: error: 'HWCAP_USCAT' undeclared

2023-09-02 Thread Michael Tokarev

02.09.2023 23:01, Marcin Juszkiewicz wrote:
...

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  header
file does not define HWCAP_USCAT:


I would recommend either upgrading your distro or staying at QEMU 8.1
release.

HWCAP_USCAT was added to glibc in June 2018. As your distribution is not 
supported anymore you can also patch glibc in your system.


I don't know if other distributions are also affected, my build
platform for all xPack standalone binaries is Ubuntu 18.04 LTS.


I do not know any supported distribution release without it.


In this very case it's trivial to work-around this by using

#ifndef HWCAP_USCAT
# define HWCAP_USCAT 0
#endif

or just commenting-out this line.

But 18.04 being unsupported is true still.

/mjt




Re: /util/cpuinfo-aarch64.c:58:22: error: 'HWCAP_USCAT' undeclared

2024-04-01 Thread Liviu Ionescu
same behaviour for 8.2.2; same workaround.

> On 2 Sep 2023, at 21:11, Liviu Ionescu  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  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
>   .  */
> 
> #if !defined (_SYS_AUXV_H)
> # error "Never include  directly; use  instead."
> #endif
> 
> /* The following must match the kernel's .  */
> #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
> 




Re: /util/cpuinfo-aarch64.c:58:22: error: 'HWCAP_USCAT' undeclared

2024-04-01 Thread Richard Henderson

On 4/1/24 08:08, Liviu Ionescu wrote:

same behaviour for 8.2.2; same workaround.


On 2 Sep 2023, at 21:11, Liviu Ionescu  wrote:

When trying to build 8.1.0 on an Ubuntu 18.04 aarch64, I get the above error.


You were told back in September that Ubuntu 18.04 is no longer supported.
The passage of 6 months has not changed that.


r~



Re: /util/cpuinfo-aarch64.c:58:22: error: 'HWCAP_USCAT' undeclared

2024-04-01 Thread Liviu Ionescu



> On 1 Apr 2024, at 21:48, Richard Henderson  
> wrote:
> 
> You were told back in September that Ubuntu 18.04 is no longer supported.

Sorry, I missed that.

BTW, according to ubuntu.com: "With Ubuntu Pro, the 18.04 LTS will be fully 
supported until 2028.".


Regards,

Liviu




Re: /util/cpuinfo-aarch64.c:58:22: error: 'HWCAP_USCAT' undeclared

2024-04-01 Thread Marcin Juszkiewicz

W dniu 1.04.2024 o 21:55, Liviu Ionescu pisze:

On 1 Apr 2024, at 21:48, Richard
Henderson  wrote:

You were told back in September that Ubuntu 18.04 is no longer
supported.

Sorry, I missed that.

BTW, according to ubuntu.com: "With Ubuntu Pro, the 18.04 LTS will be
fully supported until 2028.".


So ask Ubuntu Pro team for support?

QEMU team does not support Ubuntu 18.04. And several other distributions.



Re: /util/cpuinfo-aarch64.c:58:22: error: 'HWCAP_USCAT' undeclared

2024-04-01 Thread Liviu Ionescu



> On 1 Apr 2024, at 23:04, Marcin Juszkiewicz  
> wrote:
> 
> So ask Ubuntu Pro team for support?

I did not ask for support, I just notified the community of an issue I 
encountered while building the latest sources, driven by a sincere desire to 
improve the project.

If this bothered you, I apologise.

Liviu