All of lore.kernel.org
 help / color / mirror / Atom feed
* [hotfix PATCH-for-8.1 v2] meson: Fix cross-building for RISCV host
@ 2023-07-11  9:25 Philippe Mathieu-Daudé
  2023-07-11  9:35 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-07-11  9:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Philippe Mathieu-Daudé,
	Paolo Bonzini, Daniel P. Berrangé,
	Michael Tokarev, Alistair Francis, Marc-André Lureau,
	Richard Henderson

While when building on native Linux the host architecture
is reported as "riscv32" or "riscv64", when cross-compiling
it is detected as "riscv". Meson handles the cross-detection
but displays a warning:

  WARNING: Unknown CPU family riscv, please report this at https://github.com/mesonbuild/meson/issues/new

Commit 278c1bcef5 was tested on native host but not under
cross environment, and now we get on our cross-riscv64-system
Gitlab-CI job:

  ../meson.build:684:6: ERROR: Problem encountered: Unsupported CPU riscv, try --enable-tcg-interpreter

Instead of:

  Found pkg-config: /usr/bin/riscv64-linux-gnu-pkg-config (1.8.1)

As a kludge, re-introduce "riscv" in the supported_cpus[] array.

Fixes: 278c1bcef5 ("target/riscv: Only unify 'riscv32/64' -> 'riscv' for host cpu in meson")
Reported-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 5fcdb37a71..58e35febb9 100644
--- a/meson.build
+++ b/meson.build
@@ -55,7 +55,7 @@ qapi_trace_events = []
 
 bsd_oses = ['gnu/kfreebsd', 'freebsd', 'netbsd', 'openbsd', 'dragonfly', 'darwin']
 supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
-supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv32', 'riscv64', 'x86', 'x86_64',
+supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv', 'riscv32', 'riscv64', 'x86', 'x86_64',
   'arm', 'aarch64', 'loongarch64', 'mips', 'mips64', 'sparc64']
 
 cpu = host_machine.cpu_family()
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [hotfix PATCH-for-8.1 v2] meson: Fix cross-building for RISCV host
  2023-07-11  9:25 [hotfix PATCH-for-8.1 v2] meson: Fix cross-building for RISCV host Philippe Mathieu-Daudé
@ 2023-07-11  9:35 ` Peter Maydell
  2023-07-11 10:05   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2023-07-11  9:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Thomas Huth, Paolo Bonzini, Daniel P. Berrangé,
	Michael Tokarev, Alistair Francis, Marc-André Lureau,
	Richard Henderson

On Tue, 11 Jul 2023 at 10:26, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> While when building on native Linux the host architecture
> is reported as "riscv32" or "riscv64", when cross-compiling
> it is detected as "riscv". Meson handles the cross-detection
> but displays a warning:
>
>   WARNING: Unknown CPU family riscv, please report this at https://github.com/mesonbuild/meson/issues/new

So where does the "riscv" string come from? It seems odd,
because don't we need to specify whether it's 32 or
64 bit ?

(https://github.com/mesonbuild/meson/issues/5950
got closed as "not a bug in meson, you should be using
riscv32 or riscv64 instead".)

thanks
-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [hotfix PATCH-for-8.1 v2] meson: Fix cross-building for RISCV host
  2023-07-11  9:35 ` Peter Maydell
@ 2023-07-11 10:05   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-07-11 10:05 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-devel, Thomas Huth, Paolo Bonzini, Daniel P. Berrangé,
	Michael Tokarev, Alistair Francis, Marc-André Lureau,
	Richard Henderson

