Skip to contentSkip to conversation

meson: Revert recent changes to qemu version header handling

PATCH In review Peter Maydell 4 participants 10 messages Nov 6 – Nov 10 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover meson: Revert recent changes to qemu version header handling

This patchset is two git reverts, to revert ab78ac76f44a124 and fc35f24387703da. Those commits try to move the handling of version.h to entirely within the meson file with no external script, but unfortunately if you do that then there is no dependency information about it passed to ninja, so the file isn't recreated if it's missing. In particular this breaks incremental builds from a build tree that pre-dates those two commits.

There's been some on-list discussion:
https://lore.kernel.org/qemu-devel/[email protected]/
Since it's not clear how we want to proceed, I'm posting this as the "revert to the situation we had before", so we can discuss what we want to do with a bit more leisure.

thanks
-- PMM

Peter Maydell (2):
Revert "meson: rewrite scripts/qemu-version.sh directly in
meson.build"
Revert "include: introduce qemu/version.h"

 meson.build                          | 29 +++++++++-------------------
 include/qemu/version.h               | 20 -------------------
 bsd-user/main.c                      |  2 +-
 linux-user/main.c                    |  2 +-
 monitor/qmp-cmds-control.c           |  2 +-
 qemu-img.c                           |  2 +-
 qemu-io.c                            |  2 +-
 qemu-nbd.c                           |  2 +-
 qga/main.c                           |  2 +-
 scsi/qemu-pr-helper.c                |  2 +-
 storage-daemon/qemu-storage-daemon.c |  2 +-
 system/vl.c                          |  2 +-
 tools/i386/qemu-vmsr-helper.c        |  3 ++-
 tools/qemu-vnc/qemu-vnc.c            |  2 +-
 util/module.c                        |  2 +-
 scripts/qemu-version.h.in            |  1 -
 scripts/qemu-version.sh              | 25 ++++++++++++++++++++++++
 ui/cocoa.m                           |  2 +-
 18 files changed, 49 insertions(+), 55 deletions(-)
 delete mode 100644 include/qemu/version.h
 delete mode 100644 scripts/qemu-version.h.in
 create mode 100755 scripts/qemu-version.sh
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 Revert "meson: rewrite scripts/qemu-version.sh directly in meson.build"

This reverts commit ab78ac76f44a1241e76fd32d248df62d83f1ea58.

The change to create the version header in meson.build loses the dependency needed for the header file to be built when it doesn't exist. This means that:

* if you delete the build/qemu-version.h file, an incremental rebuild fails, rather than recreating it
* if you do an incremental rebuild from a build tree that pre-dates ab78ac76f44a, it doesn't have qemu-version.h, and the rebuild fails

Revert the commit so we can think about how we want to address this.

---
 meson.build               | 29 +++++++++--------------------
 include/qemu/version.h    |  8 --------
 scripts/qemu-version.h.in |  1 -
 scripts/qemu-version.sh   | 25 +++++++++++++++++++++++++
 4 files changed, 34 insertions(+), 29 deletions(-)
 delete mode 100644 scripts/qemu-version.h.in
 create mode 100755 scripts/qemu-version.sh
meson.build +9 -20
index d7bcb581c18..93da3e6f2bd 100644
@@ -78,7 +78,6 @@ have_user = have_linux_user or have_bsd_user
 ############
 
 sh = find_program('sh')
-git = find_program('git', required: false)
 python = import('python').find_installation()
 
 cc = meson.get_compiler('c')
@@ -3561,25 +3560,15 @@ tracetool_depends = files(
   'scripts/tracetool/__init__.py',
 )
 
