qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fix out of tree build
@ 2011-11-22 17:27 Stefano Stabellini
  2011-11-23  9:48 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  2011-11-28 18:34 ` [Qemu-devel] " Stefan Weil
  0 siblings, 2 replies; 19+ messages in thread
From: Stefano Stabellini @ 2011-11-22 17:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial


Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

diff --git a/Makefile b/Makefile
index 168093c..885065f 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
 

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] fix out of tree build
  2011-11-22 17:27 [Qemu-devel] [PATCH] fix out of tree build Stefano Stabellini
@ 2011-11-23  9:48 ` Stefan Hajnoczi
  2011-11-28 18:34 ` [Qemu-devel] " Stefan Weil
  1 sibling, 0 replies; 19+ messages in thread
From: Stefan Hajnoczi @ 2011-11-23  9:48 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: qemu-trivial, qemu-devel

On Tue, Nov 22, 2011 at 05:27:15PM +0000, Stefano Stabellini wrote:
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

Thanks, applied to the trivial patches -next tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches-next

Stefan

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

* Re: [Qemu-devel] [PATCH] fix out of tree build
  2011-11-22 17:27 [Qemu-devel] [PATCH] fix out of tree build Stefano Stabellini
  2011-11-23  9:48 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
@ 2011-11-28 18:34 ` Stefan Weil
  2011-11-28 18:45   ` Anthony Liguori
  2011-11-28 20:40   ` Stefan Weil
  1 sibling, 2 replies; 19+ messages in thread
From: Stefan Weil @ 2011-11-28 18:34 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: qemu-trivial, Anthony Liguori, qemu-devel

Am 22.11.2011 18:27, schrieb Stefano Stabellini:
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
> diff --git a/Makefile b/Makefile
> index 168093c..885065f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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’

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

* Re: [Qemu-devel] [PATCH] fix out of tree build
  2011-11-28 18:34 ` [Qemu-devel] " Stefan Weil
@ 2011-11-28 18:45   ` Anthony Liguori
  2011-11-28 20:40   ` Stefan Weil
  1 sibling, 0 replies; 19+ messages in thread
From: Anthony Liguori @ 2011-11-28 18:45 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, Anthony Liguori, qemu-devel, Stefano Stabellini

On 11/28/2011 12:34 PM, Stefan Weil wrote:
> Am 22.11.2011 18:27, schrieb Stefano Stabellini:
>>
>> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>>
>> diff --git a/Makefile b/Makefile
>> index 168093c..885065f 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -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.

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

>
> 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’
>
>

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

* Re: [Qemu-devel] [PATCH] fix out of tree build
  2011-11-28 18:34 ` [Qemu-devel] " Stefan Weil
  2011-11-28 18:45   ` Anthony Liguori
@ 2011-11-28 20:40   ` Stefan Weil
  2011-11-29 16:23     ` Stefano Stabellini
  2011-11-29 22:47     ` [Qemu-devel] [PATCH 1/2] qapi: fix guardname generation Michael Roth
  1 sibling, 2 replies; 19+ messages in thread
From: Stefan Weil @ 2011-11-28 20:40 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: qemu-trivial, Anthony Liguori, qemu-devel

Am 28.11.2011 19:34, schrieb Stefan Weil:
> Am 22.11.2011 18:27, schrieb Stefano Stabellini:
>>
>> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>>
>> diff --git a/Makefile b/Makefile
>> index 168093c..885065f 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -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’

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

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

