Skip to contentSkip to conversation

fix out of tree build

PATCH Applied Stefano Stabellini 5 participants 19 messages Nov 22, 2011 – Dec 1, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix out of tree build

Makefile +1 -1
index 168093c..885065f 100644
@@ -167,7 +167,7 @@ check-qjson: check-qjson.o $(qobject-obj-y) $(tools-obj-y)
 test-coroutine: test-coroutine.o qemu-timer-common.o async.o $(coroutine-obj-y) $(tools-obj-y)
 
 $(qapi-obj-y): $(GENERATED_HEADERS)
-qapi-dir := qapi-generated
+qapi-dir := $(SRC_PATH)/qapi-generated
 test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-dir)
 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
 
#2 lore raw
In reply to Stefano Stabellini

Am 22.11.2011 18:27, schrieb Stefano Stabellini:

Quoted 8 lines
Makefile +0 -0
index 168093c..885065f 100644

Makefile check-qjson: check-qjson.o $(qobject-obj-y) · line 173

Quoted 8 lines
Makefile +1 -1
@@ -167,7 +167,7 @@ check-qjson: check-qjson.o $(qobject-obj-y) 
 $(tools-obj-y)
 test-coroutine: test-coroutine.o qemu-timer-common.o async.o $(coroutine-obj-y) $(tools-obj-y)
 
 $(qapi-obj-y): $(GENERATED_HEADERS)
-qapi-dir := qapi-generated
+qapi-dir := $(SRC_PATH)/qapi-generated
 test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-dir)
 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)

This patch was committed to latest QEMU and breaks in-tree and out-of-tree builds. Without it, both kinds of builds work in my standard Debian configuration.

Regards,
Stefan Weil

gcc output (extract):

CC /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.o /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c: In function ‘qapi_free_GuestAgentInfoList’:
/home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:39: warning: implicit declaration of function ‘visit_type_GuestAgentInfoList’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:39: warning: nested extern declaration of ‘visit_type_GuestAgentInfoList’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c: In function ‘qapi_free_GuestAgentInfo’:
/home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:54: warning: implicit declaration of function ‘visit_type_GuestAgentInfo’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:54: warning: nested extern declaration of ‘visit_type_GuestAgentInfo’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c: In function ‘qapi_free_GuestFileReadList’:
/home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:69: warning: implicit declaration of function ‘visit_type_GuestFileReadList’

#3 lore raw
Quoted 12 lines · Stefan Weil

Am 22.11.2011 18:27, schrieb Stefano Stabellini:

Quoted 11 lines
Makefile +0 -0
index 168093c..885065f 100644
@@ -167,7 +167,7 @@ check-qjson: check-qjson.o $(qobject-obj-y) $(tools-obj-y)

test-coroutine: test-coroutine.o qemu-timer-common.o async.o $(coroutine-obj-y) $(tools-obj-y)

Quoted 9 lines
Quoted 6 lines

$(qapi-obj-y): $(GENERATED_HEADERS)

Makefile +1 -1
-qapi-dir := qapi-generated
+qapi-dir := $(SRC_PATH)/qapi-generated

test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-dir)
qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)

This patch was committed to latest QEMU and breaks in-tree and out-of-tree builds. Without it, both kinds of builds work in my standard Debian configuration.

The patch is obviously incorrect. I'm going to revert it since the commit message has no explanation of why it's fixing anything.

Regards,

Anthony Liguori

Quoted 26 lines

Regards,
Stefan Weil

gcc output (extract):

CC /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.o /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c: In function ‘qapi_free_GuestAgentInfoList’:
/home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:39:
warning: implicit declaration of function ‘visit_type_GuestAgentInfoList’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:39:
warning: nested extern declaration of ‘visit_type_GuestAgentInfoList’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c: In function ‘qapi_free_GuestAgentInfo’:
/home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:54:
warning: implicit declaration of function ‘visit_type_GuestAgentInfo’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:54:
warning: nested extern declaration of ‘visit_type_GuestAgentInfo’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c: In function ‘qapi_free_GuestFileReadList’:
/home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:69:
warning: implicit declaration of function ‘visit_type_GuestFileReadList’