-qemu_pkgversion = get_option('pkgversion')
-git_describe_version = [git, 'describe', '--match', 'v*', '--dirty']
-if qemu_pkgversion == '' and git.found() and fs.exists('.git') and \
-    run_command(git_describe_version, check: false).returncode() == 0
-  # Refresh the version at build time, so that "make" after a commit updates it.
-  qemu_version = vcs_tag(input: 'scripts/qemu-version.h.in',
-                         output: 'qemu-version.h',
-                         command: git_describe_version,
-                         fallback: '')
-else
-  # Unlike vcs_tag(), which always defines QEMU_PKGVERSION, leave it out if
-  # empty.  include/qemu/version.h then omits the parentheses from
-  # QEMU_FULL_VERSION.
-  qemu_version_data = configuration_data()
-  if qemu_pkgversion != ''
-    qemu_version_data.set_quoted('QEMU_PKGVERSION', qemu_pkgversion)
-  endif
-  qemu_version = configure_file(output: 'qemu-version.h', configuration: qemu_version_data)
-endif
+qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
+                    meson.current_source_dir(),
+                    get_option('pkgversion'), meson.project_version()]
+qemu_version = custom_target('qemu-version.h',
+                             output: 'qemu-version.h',
+                             command: qemu_version_cmd,
+                             capture: true,
+                             build_by_default: true,
+                             build_always_stale: true)
 genh += qemu_version
 
 hxdep = []
include/qemu/version.h +0 -8
index dd0f937f30c..38405495c0e 100644
@@ -7,14 +7,6 @@
 #ifndef QEMU_VERSION_H
 #define QEMU_VERSION_H
 
-/* qemu-version.h defines QEMU_PKGVERSION only if it is not empty.  */
 #include "qemu-version.h"
 
-#ifdef QEMU_PKGVERSION
-#define QEMU_FULL_VERSION QEMU_VERSION " (" QEMU_PKGVERSION ")"
-#else
-#define QEMU_PKGVERSION ""
-#define QEMU_FULL_VERSION QEMU_VERSION
-#endif
-
 #endif
scripts/qemu-version.h.in deleted +0 -1
deleted file mode 100644
index b62d4c22652..00000000000
@@ -1 +0,0 @@
-#define QEMU_PKGVERSION "@VCS_TAG@"
scripts/qemu-version.sh new file +25 -0
new file mode 100755
index 00000000000..3f6e7e6d41d
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -eu
+
+dir="$1"
+pkgversion="$2"
+version="$3"
+
+if [ -z "$pkgversion" ]; then
+    cd "$dir"
+    if [ -e .git ]; then
+        pkgversion=$(git describe --match 'v*' --dirty) || :
+    fi
+fi
+
+if [ -n "$pkgversion" ]; then
+    fullversion="$version ($pkgversion)"
+else
+    fullversion="$version"
+fi
+
+cat <<EOF
+#define QEMU_PKGVERSION "$pkgversion"
+#define QEMU_FULL_VERSION "$fullversion"
+EOF
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 1/2] Revert "meson: rewrite scripts/qemu-version.sh directly in meson.build"

Quoted 8 lines · Peter Maydell

This reverts commit ab78ac76f44a1241e76fd32d248df62d83f1ea58.

The change to create the version header in meson.build loses the dependency needed for the header file to be built when it doesn't exist. This means that:

* if you delete the build/qemu-version.h file, an incremental rebuild fails, rather than recreating it

That's not what I observe. From current master, file is correctly recreated. Do you still observe a problem with a clean build folder?

Quoted 4 lines

* if you do an incremental rebuild from a build tree that pre-dates ab78ac76f44a, it doesn't have qemu-version.h, and the rebuild fails

The problem seems to be crossing this commit, which we can't do anything about since it's there.

Quoted 116 lines

Revert the commit so we can think about how we want to address this.

---
 meson.build               | 29 +++++++++--------------------
 include/qemu/version.h    |  8 --------
 scripts/qemu-version.h.in |  1 -
 scripts/qemu-version.sh   | 25 +++++++++++++++++++++++++
 4 files changed, 34 insertions(+), 29 deletions(-)
 delete mode 100644 scripts/qemu-version.h.in
 create mode 100755 scripts/qemu-version.sh
meson.build +9 -20
index d7bcb581c18..93da3e6f2bd 100644
@@ -78,7 +78,6 @@ have_user = have_linux_user or have_bsd_user
 ############
 
 sh = find_program('sh')
-git = find_program('git', required: false)
 python = import('python').find_installation()
 
 cc = meson.get_compiler('c')
@@ -3561,25 +3560,15 @@ tracetool_depends = files(
   'scripts/tracetool/__init__.py',
 )
 