* Re: [Qemu-devel] [PATCH] fix out of tree build
  2011-11-28 20:40   ` Stefan Weil
@ 2011-11-29 16:23     ` Stefano Stabellini
  2011-11-29 22:47     ` [Qemu-devel] [PATCH 1/2] qapi: fix guardname generation Michael Roth
  1 sibling, 0 replies; 19+ messages in thread
From: Stefano Stabellini @ 2011-11-29 16:23 UTC (permalink / raw)
  To: Stefan Weil
  Cc: qemu-trivial@nongnu.org, Anthony Liguori, qemu-devel@nongnu.org,
	Stefano Stabellini

On Mon, 28 Nov 2011, Stefan Weil wrote:
> 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 :-/


> 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.
 
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.

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

* [Qemu-devel] [PATCH 1/2] qapi: fix guardname generation
  2011-11-28 20:40   ` Stefan Weil
  2011-11-29 16:23     ` Stefano Stabellini
@ 2011-11-29 22:47     ` Michael Roth
  2011-11-29 22:47       ` [Qemu-devel] [PATCH 2/2] Makefile: use full path for qapi-generated directory Michael Roth
  2011-11-30  9:08       ` [Qemu-devel] [Qemu-trivial] [PATCH 1/2] qapi: fix guardname generation Stefan Hajnoczi
  1 sibling, 2 replies; 19+ messages in thread
From: Michael Roth @ 2011-11-29 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, sw, stefano.stabellini

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(-)

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 5299976..6e05469 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -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'
-- 
1.7.4.1

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

* [Qemu-devel] [PATCH 2/2] Makefile: use full path for qapi-generated directory
  2011-11-29 22:47     ` [Qemu-devel] [PATCH 1/2] qapi: fix guardname generation Michael Roth
@ 2011-11-29 22:47       ` Michael Roth
  2011-11-30  9:10         ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  2011-11-30  9:08       ` [Qemu-devel] [Qemu-trivial] [PATCH 1/2] qapi: fix guardname generation Stefan Hajnoczi
  1 sibling, 1 reply; 19+ messages in thread
From: Michael Roth @ 2011-11-29 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, sw, stefano.stabellini

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(-)

diff --git a/Makefile b/Makefile
index 168093c..0b4b2c3 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
 
-- 
1.7.4.1

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 1/2] qapi: fix guardname generation
  2011-11-29 22:47     ` [Qemu-devel] [PATCH 1/2] qapi: fix guardname generation Michael Roth
  2011-11-29 22:47       ` [Qemu-devel] [PATCH 2/2] Makefile: use full path for qapi-generated directory Michael Roth
@ 2011-11-30  9:08       ` Stefan Hajnoczi
  1 sibling, 0 replies; 19+ messages in thread
From: Stefan Hajnoczi @ 2011-11-30  9:08 UTC (permalink / raw)
  To: Michael Roth; +Cc: qemu-trivial, sw, qemu-devel, stefano.stabellini

On Tue, Nov 29, 2011 at 10:47 PM, Michael Roth
<mdroth@linux.vnet.ibm.com> wrote:
> 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(-)

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory
  2011-11-29 22:47       ` [Qemu-devel] [PATCH 2/2] Makefile: use full path for qapi-generated directory Michael Roth
@ 2011-11-30  9:10         ` Stefan Hajnoczi
  2011-11-30 13:03           ` Stefano Stabellini
  0 siblings, 1 reply; 19+ messages in thread
From: Stefan Hajnoczi @ 2011-11-30  9:10 UTC (permalink / raw)
  To: Michael Roth; +Cc: qemu-trivial, sw, qemu-devel, stefano.stabellini

On Tue, Nov 29, 2011 at 10:47 PM, Michael Roth
<mdroth@linux.vnet.ibm.com> wrote:
> 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(-)

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

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

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory
  2011-11-30  9:10         ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
@ 2011-11-30 13:03           ` Stefano Stabellini
  2011-11-30 19:59             ` Stefan Weil
  0 siblings, 1 reply; 19+ messages in thread
From: Stefano Stabellini @ 2011-11-30 13:03 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: qemu-trivial@nongnu.org, sw@weilnetz.de, Stefano Stabellini,
	Michael Roth, qemu-devel@nongnu.org

[-- Attachment #1: Type: text/plain, Size: 2244 bytes --]

On Wed, 30 Nov 2011, Stefan Hajnoczi wrote:
> On Tue, Nov 29, 2011 at 10:47 PM, Michael Roth
> <mdroth@linux.vnet.ibm.com> wrote:
> > 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(-)
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> 
> 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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

diff --git a/Makefile b/Makefile
index 301c75e..b9f8de7 100644
--- a/Makefile
+++ b/Makefile
@@ -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 $@.old $@; then \

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory
  2011-11-30 13:03           ` Stefano Stabellini