#4 lore raw
In reply to Stefan Weil

Am 28.11.2011 19:34, schrieb Stefan Weil:

Quoted 28 lines

Am 22.11.2011 18:27, schrieb Stefano Stabellini:

Quoted 14 lines
Makefile +1 -1
index 168093c..885065f 100644
@@ -167,7 +167,7 @@ check-qjson: check-qjson.o $(qobject-obj-y) 
 $(tools-obj-y)
 test-coroutine: test-coroutine.o qemu-timer-common.o async.o $(coroutine-obj-y) $(tools-obj-y)
 
 $(qapi-obj-y): $(GENERATED_HEADERS)
-qapi-dir := qapi-generated
+qapi-dir := $(SRC_PATH)/qapi-generated
Quoted 3 lines

test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-dir)
qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)

This patch was committed to latest QEMU and breaks in-tree and out-of-tree builds. Without it, both kinds of builds work in my standard Debian configuration.

Regards,
Stefan Weil

gcc output (extract):

Quoted 9 lines

CC /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.o /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c: In function ‘qapi_free_GuestAgentInfoList’:
/home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:39: warning: implicit declaration of function ‘visit_type_GuestAgentInfoList’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:39: warning: nested extern declaration of ‘visit_type_GuestAgentInfoList’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c: In function ‘qapi_free_GuestAgentInfo’:
/home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:54: warning: implicit declaration of function ‘visit_type_GuestAgentInfo’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:54: warning: nested extern declaration of ‘visit_type_GuestAgentInfo’ /home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c: In function ‘qapi_free_GuestFileReadList’:
/home/stefan/src/qemu/qemu.org/patches/qapi-generated/qga-qapi-types.c:69: warning: implicit declaration of function ‘visit_type_GuestFileReadList’

The broken build can be reproduced with a source path containing at least one dot. Source paths without any dot will show no problems. My source path was ~/src/qemu/qemu.org/qemu.

File scripts/qapi.py fails to create unique guard names when given a filename with 2 or more dots:

def guardname(filename):

    if filename.startswith('./'):
        filename = filename[2:]
    return filename.replace("/", "_").replace("-", 

"_").split(".")[0].upper() + '_H'

The function always returns the same guard name (in my case _HOME_STEFAN_SRC_QEMU_QEMU_H) which won't work when used for more than one header file.

I expect that blanks in the source path will also give unexpected results.

Even when this function were fixed, I think that
qapi-dir := $(BUILD_DIR)/qapi-generated
would be better.

Regards,
Stefan Weil

#5 lore raw
Quoted 4 lines · Stefan Weil

The broken build can be reproduced with a source path containing at least one dot.
Source paths without any dot will show no problems. My source path was ~/src/qemu/qemu.org/qemu.

Sorry for the build break, I didn't have any dots in my source path so I didn't notice it :-/

Quoted 13 lines

File scripts/qapi.py fails to create unique guard names when given a filename with 2 or more dots:

def guardname(filename):

     if filename.startswith('./'):
         filename = filename[2:]
     return filename.replace("/", "_").replace("-", 

"_").split(".")[0].upper() + '_H'

The function always returns the same guard name (in my case _HOME_STEFAN_SRC_QEMU_QEMU_H)
which won't work when used for more than one header file.

Quoted 5 lines

I expect that blanks in the source path will also give unexpected results.

Even when this function were fixed, I think that
qapi-dir := $(BUILD_DIR)/qapi-generated
would be better.

Doing a more careful analysis of the out-of-tree build, I noticed that the system actually works correctly if the source directory is "distclean".
I don't think we support building qemu out-of-tree if the source dir hasn't been cleaned properly, so I don't think is worth pursuing this patch anymore.
Just be aware that a "make clean" is not enough.

#6 lore raw

PATCH 1/2 qapi: fix guardname generation

In reply to Stefan Weil

Fix a bug in handling dotted paths, and exclude directory prefixes from generated guardnames to avoid odd/pseudo-random guardnames in generated headers.

---
 scripts/qapi.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