-qemu_pkgversion = get_option('pkgversion')
-git_describe_version = [git, 'describe', '--match', 'v*', '--dirty']
-if qemu_pkgversion == '' and git.found() and fs.exists('.git') and \
-    run_command(git_describe_version, check: false).returncode() == 0
-  # Refresh the version at build time, so that "make" after a commit updates it.
-  qemu_version = vcs_tag(input: 'scripts/qemu-version.h.in',
-                         output: 'qemu-version.h',
-                         command: git_describe_version,
-                         fallback: '')
-else
-  # Unlike vcs_tag(), which always defines QEMU_PKGVERSION, leave it out if
-  # empty.  include/qemu/version.h then omits the parentheses from
-  # QEMU_FULL_VERSION.
-  qemu_version_data = configuration_data()
-  if qemu_pkgversion != ''
-    qemu_version_data.set_quoted('QEMU_PKGVERSION', qemu_pkgversion)
-  endif
-  qemu_version = configure_file(output: 'qemu-version.h', configuration: qemu_version_data)
-endif
+qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
+                    meson.current_source_dir(),
+                    get_option('pkgversion'), meson.project_version()]
+qemu_version = custom_target('qemu-version.h',
+                             output: 'qemu-version.h',
+                             command: qemu_version_cmd,
+                             capture: true,
+                             build_by_default: true,
+                             build_always_stale: true)
 genh += qemu_version
 
 hxdep = []
include/qemu/version.h +0 -8
index dd0f937f30c..38405495c0e 100644
@@ -7,14 +7,6 @@
 #ifndef QEMU_VERSION_H
 #define QEMU_VERSION_H
 
-/* qemu-version.h defines QEMU_PKGVERSION only if it is not empty.  */
 #include "qemu-version.h"
 
-#ifdef QEMU_PKGVERSION
-#define QEMU_FULL_VERSION QEMU_VERSION " (" QEMU_PKGVERSION ")"
-#else
-#define QEMU_PKGVERSION ""
-#define QEMU_FULL_VERSION QEMU_VERSION
-#endif
-
 #endif
scripts/qemu-version.h.in deleted +0 -1
deleted file mode 100644
index b62d4c22652..00000000000
@@ -1 +0,0 @@
-#define QEMU_PKGVERSION "@VCS_TAG@"
scripts/qemu-version.sh new file +25 -0
new file mode 100755
index 00000000000..3f6e7e6d41d
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -eu
+
+dir="$1"
+pkgversion="$2"
+version="$3"
+
+if [ -z "$pkgversion" ]; then
+    cd "$dir"
+    if [ -e .git ]; then
+        pkgversion=$(git describe --match 'v*' --dirty) || :
+    fi
+fi
+
+if [ -n "$pkgversion" ]; then
+    fullversion="$version ($pkgversion)"
+else
+    fullversion="$version"
+fi
+
+cat <<EOF
+#define QEMU_PKGVERSION "$pkgversion"
+#define QEMU_FULL_VERSION "$fullversion"
+EOF
#3 lore raw

Re: [PATCH 1/2] Revert "meson: rewrite scripts/qemu-version.sh directly in meson.build"

Quoted 8 lines · Pierrick Bouvier
Quoted 6 lines · Peter Maydell

This reverts commit ab78ac76f44a1241e76fd32d248df62d83f1ea58.

The change to create the version header in meson.build loses the dependency needed for the header file to be built when it doesn't exist. This means that:

Quoted 5 lines
Quoted 2 lines

* if you delete the build/qemu-version.h file, an incremental rebuild fails, rather than recreating it

That's not what I observe. From current master, file is correctly recreated. Do you still observe a problem with a clean build folder?

Yes.