On 11/7/23 11:35, Peter Maydell wrote:
> On Tue, 11 Jul 2023 at 10:26, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> While when building on native Linux the host architecture
>> is reported as "riscv32" or "riscv64", when cross-compiling
>> it is detected as "riscv". Meson handles the cross-detection
>> but displays a warning:
>>
>>    WARNING: Unknown CPU family riscv, please report this at https://github.com/mesonbuild/meson/issues/new
> 
> So where does the "riscv" string come from? It seems odd,
> because don't we need to specify whether it's 32 or
> 64 bit ?
> 
> (https://github.com/mesonbuild/meson/issues/5950
> got closed as "not a bug in meson, you should be using
> riscv32 or riscv64 instead".)

The meson-log.txt isn't very helpful:

======

Build started at 2023-07-11T08:42:37.510716
Main binary: 
/home/philippe.mathieu-daude/qemu/build/docker_debian-riscv64-cross/pyvenv/bin/python3
Build Options: -Dwerror=true -Ddocs=disabled -Dprefix=/usr/local 
--cross-file=config-meson.cross
Python system: Linux
The Meson build system
Version: 1.1.1
Source dir: /home/philippe.mathieu-daude/qemu
Build dir: 
/home/philippe.mathieu-daude/qemu/build/docker_debian-riscv64-cross
Build type: cross build
Project name: qemu
Project version: 8.0.50
-----
Detecting compiler via: riscv64-linux-gnu-gcc --version
compiler returned <Popen: returncode: 0 args: ['riscv64-linux-gnu-gcc', 
'--version']>
compiler stdout:
riscv64-linux-gnu-gcc (Debian 12.3.0-4) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


compiler stderr:

Running command: riscv64-linux-gnu-gcc -E -dM -
-----
Detecting linker via: riscv64-linux-gnu-gcc -Wl,--version
linker returned <Popen: returncode: 0 args: ['riscv64-linux-gnu-gcc', 
'-Wl,--version']>
linker stdout:
GNU ld (GNU Binutils for Debian) 2.40.90.20230705
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later 
version.
This program has absolutely no warranty.

linker stderr:
collect2 version 12.3.0
/usr/lib/gcc-cross/riscv64-linux-gnu/12/../../../../riscv64-linux-gnu/bin/ld 
-plugin /usr/lib/gcc-cross/riscv64-linux-gnu/12/liblto_plugin.so 
-plugin-opt=/usr/lib/gcc-cross/riscv64-linux-gnu/12/lto-wrapper 
-plugin-opt=-fresolution=/tmp/ccbttPz7.res 
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s 
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc 
-plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr 
-hash-style=gnu --as-needed -melf64lriscv -dynamic-linker 
/lib/ld-linux-riscv64-lp64d.so.1 -pie 
/usr/lib/gcc-cross/riscv64-linux-gnu/12/../../../../riscv64-linux-gnu/lib/Scrt1.o 
/usr/lib/gcc-cross/riscv64-linux-gnu/12/crti.o 
/usr/lib/gcc-cross/riscv64-linux-gnu/12/crtbeginS.o 
-L/usr/lib/gcc-cross/riscv64-linux-gnu/12 
-L/usr/lib/gcc-cross/riscv64-linux-gnu/12/../../../../riscv64-linux-gnu/lib 
-L/lib/riscv64-linux-gnu -L/usr/lib/riscv64-linux-gnu --version -lgcc 
--push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state 
--as-needed -lgcc_s --pop-state 
/usr/lib/gcc-cross/riscv64-linux-gnu/12/crtendS.o 
/usr/lib/gcc-cross/riscv64-linux-gnu/12/crtn.o

Sanity testing C compiler: riscv64-linux-gnu-gcc
Is cross compiler: True.
Sanity check compiler command line: riscv64-linux-gnu-gcc sanitycheckc.c 
-o sanitycheckc_cross.exe -D_FILE_OFFSET_BITS=64 -c
Sanity check compile stdout:

-----
Sanity check compile stderr:

-----
C compiler for the host machine: riscv64-linux-gnu-gcc (gcc 12.3.0 
"riscv64-linux-gnu-gcc (Debian 12.3.0-4) 12.3.0")
C linker for the host machine: riscv64-linux-gnu-gcc ld.bfd 2.40.90.20230705
-----
Detecting compiler via: cc --version
compiler returned <Popen: returncode: 0 args: ['cc', '--version']>
compiler stdout:
cc (Debian 12.3.0-5) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


compiler stderr:

Running command: cc -E -dM -
-----
Detecting linker via: cc -Wl,--version
linker returned <Popen: returncode: 0 args: ['cc', '-Wl,--version']>
linker stdout:
GNU ld (GNU Binutils for Debian) 2.40.90.20230705
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later 
version.
This program has absolutely no warranty.

linker stderr:
collect2 version 12.3.0
/usr/bin/ld -plugin /usr/lib/gcc/x86_64-linux-gnu/12/liblto_plugin.so 
-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper 
-plugin-opt=-fresolution=/tmp/ccfGNRcN.res 
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s 
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc 
-plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m 
elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker 
/lib64/ld-linux-x86-64.so.2 -pie 
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o 
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/crti.o 
/usr/lib/gcc/x86_64-linux-gnu/12/crtbeginS.o 
-L/usr/lib/gcc/x86_64-linux-gnu/12 
-L/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu 
-L/usr/lib/gcc/x86_64-linux-gnu/12/../../../../lib 
-L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu 
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/12/../../.. --version 
-lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc 
--push-state --as-needed -lgcc_s --pop-state 
/usr/lib/gcc/x86_64-linux-gnu/12/crtendS.o 
/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/crtn.o

Sanity testing C compiler: ccache cc
Is cross compiler: False.
Sanity check compiler command line: ccache cc sanitycheckc.c -o 
sanitycheckc.exe -D_FILE_OFFSET_BITS=64
Sanity check compile stdout:

-----
Sanity check compile stderr:

-----
Running test binary command: 
/home/philippe.mathieu-daude/qemu/build/docker_debian-riscv64-cross/meson-private/sanitycheckc.exe
C compiler for the build machine: ccache cc (gcc 12.3.0 "cc (Debian 
12.3.0-5) 12.3.0")
C linker for the build machine: cc ld.bfd 2.40.90.20230705
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: riscv
Host machine cpu: riscv
Target machine cpu family: riscv
Target machine cpu: riscv
Program scripts/symlink-install-tree.py found: YES 
(/home/philippe.mathieu-daude/qemu/build/docker_debian-riscv64-cross/pyvenv/bin/python3 
/home/philippe.mathieu-daude/qemu/scripts/symlink-install-tree.py)
Program sh found: YES (/usr/bin/sh)
Program python3 found: YES 
(/home/philippe.mathieu-daude/qemu/build/docker_debian-riscv64-cross/pyvenv/bin/python3)

[...]

======




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-11 10:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-11  9:25 [hotfix PATCH-for-8.1 v2] meson: Fix cross-building for RISCV host Philippe Mathieu-Daudé
2023-07-11  9:35 ` Peter Maydell
2023-07-11 10:05   ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.