scripts/qapi.py +4 -3
index 5299976..6e05469 100644
@@ -200,6 +200,7 @@ def basename(filename):
     return filename.split("/")[-1]
 
 def guardname(filename):
-    if filename.startswith('./'):
-        filename = filename[2:]
-    return filename.replace("/", "_").replace("-", "_").split(".")[0].upper() + '_H'
+    guard = basename(filename).rsplit(".", 1)[0]
+    for substr in [".", " ", "-"]:
+        guard = guard.replace(substr, "_")
+    return guard.upper() + '_H'
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH 2/2 Makefile: use full path for qapi-generated directory

Generally $(BUILD_DIR) == $(CURDIR), but that isn't necessarilly the case, so use $(BUILD_DIR)/qapi-generated for generated files to avoid potentionally sticking generating files in odd places outside the build's include paths.

---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
index 168093c..0b4b2c3 100644
@@ -167,7 +167,7 @@ check-qjson: check-qjson.o $(qobject-obj-y) $(tools-obj-y)
 test-coroutine: test-coroutine.o qemu-timer-common.o async.o $(coroutine-obj-y) $(tools-obj-y)
 
 $(qapi-obj-y): $(GENERATED_HEADERS)
-qapi-dir := qapi-generated
+qapi-dir := $(BUILD_DIR)/qapi-generated
 test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-dir)
 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
 
Signature · 1 line
1.7.4.1
Reviewed-by on v1 2/2
#8 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory

Quoted 7 lines · Michael Roth

Generally $(BUILD_DIR) == $(CURDIR), but that isn't necessarilly the case, so use $(BUILD_DIR)/qapi-generated for generated files to avoid potentionally sticking generating files in odd places outside the build's include paths.
---
 Makefile |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)

Not applied to trivial tree yet. I want to let Stefano, Stefan Weil, or Anthony take a look too since we were all discussing these changes yesterday.

Stefan

#9 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory

Quoted 10 lines · Stefan Hajnoczi
Quoted 7 lines · Michael Roth

Generally $(BUILD_DIR) == $(CURDIR), but that isn't necessarilly the case, so use $(BUILD_DIR)/qapi-generated for generated files to avoid potentionally sticking generating files in odd places outside the build's include paths.
---
� Makefile | �  � 2 +-
� 1 files changed, 1 insertions(+), 1 deletions(-)

Quoted 5 lines

Not applied to trivial tree yet. I want to let Stefano, Stefan Weil, or Anthony take a look too since we were all discussing these changes yesterday.

While I think that the change is correct (certainly better than the original patch), unfortunately still doesn't solve the problem entirely.
Steps to repro, assuming "qemu" is the source tree and "temp" is the empty build directory:

- cd qemu; ./configure; make

- cd ../temp; ./configure --source-path=../qemu; make

Result:

Makefile:9: config-devices.mak: No such file or directory

In order to fix the issue, we need to make sure that config-devices.mak is relative to $(BUILD_DIR) in the Makefile.

Makefile +3 -3
index 301c75e..b9f8de7 100644
@@ -43,15 +43,15 @@ DOCS=
 endif
 
 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
-SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
-SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %/config-devices.mak.d, $(TARGET_DIRS))
+SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(BUILD_DIR)/$(TARGET_DIRS))
+SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %/config-devices.mak.d, $(BUILD_DIR)/$(TARGET_DIRS))
 
 config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
 	$(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u > $@,"  GEN   $@")
 
 -include $(SUBDIR_DEVICES_MAK_DEP)
 
-%/config-devices.mak: default-configs/%.mak
+$(BUILD_DIR)/%/config-devices.mak: default-configs/%.mak
 	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
 	@if test -f $@; then \
 	  if cmp -s [email protected] $@; then \
#10 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory

Am 30.11.2011 14:03, schrieb Stefano Stabellini:

Makefile

Quoted 37 lines · Stefan Hajnoczi
Quoted 10 lines
Quoted 7 lines · Michael Roth

Generally $(BUILD_DIR) == $(CURDIR), but that isn't necessarilly the case, so use $(BUILD_DIR)/qapi-generated for generated files to avoid potentionally sticking generating files in odd places outside the build's include paths.
---
� Makefile | � � 2 +-
� 1 files changed, 1 insertions(+), 1 deletions(-)