$ git log --oneline -1
f71afb409a8 Merge tag 'pull-loongarch-20261105' of
https://github.com/bibo-mao/qemu into staging
$ rm -rf build/arm && mkdir build/arm && (cd build/arm &&
'../../configure'
'--target-list=arm-softmmu,aarch64-softmmu,arm-linux-user,aarch64-linux-user,aarch64_be-linux-user'
'--cc=ccache gcc' '--with-pkgversion=pm215' '--enable-debug'
'--enable-docs') && make -C build/arm -j20
[...]
$ make -C build/arm -j20
make: Entering directory '/home/pm215/qemu/build/arm'
[1/35] Generating tests/include/QAPI test (include) with a custom command
make: Leaving directory '/home/pm215/qemu/build/arm'
$ make -C build/arm -j20
make: Entering directory '/home/pm215/qemu/build/arm'
[1/27] Compiling C object qga/qemu-ga.p/main.c.o
FAILED: qga/qemu-ga.p/main.c.o
/usr/bin/ccache gcc -m64 -Iqga/qemu-ga.p -Iqga -I../../qga -I. -Iqapi
-Itrace -Iui -Iui/shader -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fdiagnostics-color=auto
-Wall -Winvalid-pch -Werror -std=gnu11 -O0 -g -mcx16 -msse2
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
-fzero-call-used-regs=used-gpr -fstack-protector-strong -Wempty-body
-Wendif-labels -Wexpansion-to-defined -Wformat-overflow=2
-Wformat-security -Wformat-y2k -Wignored-qualifiers
-Wimplicit-fallthrough=2 -Winit-self -Wmissing-format-attribute
-Wmissing-prototypes -Wnested-externs -Wold-style-declaration
-Wold-style-definition -Wredundant-decls -Wshadow=local
-Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings
-Wno-missing-include-dirs -Wno-psabi -Wno-shift-negative-value
-isystem /home/pm215/qemu/linux-headers -isystem linux-headers -iquote
. -iquote /home/pm215/qemu -iquote /home/pm215/qemu/include -iquote
/home/pm215/qemu/host/include/x86_64 -iquote
/home/pm215/qemu/host/include/generic -iquote
/home/pm215/qemu/tcg/x86_64 -pthread -fPIE -MD -MQ
qga/qemu-ga.p/main.c.o -MF qga/qemu-ga.p/main.c.o.d -o
qga/qemu-ga.p/main.c.o -c ../../qga/main.c
In file included from ../../qga/main.c:33:
/home/pm215/qemu/include/qemu/version.h:11:10: fatal error:
qemu-version.h: No such file or directory
   11 | #include "qemu-version.h"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
[etc]

I have run into this problem about a dozen times this week with different build trees and different git branches, and it is very annoying.

Quoted 2 lines

The problem seems to be crossing this commit, which we can't do anything about since it's there.

Yeah, it's going to be a broken git bisect for that part of history, which is unavoidable. But the current state of git is (a) broken and (b) not clearly what we actually want, per the other thread.

-- PMM

#4 lore raw

Re: [PATCH 1/2] Revert "meson: rewrite scripts/qemu-version.sh directly in meson.build"

Quoted 5 lines · Peter Maydell
$ git log --oneline -1
f71afb409a8 Merge tag 'pull-loongarch-20261105' of
https://github.com/bibo-mao/qemu into staging
$ rm -rf build/arm && mkdir build/arm && (cd build/arm &&
'../../configure'
Quoted 8 lines
'--target-list=arm-softmmu,aarch64-softmmu,arm-linux-user,aarch64-linux-user,aarch64_be-linux-user'
'--cc=ccache gcc' '--with-pkgversion=pm215' '--enable-debug'
'--enable-docs') && make -C build/arm -j20
[...]
$ make -C build/arm -j20
make: Entering directory '/home/pm215/qemu/build/arm'
[1/35] Generating tests/include/QAPI test (include) with a custom command
make: Leaving directory '/home/pm215/qemu/build/arm'

Whoops, there's a missing step here:

$ rm build/arm/qemu-version.h
Quoted 29 lines
$ make -C build/arm -j20
make: Entering directory '/home/pm215/qemu/build/arm'
[1/27] Compiling C object qga/qemu-ga.p/main.c.o
FAILED: qga/qemu-ga.p/main.c.o
/usr/bin/ccache gcc -m64 -Iqga/qemu-ga.p -Iqga -I../../qga -I. -Iqapi
(quoted diff) +0 -14
-Itrace -Iui -Iui/shader -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fdiagnostics-color=auto
-Wall -Winvalid-pch -Werror -std=gnu11 -O0 -g -mcx16 -msse2
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
-fzero-call-used-regs=used-gpr -fstack-protector-strong -Wempty-body
-Wendif-labels -Wexpansion-to-defined -Wformat-overflow=2
-Wformat-security -Wformat-y2k -Wignored-qualifiers
-Wimplicit-fallthrough=2 -Winit-self -Wmissing-format-attribute
-Wmissing-prototypes -Wnested-externs -Wold-style-declaration
-Wold-style-definition -Wredundant-decls -Wshadow=local
-Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings
-Wno-missing-include-dirs -Wno-psabi -Wno-shift-negative-value
-isystem /home/pm215/qemu/linux-headers -isystem linux-headers -iquote