@ 2011-11-30 19:59             ` Stefan Weil
  2011-12-01 15:19               ` Stefano Stabellini
  0 siblings, 1 reply; 19+ messages in thread
From: Stefan Weil @ 2011-11-30 19:59 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: qemu-trivial@nongnu.org, Stefan Hajnoczi, Michael Roth,
	qemu-devel@nongnu.org

Am 30.11.2011 14:03, schrieb Stefano Stabellini:
> On Wed, 30 Nov 2011, Stefan Hajnoczi wrote:
>> On Tue, Nov 29, 2011 at 10:47 PM, Michael Roth
>> <mdroth@linux.vnet.ibm.com> wrote:
>>> 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(-)
>>
>> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
>>
>> 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.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
> diff --git a/Makefile b/Makefile
[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

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory
  2011-11-30 19:59             ` Stefan Weil
@ 2011-12-01 15:19               ` Stefano Stabellini
  2011-12-01 16:05                 ` Michael Roth
  2011-12-01 18:11                 ` Stefan Weil
  0 siblings, 2 replies; 19+ messages in thread
From: Stefano Stabellini @ 2011-12-01 15:19 UTC (permalink / raw)
  To: Stefan Weil
  Cc: qemu-trivial@nongnu.org, Stefan Hajnoczi, qemu-devel@nongnu.org,
	Michael Roth, Stefano Stabellini

On Wed, 30 Nov 2011, Stefan Weil wrote:
> 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?

> 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.

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory
  2011-12-01 15:19               ` Stefano Stabellini
@ 2011-12-01 16:05                 ` Michael Roth
  2011-12-01 18:11                 ` Stefan Weil
  1 sibling, 0 replies; 19+ messages in thread
From: Michael Roth @ 2011-12-01 16:05 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: qemu-trivial@nongnu.org, Stefan Weil, qemu-devel@nongnu.org,
	Stefan Hajnoczi

On 12/01/2011 09:19 AM, Stefano Stabellini wrote:
> On Wed, 30 Nov 2011, Stefan Weil wrote:
>> 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?
>
>> 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.
>

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.

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory
  2011-12-01 15:19               ` Stefano Stabellini
  2011-12-01 16:05                 ` Michael Roth
@ 2011-12-01 18:11                 ` Stefan Weil
  2011-12-01 18:28                   ` Anthony Liguori
  2011-12-01 18:38                   ` Stefano Stabellini
  1 sibling, 2 replies; 19+ messages in thread
From: Stefan Weil @ 2011-12-01 18:11 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: qemu-trivial@nongnu.org, Stefan Hajnoczi, Michael Roth,
	qemu-devel@nongnu.org

Am 01.12.2011 16:19, schrieb Stefano Stabellini:
> On Wed, 30 Nov 2011, Stefan Weil wrote:
>> 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).
>> 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

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

>
> 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

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory
  2011-12-01 18:11                 ` Stefan Weil
@ 2011-12-01 18:28                   ` Anthony Liguori
  2011-12-01 18:42                     ` Stefano Stabellini
  2011-12-01 18:38                   ` Stefano Stabellini
  1 sibling, 1 reply; 19+ messages in thread
From: Anthony Liguori @ 2011-12-01 18:28 UTC (permalink / raw)
  To: Stefan Weil
  Cc: qemu-trivial@nongnu.org, Stefan Hajnoczi, qemu-devel@nongnu.org,
	Michael Roth, Stefano Stabellini

On 12/01/2011 12:11 PM, Stefan Weil wrote:
> Am 01.12.2011 16:19, schrieb Stefano Stabellini:
>> On Wed, 30 Nov 2011, Stefan Weil wrote:
>>> 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).
>>> 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
>
> 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

