It is easy to catch the generated 'config-host.mak' in the source
tree, however qemu-version.h and qemu-options.def are also generated
files and are hidden by .gitignore rules.
Improve the out-of-tree safety net rule added in d1bd2423a90,
by also checking for these two files.
This solves building issues with out-of-tree builds from a
source tree that has been built in:
- /qemu-version.h existing in source tree:
/source/qemu/qemu-nbd.c: In function ‘version’:
/source/qemu/qemu-nbd.c:133:6: error: expected ‘)’ before
‘QEMU_FULL_VERSION’
"%s " QEMU_FULL_VERSION "\n"
^~~~~~~~~~~~~~~~~~
)
/source/qemu/qemu-nbd.c:133:3: error: format ‘%s’ expects a matching
‘char *’ argument [-Werror=format=]
"%s " QEMU_FULL_VERSION "\n"
~^
cc1: all warnings being treated as errors
- /qemu-options.def existing in source tree:
/source/qemu/vl.c: In function ‘main’:
/source/qemu/vl.c:3052:18: error: ‘QEMU_OPTION_blockdev’ undeclared
(first use in this function); did you mean ‘QEMU_OPTION_clock’?
case QEMU_OPTION_blockdev:
^~~~~~~~~~~~~~~~~~~~
QEMU_OPTION_clock
/source/qemu/vl.c:3052:18: note: each undeclared identifier is reported
only once for each function it appears in
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Since v1 http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg02254.html:
Peter noticed [1] those files already are in GENERATED_FILES
[1] http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg02338.html
Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 023b3437ec..521009964c 100644
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,8 @@ endif
# Check that we're not trying to do an out-of-tree build from
# a tree that's been used for an in-tree build.
ifneq ($(realpath $(SRC_PATH)),$(realpath .))
-ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
+scratch_files = config-host.mak qemu-version.h qemu-options.def
+ifneq ($(wildcard $(addprefix $(SRC_PATH)/,$(scratch_files))),)
$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
seems to have been used for an in-tree build. You can fix this by running \
"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
--
2.17.1
On 9 June 2018 at 16:10, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > It is easy to catch the generated 'config-host.mak' in the source > tree, however qemu-version.h and qemu-options.def are also generated > files and are hidden by .gitignore rules. > > Improve the out-of-tree safety net rule added in d1bd2423a90, > by also checking for these two files. > > This solves building issues with out-of-tree builds from a > source tree that has been built in: > > - /qemu-version.h existing in source tree: > > /source/qemu/qemu-nbd.c: In function ‘version’: > /source/qemu/qemu-nbd.c:133:6: error: expected ‘)’ before > ‘QEMU_FULL_VERSION’ > "%s " QEMU_FULL_VERSION "\n" > ^~~~~~~~~~~~~~~~~~ > ) > /source/qemu/qemu-nbd.c:133:3: error: format ‘%s’ expects a matching > ‘char *’ argument [-Werror=format=] > "%s " QEMU_FULL_VERSION "\n" > ~^ > cc1: all warnings being treated as errors > > - /qemu-options.def existing in source tree: > > /source/qemu/vl.c: In function ‘main’: > /source/qemu/vl.c:3052:18: error: ‘QEMU_OPTION_blockdev’ undeclared > (first use in this function); did you mean ‘QEMU_OPTION_clock’? > case QEMU_OPTION_blockdev: > ^~~~~~~~~~~~~~~~~~~~ > QEMU_OPTION_clock > /source/qemu/vl.c:3052:18: note: each undeclared identifier is reported > only once for each function it appears in This commit message should I think also mention that it is only needed to deal with source trees that have these stale files from failed build attempts that predate commit 428952cfa966f5af8. Otherwise the existing test on config-host.mak is sufficient. > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > Since v1 http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg02254.html: > Peter noticed [1] those files already are in GENERATED_FILES > > [1] http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg02338.html > > Makefile | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index 023b3437ec..521009964c 100644 > --- a/Makefile > +++ b/Makefile > @@ -55,7 +55,8 @@ endif > # Check that we're not trying to do an out-of-tree build from > # a tree that's been used for an in-tree build. > ifneq ($(realpath $(SRC_PATH)),$(realpath .)) > -ifneq ($(wildcard $(SRC_PATH)/config-host.mak),) > +scratch_files = config-host.mak qemu-version.h qemu-options.def > +ifneq ($(wildcard $(addprefix $(SRC_PATH)/,$(scratch_files))),) > $(error This is an out of tree build but your source tree ($(SRC_PATH)) \ > seems to have been used for an in-tree build. You can fix this by running \ > "$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree) > -- > 2.17.1 Otherwise Reviewed-by: Peter Maydell <peter.maydell@linaro.org> thanks -- PMM
© 2016 - 2024 Red Hat, Inc.