. -iquote /home/pm215/qemu -iquote /home/pm215/qemu/include -iquote /home/pm215/qemu/host/include/x86_64 -iquote /home/pm215/qemu/host/include/generic -iquote /home/pm215/qemu/tcg/x86_64 -pthread -fPIE -MD -MQ qga/qemu-ga.p/main.c.o -MF qga/qemu-ga.p/main.c.o.d -o qga/qemu-ga.p/main.c.o -c ../../qga/main.c
In file included from ../../qga/main.c:33:
/home/pm215/qemu/include/qemu/version.h:11:10: fatal error:
qemu-version.h: No such file or directory
11 | #include "qemu-version.h"

Quoted 3 lines
      |          ^~~~~~~~~~~~~~~~

compilation terminated.
[etc]

-- PMM

#5 lore raw

Re: [PATCH 1/2] Revert "meson: rewrite scripts/qemu-version.sh directly in meson.build"

In reply to Peter Maydell
Quoted 71 lines · Peter Maydell
Quoted 8 lines · Pierrick Bouvier
Quoted 6 lines · Peter Maydell

This reverts commit ab78ac76f44a1241e76fd32d248df62d83f1ea58.

The change to create the version header in meson.build loses the dependency needed for the header file to be built when it doesn't exist. This means that:

Quoted 5 lines
Quoted 2 lines

* if you delete the build/qemu-version.h file, an incremental rebuild fails, rather than recreating it

That's not what I observe. From current master, file is correctly recreated. Do you still observe a problem with a clean build folder?

Yes.

$ git log --oneline -1
f71afb409a8 Merge tag 'pull-loongarch-20261105' of
https://github.com/bibo-mao/qemu into staging
$ rm -rf build/arm && mkdir build/arm && (cd build/arm &&
'../../configure'
'--target-list=arm-softmmu,aarch64-softmmu,arm-linux-user,aarch64-linux-user,aarch64_be-linux-user'
'--cc=ccache gcc' '--with-pkgversion=pm215' '--enable-debug'
'--enable-docs') && make -C build/arm -j20
[...]
$ make -C build/arm -j20
make: Entering directory '/home/pm215/qemu/build/arm'
[1/35] Generating tests/include/QAPI test (include) with a custom command
make: Leaving directory '/home/pm215/qemu/build/arm'
$ make -C build/arm -j20
make: Entering directory '/home/pm215/qemu/build/arm'
[1/27] Compiling C object qga/qemu-ga.p/main.c.o
FAILED: qga/qemu-ga.p/main.c.o
/usr/bin/ccache gcc -m64 -Iqga/qemu-ga.p -Iqga -I../../qga -I. -Iqapi
(quoted diff) +0 -14
-Itrace -Iui -Iui/shader -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fdiagnostics-color=auto
-Wall -Winvalid-pch -Werror -std=gnu11 -O0 -g -mcx16 -msse2
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
-fzero-call-used-regs=used-gpr -fstack-protector-strong -Wempty-body
-Wendif-labels -Wexpansion-to-defined -Wformat-overflow=2
-Wformat-security -Wformat-y2k -Wignored-qualifiers
-Wimplicit-fallthrough=2 -Winit-self -Wmissing-format-attribute
-Wmissing-prototypes -Wnested-externs -Wold-style-declaration
-Wold-style-definition -Wredundant-decls -Wshadow=local
-Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings
-Wno-missing-include-dirs -Wno-psabi -Wno-shift-negative-value
-isystem /home/pm215/qemu/linux-headers -isystem linux-headers -iquote

. -iquote /home/pm215/qemu -iquote /home/pm215/qemu/include -iquote /home/pm215/qemu/host/include/x86_64 -iquote /home/pm215/qemu/host/include/generic -iquote /home/pm215/qemu/tcg/x86_64 -pthread -fPIE -MD -MQ qga/qemu-ga.p/main.c.o -MF qga/qemu-ga.p/main.c.o.d -o qga/qemu-ga.p/main.c.o -c ../../qga/main.c
In file included from ../../qga/main.c:33:
/home/pm215/qemu/include/qemu/version.h:11:10: fatal error:
qemu-version.h: No such file or directory
11 | #include "qemu-version.h"

      |          ^~~~~~~~~~~~~~~~