>
>>
>> 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
>
>

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory
  2011-12-01 18:11                 ` Stefan Weil
  2011-12-01 18:28                   ` Anthony Liguori
@ 2011-12-01 18:38                   ` Stefano Stabellini
  1 sibling, 0 replies; 19+ messages in thread
From: Stefano Stabellini @ 2011-12-01 18:38 UTC (permalink / raw)
  To: Stefan Weil
  Cc: qemu-trivial@nongnu.org, Stefan Hajnoczi, qemu-devel@nongnu.org,
	Michael Roth, Stefano Stabellini

On Thu, 1 Dec 2011, Stefan Weil wrote:
> Am 01.12.2011 16:19, schrieb Stefano Stabellini:
> > On Wed, 30 Nov 2011, Stefan Weil wrote:
> >> 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).
> >> 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
> 
> 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

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory
  2011-12-01 18:28                   ` Anthony Liguori
@ 2011-12-01 18:42                     ` Stefano Stabellini
  2011-12-01 19:12                       ` Michael Roth
  0 siblings, 1 reply; 19+ messages in thread
From: Stefano Stabellini @ 2011-12-01 18:42 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: Stefano Stabellini, qemu-trivial@nongnu.org, Stefan Weil,
	qemu-devel@nongnu.org, Michael Roth, Stefan Hajnoczi

On Thu, 1 Dec 2011, Anthony Liguori wrote:
> On 12/01/2011 12:11 PM, Stefan Weil wrote:
> > Am 01.12.2011 16:19, schrieb Stefano Stabellini:
> >> On Wed, 30 Nov 2011, Stefan Weil wrote:
> >>> 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).
> >>> 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
> >
> > 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.

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] Makefile: use full path for qapi-generated directory
  2011-12-01 18:42                     ` Stefano Stabellini
@ 2011-12-01 19:12                       ` Michael Roth
  0 siblings, 0 replies; 19+ messages in thread
From: Michael Roth @ 2011-12-01 19:12 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: qemu-trivial@nongnu.org, Stefan Weil, qemu-devel@nongnu.org,
	Stefan Hajnoczi

On 12/01/2011 12:42 PM, Stefano Stabellini wrote:
> On Thu, 1 Dec 2011, Anthony Liguori wrote:
>> On 12/01/2011 12:11 PM, Stefan Weil wrote:
>>> Am 01.12.2011 16:19, schrieb Stefano Stabellini:
>>>> On Wed, 30 Nov 2011, Stefan Weil wrote:
>>>>> 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).
>>>>> 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
>>>
>>> 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.
>

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

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

end of thread, other threads:[~2011-12-01 19:13 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-22 17:27 [Qemu-devel] [PATCH] fix out of tree build Stefano Stabellini
2011-11-23  9:48 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2011-11-28 18:34 ` [Qemu-devel] " Stefan Weil
2011-11-28 18:45   ` Anthony Liguori
2011-11-28 20:40   ` Stefan Weil
2011-11-29 16:23     ` Stefano Stabellini
2011-11-29 22:47     ` [Qemu-devel] [PATCH 1/2] qapi: fix guardname generation Michael Roth
2011-11-29 22:47       ` [Qemu-devel] [PATCH 2/2] Makefile: use full path for qapi-generated directory Michael Roth
2011-11-30  9:10         ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2011-11-30 13:03           ` Stefano Stabellini
2011-11-30 19:59             ` Stefan Weil
2011-12-01 15:19               ` Stefano Stabellini
2011-12-01 16:05                 ` Michael Roth
2011-12-01 18:11                 ` Stefan Weil
2011-12-01 18:28                   ` Anthony Liguori
2011-12-01 18:42                     ` Stefano Stabellini
2011-12-01 19:12                       ` Michael Roth
2011-12-01 18:38                   ` Stefano Stabellini
2011-11-30  9:08       ` [Qemu-devel] [Qemu-trivial] [PATCH 1/2] qapi: fix guardname generation Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).