Quoted 5 lines

Not applied to trivial tree yet. I want to let Stefano, Stefan Weil, or Anthony take a look too since we were all discussing these changes yesterday.

While I think that the change is correct (certainly better than the original patch), unfortunately still doesn't solve the problem entirely.
Steps to repro, assuming "qemu" is the source tree and "temp" is the empty build directory:

- cd qemu; ./configure; make

- cd ../temp; ./configure --source-path=../qemu; make

Result:

Makefile:9: config-devices.mak: No such file or directory

In order to fix the issue, we need to make sure that config-devices.mak is relative to $(BUILD_DIR) in the Makefile.

Makefile +0 -0

[snip]

It's common to use either out-of-tree builds or in-tree builds, but not to mix both variants with a common root directory. I think QEMU should explicitly forbid that mixed scenario (like other projects do).

Even with your fix there can remain problems with generated header files. The mixed scenario creates unnecessary complexity. Without the mixed scenario, your patch is not needed.

Regards,
Stefan Weil

#11 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory

Quoted 7 lines · Stefan Weil

It's common to use either out-of-tree builds or in-tree builds, but not to mix both variants with a common root directory. I think QEMU should explicitly forbid that mixed scenario (like other projects do).

Even with your fix there can remain problems with generated header files.

Really? Can you provide more specific details?

Quoted 2 lines

The mixed scenario creates unnecessary complexity. Without the mixed scenario, your patch is not needed.

I agree that supporting the mixed scenario shouldn't be a priority. However without this last patch a "make clean" on the main tree is not enough to allow out of tree builds.

Try the following scenario:

- cd qemu; ./configure; make

- make clean

- cd ../temp; ./configure --source-path=../qemu; make

this has to work, right? It does not without the patch to fix the generation of config-devices.mak.

#12 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory

Quoted 20 lines · Stefano Stabellini
Quoted 7 lines · Stefan Weil

It's common to use either out-of-tree builds or in-tree builds, but not to mix both variants with a common root directory. I think QEMU should explicitly forbid that mixed scenario (like other projects do).

Even with your fix there can remain problems with generated header files.

Really? Can you provide more specific details?

Quoted 2 lines

The mixed scenario creates unnecessary complexity. Without the mixed scenario, your patch is not needed.

I agree that supporting the mixed scenario shouldn't be a priority. However without this last patch a "make clean" on the main tree is not enough to allow out of tree builds.

Try the following scenario:

Quoted 9 lines

- cd qemu; ./configure; make

- make clean

- cd ../temp; ./configure --source-path=../qemu; make

this has to work, right? It does not without the patch to fix the generation of config-devices.mak.

To clarify, the first patch I sent fix a bug that's not currently triggered due to qapi-dir always ending up being "qapi-generated/", so the guardname generated works, albeit with some needlessly verbose names.

The second isn't intended to fix your issue with builds, but avoid potential problems that may arise if at some point $(BUILD_DIR) != $(CURDIR).

So they don't actually fix anything, just potential bugs that may arise in the future.

The issue with doing out of tree builds with a dirty source directory is really just an unsupported scenario. To really clean things up, you need to run make distclean using the same configuration you used to dirty the directory in the first place, otherwise even make distclean will leave cruft laying in target directories not present in your current config.

Alexandre Raymond sent a patch to make it so that make distclean always left the source directory pristine, but there was some contention on what exactly a make distclean entails and it wasn't applied:

http://lists.gnu.org/archive/html/qemu-trivial/2011-07/msg00037.html

That's really the only complete fix for these build issues. I'm starting to think it'd be worth it to add a make clean_for_reals target that does what Alexandre's patch does and tell people to run it after a pull or switching to out-of-tree builds.

#13 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory

In reply to Stefano Stabellini

Am 01.12.2011 16:19, schrieb Stefano Stabellini:

Quoted 10 lines · Stefan Weil
Quoted 7 lines

It's common to use either out-of-tree builds or in-tree builds, but not to mix both variants with a common root directory. I think QEMU should explicitly forbid that mixed scenario (like other projects do).