compilation terminated.
[etc]

I have run into this problem about a dozen times this week with different build trees and different git branches, and it is very annoying.

Quoted 2 lines

The problem seems to be crossing this commit, which we can't do anything about since it's there.

Quoted 6 lines

Yeah, it's going to be a broken git bisect for that part of history, which is unavoidable. But the current state of git is (a) broken and (b) not clearly what we actually want, per the other thread.

-- PMM

I see, the missing bit I didn't use is '--with-pkgversion=pm215'. Without it, it works fine.

Any reason you use it for dev builds?

Seems to be something related to releases, which probably won't use incremental builds.

Regards,
Pierrick

#6 lore raw

Re: [PATCH 1/2] Revert "meson: rewrite scripts/qemu-version.sh directly in meson.build"

Quoted 80 lines · Pierrick Bouvier
Quoted 71 lines · Peter Maydell
Quoted 8 lines · Pierrick Bouvier
Quoted 6 lines · Peter Maydell

This reverts commit ab78ac76f44a1241e76fd32d248df62d83f1ea58.

The change to create the version header in meson.build loses the dependency needed for the header file to be built when it doesn't exist. This means that:

Quoted 5 lines
Quoted 2 lines

* if you delete the build/qemu-version.h file, an incremental rebuild fails, rather than recreating it

That's not what I observe. From current master, file is correctly recreated. Do you still observe a problem with a clean build folder?

Yes.

$ git log --oneline -1
f71afb409a8 Merge tag 'pull-loongarch-20261105' of
https://github.com/bibo-mao/qemu into staging
$ rm -rf build/arm && mkdir build/arm && (cd build/arm &&
'../../configure'
'--target-list=arm-softmmu,aarch64-softmmu,arm-linux-user,aarch64-linux-user,aarch64_be-linux-user'
'--cc=ccache gcc' '--with-pkgversion=pm215' '--enable-debug'
'--enable-docs') && make -C build/arm -j20
[...]
$ make -C build/arm -j20
make: Entering directory '/home/pm215/qemu/build/arm'
[1/35] Generating tests/include/QAPI test (include) with a custom command
make: Leaving directory '/home/pm215/qemu/build/arm'
$ make -C build/arm -j20
make: Entering directory '/home/pm215/qemu/build/arm'
[1/27] Compiling C object qga/qemu-ga.p/main.c.o
FAILED: qga/qemu-ga.p/main.c.o
/usr/bin/ccache gcc -m64 -Iqga/qemu-ga.p -Iqga -I../../qga -I. -Iqapi
(quoted diff) +0 -14
-Itrace -Iui -Iui/shader -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fdiagnostics-color=auto
-Wall -Winvalid-pch -Werror -std=gnu11 -O0 -g -mcx16 -msse2
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
-fzero-call-used-regs=used-gpr -fstack-protector-strong -Wempty-body
-Wendif-labels -Wexpansion-to-defined -Wformat-overflow=2
-Wformat-security -Wformat-y2k -Wignored-qualifiers
-Wimplicit-fallthrough=2 -Winit-self -Wmissing-format-attribute
-Wmissing-prototypes -Wnested-externs -Wold-style-declaration
-Wold-style-definition -Wredundant-decls -Wshadow=local
-Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings
-Wno-missing-include-dirs -Wno-psabi -Wno-shift-negative-value
-isystem /home/pm215/qemu/linux-headers -isystem linux-headers -iquote

. -iquote /home/pm215/qemu -iquote /home/pm215/qemu/include -iquote /home/pm215/qemu/host/include/x86_64 -iquote /home/pm215/qemu/host/include/generic -iquote /home/pm215/qemu/tcg/x86_64 -pthread -fPIE -MD -MQ qga/qemu-ga.p/main.c.o -MF qga/qemu-ga.p/main.c.o.d -o qga/qemu-ga.p/main.c.o -c ../../qga/main.c
In file included from ../../qga/main.c:33:
/home/pm215/qemu/include/qemu/version.h:11:10: fatal error:
qemu-version.h: No such file or directory
11 | #include "qemu-version.h"

      |          ^~~~~~~~~~~~~~~~

compilation terminated.
[etc]

