From 54c2e50205711a4dc5134d07079174e3e8be10a7 Mon Sep 17 00:00:00 2001 From: Dunrong Huang Date: Sun, 29 Jul 2012 03:11:24 +0800 Subject: [PATCH] build: Fix linking failure for qemu-ga This patch will fix the following linking failed: LINK qemu-ga gcc: error: qga/../qapi-generated/qga-qapi-types.o: No such file or directory gcc: error: qga/../qapi-generated/qga-qapi-visit.o: No such file or directory gcc: error: qga/../qapi-generated/qga-qmp-marshal.o: No such file or directory make: *** [qemu-ga] Error 1 Commit cdc976b040f2760103ce2fb49f4d504093a7163f changes the dependencies of qemu-ga to depend "../qapi-generated/qga-qapi-types.o", which will be expanded to "qga/../qapi-generated/qga-qapi-types.o" when building qemu-ga. In top-level Makefile, we defined a target "qapi-generated/qga-qapi-types.o" which was not equal to "qga/../qapi-generated/qga-qapi-types" in the Makefile world. So "No such file" error happened when qemu-ga was linking. The easy approach to fix is to change the target name to "qga/../qapi-generated/qga-qapi-types.o", but it is weird. So, in order to solve it more graciously, I move those temporary files(qga-qapi-*.{c,h}) qemu-ga depends on to qemu-ga/qapi-generated, this makes dependencies more clearer. Signed-off-by: Dunrong Huang Signed-off-by: Blue Swirl --- Makefile | 19 +++++++++---------- qga/Makefile.objs | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index a1195ffa77..621cb8617c 100644 --- a/Makefile +++ b/Makefile @@ -173,7 +173,7 @@ qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@") qemu-ga$(EXESUF): LIBS = $(LIBS_QGA) -qemu-ga$(EXESUF): QEMU_CFLAGS += -I qapi-generated +qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated gen-out-type = $(subst .,-,$(suffix $@)) @@ -181,15 +181,15 @@ ifneq ($(wildcard config-host.mak),) include $(SRC_PATH)/tests/Makefile endif -qapi-generated/qga-qapi-types.c qapi-generated/qga-qapi-types.h :\ +qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\ $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py - $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qapi-generated -p "qga-" < $<, " GEN $@") -qapi-generated/qga-qapi-visit.c qapi-generated/qga-qapi-visit.h :\ + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, " GEN $@") +qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\ $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py - $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o qapi-generated -p "qga-" < $<, " GEN $@") -qapi-generated/qga-qmp-commands.h qapi-generated/qga-qmp-marshal.c :\ + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, " GEN $@") +qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\ $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py - $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o qapi-generated -p "qga-" < $<, " GEN $@") + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, " GEN $@") qapi-types.c qapi-types.h :\ $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py @@ -201,9 +201,7 @@ qmp-commands.h qmp-marshal.c :\ $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, " GEN $@") -QGALIB_OBJ=$(addprefix qapi-generated/, qga-qapi-types.o qga-qapi-visit.o qga-qmp-marshal.o) -QGALIB_GEN=$(addprefix qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h) -$(QGALIB_OBJ): $(QGALIB_GEN) +QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h) $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(tools-obj-y) $(qapi-obj-y) $(qobject-obj-y) $(version-obj-y) @@ -227,6 +225,7 @@ clean: rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp) rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp) rm -rf qapi-generated + rm -rf qga/qapi-generated $(MAKE) -C tests/tcg clean for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \ if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \ diff --git a/qga/Makefile.objs b/qga/Makefile.objs index b54b9b12f0..cd3e13516c 100644 --- a/qga/Makefile.objs +++ b/qga/Makefile.objs @@ -1,5 +1,5 @@ qga-obj-y = commands.o guest-agent-command-state.o qga-obj-$(CONFIG_POSIX) += commands-posix.o channel-posix.o qga-obj-$(CONFIG_WIN32) += commands-win32.o channel-win32.o service-win32.o -qga-obj-y += ../qapi-generated/qga-qapi-types.o ../qapi-generated/qga-qapi-visit.o -qga-obj-y += ../qapi-generated/qga-qmp-marshal.o +qga-obj-y += qapi-generated/qga-qapi-types.o qapi-generated/qga-qapi-visit.o +qga-obj-y += qapi-generated/qga-qmp-marshal.o