Even with your fix there can remain problems with generated header files.

Really? Can you provide more specific details?

Yes. Suppose different generated header files with the same name exist in the source directory tree and in the build directory tree.

Then compiler options (the order of -I options) will determine which of two header files with same name will be used in out-of-tree builds. If the wrong one (that from the source directory tree) is used, the compiler might fail or produce wrong code (for example when macro values changed).

Quoted 7 lines
Quoted 2 lines

The mixed scenario creates unnecessary complexity. Without the mixed scenario, your patch is not needed.

I agree that supporting the mixed scenario shouldn't be a priority. However without this last patch a "make clean" on the main tree is not enough to allow out of tree builds.

Quoted 7 lines

Try the following scenario:

- cd qemu; ./configure; make

- make clean

- cd ../temp; ./configure --source-path=../qemu; make

Which ./configure do you run in an empty temp directory? This example (like similar ones in your previous mail) won't work.

Quoted 3 lines

this has to work, right? It does not without the patch to fix the generation of config-devices.mak.

No. You'll need a 'make distclean'. If that does what it should do, a following out-of-tree build will work.

Regards,
Stefan Weil

#14 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory

Quoted 29 lines · Stefan Weil

Am 01.12.2011 16:19, schrieb Stefano Stabellini:

Quoted 10 lines · Stefan Weil
Quoted 7 lines

It's common to use either out-of-tree builds or in-tree builds, but not to mix both variants with a common root directory. I think QEMU should explicitly forbid that mixed scenario (like other projects do).

Even with your fix there can remain problems with generated header files.

Really? Can you provide more specific details?

Yes. Suppose different generated header files with the same name exist in the source directory tree and in the build directory tree.

Then compiler options (the order of -I options) will determine which of two header files with same name will be used in out-of-tree builds. If the wrong one (that from the source directory tree) is used, the compiler might fail or produce wrong code (for example when macro values changed).

Quoted 9 lines
Quoted 2 lines

The mixed scenario creates unnecessary complexity. Without the mixed scenario, your patch is not needed.

I agree that supporting the mixed scenario shouldn't be a priority. However without this last patch a "make clean" on the main tree is not enough to allow out of tree builds.

Try the following scenario:

Quoted 8 lines
Quoted 5 lines

- cd qemu; ./configure; make

- make clean

- cd ../temp; ./configure --source-path=../qemu; make

Which ./configure do you run in an empty temp directory? This example (like similar ones in your previous mail) won't work.

Yes, you must do external builds only from a clean source directory. This is a perfectly normal requirement. In fact, I can't think of a project that doesn't require this.

Regards,

Anthony Liguori

Quoted 12 lines
Quoted 4 lines

this has to work, right? It does not without the patch to fix the generation of config-devices.mak.

No. You'll need a 'make distclean'. If that does what it should do, a following out-of-tree build will work.

Regards,
Stefan Weil

#15 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory

Quoted 34 lines · Anthony Liguori
Quoted 33 lines · Stefan Weil

Am 01.12.2011 16:19, schrieb Stefano Stabellini:

Quoted 10 lines · Stefan Weil
Quoted 7 lines

It's common to use either out-of-tree builds or in-tree builds, but not to mix both variants with a common root directory. I think QEMU should explicitly forbid that mixed scenario (like other projects do).

Even with your fix there can remain problems with generated header files.

Really? Can you provide more specific details?

Yes. Suppose different generated header files with the same name exist in the source directory tree and in the build directory tree.

Then compiler options (the order of -I options) will determine which of two header files with same name will be used in out-of-tree builds. If the wrong one (that from the source directory tree) is used, the compiler might fail or produce wrong code (for example when macro values changed).

Quoted 13 lines
Quoted 2 lines

The mixed scenario creates unnecessary complexity. Without the mixed scenario, your patch is not needed.

I agree that supporting the mixed scenario shouldn't be a priority. However without this last patch a "make clean" on the main tree is not enough to allow out of tree builds.

Try the following scenario:

- cd qemu; ./configure; make

- make clean

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