I have run into this problem about a dozen times this week with different build trees and different git branches, and it is very annoying.

Quoted 2 lines

The problem seems to be crossing this commit, which we can't do anything about since it's there.

Quoted 6 lines

Yeah, it's going to be a broken git bisect for that part of history, which is unavoidable. But the current state of git is (a) broken and (b) not clearly what we actually want, per the other thread.

-- PMM

Quoted 7 lines

I see, the missing bit I didn't use is '--with-pkgversion=pm215'. Without it, it works fine.

Any reason you use it for dev builds?

Seems to be something related to releases, which probably won't use incremental builds.

Oh, I am using it in daily work, and indeed I like these changes(not reverting it is better for me) :)

I am using rsync to cause it to build remotely, so that I have no .git folder.

Quoted 3 lines

Regards,
Pierrick

Signature · 6 lines
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo
#7 lore raw

Re: [PATCH 1/2] Revert "meson: rewrite scripts/qemu-version.sh directly in meson.build"

In reply to Pierrick Bouvier
Quoted 4 lines · Pierrick Bouvier

I see, the missing bit I didn't use is '--with-pkgversion=pm215'. Without it, it works fine.

Any reason you use it for dev builds?

It's something I picked up ages ago -- I don't want a change in the git revision to trigger a rebuild on a local dev tree, because that's pretty pointless extra churn. Setting the pkgversion explicitly to something else means that it doesn't default to the git revision.

thanks
-- PMM

#8 lore raw

PATCH 2/2 Revert "include: introduce qemu/version.h"

In reply to Peter Maydell

This reverts commit fc35f24387703da027c242ff17382b89ed5a269f.

This commit was made as a pre-requisite for ab78ac76f44a124; now we've reverted that, revert this one as well so we return to the previous version header setup.

---
 include/qemu/version.h               | 12 ------------
 bsd-user/main.c                      |  2 +-
 linux-user/main.c                    |  2 +-
 monitor/qmp-cmds-control.c           |  2 +-
 qemu-img.c                           |  2 +-
 qemu-io.c                            |  2 +-
 qemu-nbd.c                           |  2 +-
 qga/main.c                           |  2 +-
 scsi/qemu-pr-helper.c                |  2 +-
 storage-daemon/qemu-storage-daemon.c |  2 +-
 system/vl.c                          |  2 +-
 tools/i386/qemu-vmsr-helper.c        |  3 ++-
 tools/qemu-vnc/qemu-vnc.c            |  2 +-
 util/module.c                        |  2 +-
 ui/cocoa.m                           |  2 +-
 15 files changed, 15 insertions(+), 26 deletions(-)
 delete mode 100644 include/qemu/version.h