- cd ../temp; ./configure --source-path=../qemu; make

Which ./configure do you run in an empty temp directory? This example (like similar ones in your previous mail) won't work.

Yes, you must do external builds only from a clean source directory. This is a perfectly normal requirement. In fact, I can't think of a project that doesn't require this.

Fair enough.

In that case, like Michael Roth wrote, the patch "Makefile: use full path for qapi-generated directory" doesn't actually fix anything, so probably we don't need it either, but I'll leave it up to you.

#16 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory

Quoted 44 lines · Stefano Stabellini
Quoted 34 lines · Anthony Liguori
Quoted 33 lines · Stefan Weil

Am 01.12.2011 16:19, schrieb Stefano Stabellini:

Quoted 10 lines · Stefan Weil
Quoted 7 lines

It's common to use either out-of-tree builds or in-tree builds, but not to mix both variants with a common root directory. I think QEMU should explicitly forbid that mixed scenario (like other projects do).

Even with your fix there can remain problems with generated header files.

Really? Can you provide more specific details?

Yes. Suppose different generated header files with the same name exist in the source directory tree and in the build directory tree.

Then compiler options (the order of -I options) will determine which of two header files with same name will be used in out-of-tree builds. If the wrong one (that from the source directory tree) is used, the compiler might fail or produce wrong code (for example when macro values changed).

Quoted 13 lines
Quoted 2 lines

The mixed scenario creates unnecessary complexity. Without the mixed scenario, your patch is not needed.

I agree that supporting the mixed scenario shouldn't be a priority. However without this last patch a "make clean" on the main tree is not enough to allow out of tree builds.

Try the following scenario:

- cd qemu; ./configure; make

- make clean

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

- cd ../temp; ./configure --source-path=../qemu; make

Which ./configure do you run in an empty temp directory? This example (like similar ones in your previous mail) won't work.

Yes, you must do external builds only from a clean source directory. This is a perfectly normal requirement. In fact, I can't think of a project that doesn't require this.

Quoted 6 lines

Fair enough.

In that case, like Michael Roth wrote, the patch "Makefile: use full path for qapi-generated directory" doesn't actually fix anything, so probably we don't need it either, but I'll leave it up to you.

Yup, it's just to address some potential issues/suggestions Stefan Weil pointed out. I think patch 1 should be applied though.

#17 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory

In reply to Stefan Weil
Quoted 29 lines · Stefan Weil

Am 01.12.2011 16:19, schrieb Stefano Stabellini:

Quoted 10 lines · Stefan Weil
Quoted 7 lines

It's common to use either out-of-tree builds or in-tree builds, but not to mix both variants with a common root directory. I think QEMU should explicitly forbid that mixed scenario (like other projects do).

Even with your fix there can remain problems with generated header files.

Really? Can you provide more specific details?

Yes. Suppose different generated header files with the same name exist in the source directory tree and in the build directory tree.

Then compiler options (the order of -I options) will determine which of two header files with same name will be used in out-of-tree builds. If the wrong one (that from the source directory tree) is used, the compiler might fail or produce wrong code (for example when macro values changed).

Quoted 9 lines
Quoted 2 lines

The mixed scenario creates unnecessary complexity. Without the mixed scenario, your patch is not needed.

I agree that supporting the mixed scenario shouldn't be a priority. However without this last patch a "make clean" on the main tree is not enough to allow out of tree builds.

Try the following scenario:

Quoted 8 lines
Quoted 5 lines

- cd qemu; ./configure; make

- make clean

- cd ../temp; ./configure --source-path=../qemu; make

Which ./configure do you run in an empty temp directory? This example (like similar ones in your previous mail) won't work.

Sorry, it was supposed to be ../qemu/configure

Reviewed-by on v1 1/2
#18 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH 1/2] qapi: fix guardname generation

In reply to Michael Roth
Quoted 6 lines · Michael Roth

Fix a bug in handling dotted paths, and exclude directory prefixes from generated guardnames to avoid odd/pseudo-random guardnames in generated headers.
---
 scripts/qapi.py |    7 ++++---

 1 files changed, 4 insertions(+), 3 deletions(-)