include/qemu/version.h deleted +0 -12
deleted file mode 100644
index 38405495c0e..00000000000
@@ -1,12 +0,0 @@
-/*
- * QEMU version strings
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#ifndef QEMU_VERSION_H
-#define QEMU_VERSION_H
-
-#include "qemu-version.h"
-
-#endif
bsd-user/main.c +1 -1
index 6720dbde6f8..29ee59de2cf 100644
@@ -25,7 +25,7 @@
 #include "qemu/help-texts.h"
 #include "qemu/units.h"
 #include "qemu/accel.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 #include <machine/trap.h>
 
 #include "qapi/error.h"
linux-user/main.c +1 -1
index 2f0c0a50c8a..60a695b7ca3 100644
@@ -21,7 +21,7 @@
 #include "qemu/help-texts.h"
 #include "qemu/units.h"
 #include "qemu/accel.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 #include <sys/syscall.h>
 #include <sys/resource.h>
 #include <sys/shm.h>
monitor/qmp-cmds-control.c +1 -1
index bc938712f3d..8fe0876a3da 100644
@@ -25,7 +25,7 @@
 #include "qemu/osdep.h"
 
 #include "monitor-internal.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 #include "qapi/compat-policy.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-control.h"
qemu-img.c +1 -1
index 766d8540bfe..edf75e43aba 100644
@@ -27,7 +27,7 @@
 
 #include "qemu/help-texts.h"
 #include "qemu/qemu-progress.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-block-core.h"
 #include "qapi/qapi-visit-block-core.h"
qemu-io.c +1 -1
index b5f2ae631a4..598d5b1c9ca 100644
@@ -34,7 +34,7 @@
 #include "block/block_int.h"
 #include "trace/control.h"
 #include "crypto/init.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 
 #define CMD_NOFILE_OK   0x01
 
qemu-nbd.c +1 -1
index 4f7e965edba..fa28609d7dc 100644
@@ -46,7 +46,7 @@
 #include "crypto/init.h"
 #include "crypto/tlscreds.h"
 #include "trace/control.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 
 #ifdef CONFIG_SELINUX
 #include <selinux/selinux.h>
qga/main.c +1 -1
index 06358cb213c..fd19c7037db 100644
@@ -30,7 +30,7 @@
 #include "qemu/help_option.h"
 #include "qemu/sockets.h"
 #include "qemu/systemd.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 #ifdef _WIN32
 #include <windows.h>
 #include <objbase.h>
scsi/qemu-pr-helper.c +1 -1
index 7629f364045..1f97a5c4bfe 100644
@@ -50,7 +50,7 @@
 #include "qobject/qstring.h"
 #include "io/channel-socket.h"
 #include "trace/control.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 
 #include "block/thread-pool.h"
 
storage-daemon/qemu-storage-daemon.c +1 -1
index b2e29f00054..50dbfbd97ae 100644
@@ -43,7 +43,7 @@
 #include "qapi/qobject-input-visitor.h"
 
 #include "qemu/help-texts.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 #include "qemu/cutils.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
system/vl.c +1 -1
index e7b759d5442..7ae6a8298fc 100644
@@ -37,7 +37,7 @@
 #include "qobject/qdict.h"
 #include "qobject/qstring.h"
 #include "qobject/qjson.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 #include "qemu/cutils.h"
 #include "qemu/help_option.h"
 #include "qemu/hw-version.h"
tools/i386/qemu-vmsr-helper.c +2 -1
index fac7fbe6b61..f12fd3c3e81 100644
@@ -34,7 +34,7 @@
 #include "qemu/module.h"
 #include "qemu/error-report.h"
 #include "qemu/config-file.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "qemu/log.h"
@@ -42,6 +42,7 @@
 #include "io/channel.h"
 #include "io/channel-socket.h"
 #include "trace/control.h"
+#include "qemu-version.h"
 #include "rapl-msr-index.h"
 
 #define MSR_PATH_TEMPLATE "/dev/cpu/%u/msr"
tools/qemu-vnc/qemu-vnc.c +1 -1
index a668f3f734d..c915589ca7e 100644
@@ -15,7 +15,7 @@
 #include "qemu/option.h"
 #include "qemu/log.h"
 #include "qemu/main-loop.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 #include "ui/vnc.h"
 #include "crypto/secret.h"
 #include "crypto/tlscredsx509.h"
util/module.c +1 -1
index 6de9ff2e411..8f8e6994f11 100644
@@ -23,7 +23,7 @@
 #include "qemu/config-file.h"
 #include "qapi/error.h"
 #ifdef CONFIG_MODULE_UPGRADES
-#include "qemu/version.h"
+#include "qemu-version.h"
 #endif
 #include "trace.h"
 
ui/cocoa.m +1 -1
index 36a72d36238..4587547c98c 100644
@@ -44,7 +44,7 @@
 #include "qapi/qapi-commands-machine.h"
 #include "qapi/qapi-commands-misc.h"
 #include "system/blockdev.h"
-#include "qemu/version.h"
+#include "qemu-version.h"
 #include "qemu/cutils.h"
 #include "qemu/main-loop.h"
 #include "qemu/module.h"
Signature · 1 line
2.43.0
Reviewed-by on the v1 series
#9 lore raw
In reply to Peter Maydell
Quoted 8 lines · Peter Maydell

This patchset is two git reverts, to revert ab78ac76f44a124 and fc35f24387703da. Those commits try to move the handling of version.h to entirely within the meson file with no external script, but unfortunately if you do that then there is no dependency information about it passed to ninja, so the file isn't recreated if it's missing. In particular this breaks incremental builds from a build tree that pre-dates those two commits.

Quoted 5 lines

There's been some on-list discussion:
https://lore.kernel.org/qemu-devel/[email protected]/
Since it's not clear how we want to proceed, I'm posting this as the "revert to the situation we had before", so we can discuss what we want to do with a bit more leisure.

r~