qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation
@ 2013-04-29 10:11 Paolo Bonzini
  2013-04-29 10:11 ` [Qemu-devel] [PATCH 1/4] win32: add generic RC rules to rules.mak Paolo Bonzini
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Paolo Bonzini @ 2013-04-29 10:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: blauwirbel, sw, aliguori

Here is a fix for the Win32 compilation problem that Blue reported,
and another two nits I found while testing.  After these patches, a
cross libtool is not needed anymore to build on Win32.

The following changes since commit 75f6e8b0f121beeee6a95eb9e35d88ec1f01824f:

  virtio-rng-s390: add properties. (2013-04-26 20:18:25 +0200)

are available in the git repository at:

  git://github.com/bonzini/qemu.git migration-writev

for you to fetch changes up to 9adea5f7f7a23ef4a1231289a36a94c52347b142:

  win32: add readv/writev emulation (2013-04-29 10:52:36 +0200)

v5->v6: just include config-host.h in osdep.h [Peter]

----------------------------------------------------------------
Paolo Bonzini (4):
      win32: add generic RC rules to rules.mak
      win32: move Makefile dependencies on version-obj-y to rules.mak
      win32: generate console executable again
      win32: add readv/writev emulation

 Makefile              |  5 +----
 Makefile.target       |  2 +-
 include/qemu-common.h | 22 ++--------------------
 include/qemu/osdep.h  | 17 +++++++++++++++++
 rules.mak             |  7 +++++++
 util/iov.c            |  2 +-
 util/osdep.c          | 43 +++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 72 insertions(+), 26 deletions(-)
-- 
1.8.2

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

* [Qemu-devel] [PATCH 1/4] win32: add generic RC rules to rules.mak
  2013-04-29 10:11 [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation Paolo Bonzini
@ 2013-04-29 10:11 ` Paolo Bonzini
  2013-04-29 10:11 ` [Qemu-devel] [PATCH 2/4] win32: move Makefile dependencies on version-obj-y " Paolo Bonzini
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2013-04-29 10:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: blauwirbel, sw, aliguori

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile  | 2 --
 rules.mak | 4 ++++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 8aca92f..58e3527 100644
--- a/Makefile
+++ b/Makefile
@@ -167,9 +167,7 @@ recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
 bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
 
 version.o: $(SRC_PATH)/version.rc config-host.h | version.lo
-	$(call quiet-command,$(WINDRES) -I. -o $@ $<,"  RC    $(TARGET_DIR)$@")
 version.lo: $(SRC_PATH)/version.rc config-host.h
-	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=RC $(WINDRES) -I. -o $@ $<,"lt RC   $(TARGET_DIR)$@")
 
 version-obj-$(CONFIG_WIN32) += version.o
 version-lobj-$(CONFIG_WIN32) += $(if $(LIBTOOL),version.lo)
diff --git a/rules.mak b/rules.mak
index 292a422..279525d 100644
--- a/rules.mak
+++ b/rules.mak
@@ -19,6 +19,8 @@ QEMU_CFLAGS += -I$(<D) -I$(@D)
 
 %.o: %.c
 	$(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
+%.o: %.rc
+	$(call quiet-command,$(WINDRES) -I. -o $@ $<,"  RC    $(TARGET_DIR)$@")
 
 ifeq ($(LIBTOOL),)
 LIBTOOL = /bin/false
@@ -29,6 +31,8 @@ else
 LIBTOOL += $(if $(V),,--quiet)
 %.lo: %.c
 	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC $(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  lt CC $@")
+%.lo: %.rc
+	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=RC $(WINDRES) -I. -o $@ $<,"lt RC   $(TARGET_DIR)$@")
 %.lo: %.dtrace
 	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC dtrace -o $@ -G -s $<, " lt GEN $(TARGET_DIR)$@")
 
-- 
1.8.2

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

* [Qemu-devel] [PATCH 2/4] win32: move Makefile dependencies on version-obj-y to rules.mak
  2013-04-29 10:11 [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation Paolo Bonzini
  2013-04-29 10:11 ` [Qemu-devel] [PATCH 1/4] win32: add generic RC rules to rules.mak Paolo Bonzini
@ 2013-04-29 10:11 ` Paolo Bonzini
  2013-04-29 10:11 ` [Qemu-devel] [PATCH 3/4] win32: generate console executable again Paolo Bonzini
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2013-04-29 10:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: blauwirbel, sw, aliguori

This makes the test on $(LIBTOOL) work.  Otherwise, LIBTOOL
is /bin/false by the time the test is done.

Fixes Win32 compilation without a working cross-libtool.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile  | 3 +--
 rules.mak | 3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 58e3527..f91f3b0 100644
--- a/Makefile
+++ b/Makefile
@@ -170,8 +170,7 @@ version.o: $(SRC_PATH)/version.rc config-host.h | version.lo
 version.lo: $(SRC_PATH)/version.rc config-host.h
 
 version-obj-$(CONFIG_WIN32) += version.o
-version-lobj-$(CONFIG_WIN32) += $(if $(LIBTOOL),version.lo)
-Makefile: $(version-obj-y) $(version-lobj-y)
+version-lobj-$(CONFIG_WIN32) += version.lo
 
 
 ######################################################################
diff --git a/rules.mak b/rules.mak
index 279525d..197a9d7 100644
--- a/rules.mak
+++ b/rules.mak
@@ -22,12 +22,15 @@ QEMU_CFLAGS += -I$(<D) -I$(@D)
 %.o: %.rc
 	$(call quiet-command,$(WINDRES) -I. -o $@ $<,"  RC    $(TARGET_DIR)$@")
 
+Makefile: $(version-obj-y)
+
 ifeq ($(LIBTOOL),)
 LIBTOOL = /bin/false
 LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
        $(sort $(filter %.o, $1)) $(filter-out %.o, $1) $(version-obj-y) \
        $(LIBS),"  LINK  $(TARGET_DIR)$@")
 else
+Makefile: $(version-lobj-y)
 LIBTOOL += $(if $(V),,--quiet)
 %.lo: %.c
 	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC $(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  lt CC $@")
-- 
1.8.2

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

* [Qemu-devel] [PATCH 3/4] win32: generate console executable again
  2013-04-29 10:11 [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation Paolo Bonzini
  2013-04-29 10:11 ` [Qemu-devel] [PATCH 1/4] win32: add generic RC rules to rules.mak Paolo Bonzini
  2013-04-29 10:11 ` [Qemu-devel] [PATCH 2/4] win32: move Makefile dependencies on version-obj-y " Paolo Bonzini
@ 2013-04-29 10:11 ` Paolo Bonzini
  2013-04-29 10:11 ` [Qemu-devel] [PATCH 4/4] win32: add readv/writev emulation Paolo Bonzini
  2013-05-03 17:04 ` [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation Stefan Weil
  4 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2013-04-29 10:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: blauwirbel, sw, aliguori

The -mwindows option is not anymore in LIBS at this point of the Makefile,
it is only in libs_softmmu.  Check the right variable.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile.target | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.target b/Makefile.target
index 7e4c77a..6583b05 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -18,7 +18,7 @@ ifdef CONFIG_USER_ONLY
 QEMU_PROG=qemu-$(TARGET_ARCH2)
 else
 # system emulator name
-ifneq (,$(findstring -mwindows,$(LIBS)))
+ifneq (,$(findstring -mwindows,$(libs_softmmu)))
 # Terminate program name with a 'w' because the linker builds a windows executable.
 QEMU_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF)
 endif # windows executable
-- 
1.8.2

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

* [Qemu-devel] [PATCH 4/4] win32: add readv/writev emulation
  2013-04-29 10:11 [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation Paolo Bonzini
                   ` (2 preceding siblings ...)
  2013-04-29 10:11 ` [Qemu-devel] [PATCH 3/4] win32: generate console executable again Paolo Bonzini
@ 2013-04-29 10:11 ` Paolo Bonzini
  2013-05-03 17:04 ` [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation Stefan Weil
  4 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2013-04-29 10:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: blauwirbel, sw, aliguori

Commit e9d8fbf (qemu-file: do not use stdio for qemu_fdopen, 2013-03-27)
introduced a usage of writev, which mingw32 does not have.  Even though
qemu_fdopen itself is not used on mingw32, the future-proof solution is
to add an implementation of it.  This is simple and similar to how we
emulate sendmsg/recvmsg in util/iov.c.

Some files include osdep.h without qemu-common.h, so move the definition
of iovec to osdep.h too, and include osdep.h from qemu-common.h
unconditionally (protection against including files when NEED_CPU_H is
defined is not needed since the removal of AREG0).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu-common.h | 22 ++--------------------
 include/qemu/osdep.h  | 17 +++++++++++++++++
 util/iov.c            |  2 +-
 util/osdep.c          | 43 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 63 insertions(+), 21 deletions(-)

diff --git a/include/qemu-common.h b/include/qemu-common.h
index a39cdba..b399d85 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -84,20 +84,6 @@
 # error Unknown pointer size
 #endif
 
-#ifndef CONFIG_IOVEC
-#define CONFIG_IOVEC
-struct iovec {
-    void *iov_base;
-    size_t iov_len;
-};
-/*
- * Use the same value as Linux for now.
- */
-#define IOV_MAX		1024
-#else
-#include <sys/uio.h>
-#endif
-
 typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
     GCC_FMT_ATTR(2, 3);
 
@@ -122,16 +108,12 @@ static inline char *realpath(const char *path, char *resolved_path)
 void configure_icount(const char *option);
 extern int use_icount;
 
-/* FIXME: Remove NEED_CPU_H.  */
-#ifndef NEED_CPU_H
-
 #include "qemu/osdep.h"
 #include "qemu/bswap.h"
 
-#else
-
+/* FIXME: Remove NEED_CPU_H.  */
+#ifdef NEED_CPU_H
 #include "cpu.h"
-
 #endif /* !defined(NEED_CPU_H) */
 
 /* main function, renamed */
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 8b465fd..42545bc 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -1,6 +1,7 @@
 #ifndef QEMU_OSDEP_H
 #define QEMU_OSDEP_H
 
+#include "config-host.h"
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdbool.h>
@@ -161,6 +162,22 @@ int qemu_close(int fd);
 int qemu_create_pidfile(const char *filename);
 int qemu_get_thread_id(void);
 
+#ifndef CONFIG_IOVEC
+struct iovec {
+    void *iov_base;
+    size_t iov_len;
+};
+/*
+ * Use the same value as Linux for now.
+ */
+#define IOV_MAX 1024
+
+ssize_t readv(int fd, const struct iovec *iov, int iov_cnt);
+ssize_t writev(int fd, const struct iovec *iov, int iov_cnt);
+#else
+#include <sys/uio.h>
+#endif
+
 #ifdef _WIN32
 static inline void qemu_timersub(const struct timeval *val1,
                                  const struct timeval *val2,
diff --git a/util/iov.c b/util/iov.c
index d32226d..78bbbe1 100644
--- a/util/iov.c
+++ b/util/iov.c
@@ -99,7 +99,7 @@ size_t iov_size(const struct iovec *iov, const unsigned int iov_cnt)
 static ssize_t
 do_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt, bool do_send)
 {
-#if defined CONFIG_IOVEC && defined CONFIG_POSIX
+#ifdef CONFIG_POSIX
     ssize_t ret;
     struct msghdr msg;
     memset(&msg, 0, sizeof(msg));
diff --git a/util/osdep.c b/util/osdep.c
index 6ae5aaf..685c8ae 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -429,3 +429,46 @@ int socket_init(void)
 #endif
     return 0;
 }
+
+#ifndef CONFIG_IOVEC
+/* helper function for iov_send_recv() */
+static ssize_t
+readv_writev(int fd, const struct iovec *iov, int iov_cnt, bool do_write)
+{
+    unsigned i = 0;
+    ssize_t ret = 0;
+    while (i < iov_cnt) {
+        ssize_t r = do_write
+            ? write(fd, iov[i].iov_base, iov[i].iov_len)
+            : read(fd, iov[i].iov_base, iov[i].iov_len);
+        if (r > 0) {
+            ret += r;
+        } else if (!r) {
+            break;
+        } else if (errno == EINTR) {
+            continue;
+        } else {
+            /* else it is some "other" error,
+             * only return if there was no data processed. */
+            if (ret == 0) {
+                ret = -1;
+            }
+            break;
+        }
+        i++;
+    }
+    return ret;
+}
+
+ssize_t
+readv(int fd, const struct iovec *iov, int iov_cnt)
+{
+    return readv_writev(fd, iov, iov_cnt, false);
+}
+
+ssize_t
+writev(int fd, const struct iovec *iov, int iov_cnt)
+{
+    return readv_writev(fd, iov, iov_cnt, true);
+}
+#endif
-- 
1.8.2

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

* Re: [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation
  2013-04-29 10:11 [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation Paolo Bonzini
                   ` (3 preceding siblings ...)
  2013-04-29 10:11 ` [Qemu-devel] [PATCH 4/4] win32: add readv/writev emulation Paolo Bonzini
@ 2013-05-03 17:04 ` Stefan Weil
  2013-05-03 18:54   ` Anthony Liguori
  4 siblings, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2013-05-03 17:04 UTC (permalink / raw)
  To: Paolo Bonzini, aliguori; +Cc: blauwirbel, qemu-devel

Am 29.04.2013 12:11, schrieb Paolo Bonzini:
> Here is a fix for the Win32 compilation problem that Blue reported,
> and another two nits I found while testing.  After these patches, a
> cross libtool is not needed anymore to build on Win32.
>
> The following changes since commit 75f6e8b0f121beeee6a95eb9e35d88ec1f01824f:
>
>   virtio-rng-s390: add properties. (2013-04-26 20:18:25 +0200)
>
> are available in the git repository at:
>
>   git://github.com/bonzini/qemu.git migration-writev
>
> for you to fetch changes up to 9adea5f7f7a23ef4a1231289a36a94c52347b142:
>
>   win32: add readv/writev emulation (2013-04-29 10:52:36 +0200)
>
> v5->v6: just include config-host.h in osdep.h [Peter]
>
> ----------------------------------------------------------------
> Paolo Bonzini (4):
>       win32: add generic RC rules to rules.mak
>       win32: move Makefile dependencies on version-obj-y to rules.mak
>       win32: generate console executable again
>       win32: add readv/writev emulation
>
>  Makefile              |  5 +----
>  Makefile.target       |  2 +-
>  include/qemu-common.h | 22 ++--------------------
>  include/qemu/osdep.h  | 17 +++++++++++++++++
>  rules.mak             |  7 +++++++
>  util/iov.c            |  2 +-
>  util/osdep.c          | 43 +++++++++++++++++++++++++++++++++++++++++++
>  7 files changed, 72 insertions(+), 26 deletions(-)


Hi Paolo,

these patches need to be rebased for the latest QEMU.
Could you please send an update?

Anthony, the patches fix the currently broken build for
w32/w64 hosts, so please apply them soon when they
are available.

Thanks,
Stefan

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

* Re: [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation
  2013-05-03 17:04 ` [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation Stefan Weil
@ 2013-05-03 18:54   ` Anthony Liguori
  0 siblings, 0 replies; 7+ messages in thread
From: Anthony Liguori @ 2013-05-03 18:54 UTC (permalink / raw)
  To: Stefan Weil, Paolo Bonzini; +Cc: blauwirbel, qemu-devel

Stefan Weil <sw@weilnetz.de> writes:

> Am 29.04.2013 12:11, schrieb Paolo Bonzini:
>> Here is a fix for the Win32 compilation problem that Blue reported,
>> and another two nits I found while testing.  After these patches, a
>> cross libtool is not needed anymore to build on Win32.
>>
>> The following changes since commit 75f6e8b0f121beeee6a95eb9e35d88ec1f01824f:
>>
>>   virtio-rng-s390: add properties. (2013-04-26 20:18:25 +0200)
>>
>> are available in the git repository at:
>>
>>   git://github.com/bonzini/qemu.git migration-writev
>>
>> for you to fetch changes up to 9adea5f7f7a23ef4a1231289a36a94c52347b142:
>>
>>   win32: add readv/writev emulation (2013-04-29 10:52:36 +0200)
>>
>> v5->v6: just include config-host.h in osdep.h [Peter]
>>
>> ----------------------------------------------------------------
>> Paolo Bonzini (4):
>>       win32: add generic RC rules to rules.mak
>>       win32: move Makefile dependencies on version-obj-y to rules.mak
>>       win32: generate console executable again
>>       win32: add readv/writev emulation
>>
>>  Makefile              |  5 +----
>>  Makefile.target       |  2 +-
>>  include/qemu-common.h | 22 ++--------------------
>>  include/qemu/osdep.h  | 17 +++++++++++++++++
>>  rules.mak             |  7 +++++++
>>  util/iov.c            |  2 +-
>>  util/osdep.c          | 43 +++++++++++++++++++++++++++++++++++++++++++
>>  7 files changed, 72 insertions(+), 26 deletions(-)
>
>
> Hi Paolo,
>
> these patches need to be rebased for the latest QEMU.
> Could you please send an update?

This pull request was already merged.

commit b48df71c916478ff658d143d0742e85c78348fad
Merge: 45dddd9 9adea5f
Author: Anthony Liguori <aliguori@us.ibm.com>
Date:   Mon Apr 29 08:26:47 2013 -0500

    Merge remote-tracking branch 'bonzini/migration-writev' into staging
    
    # By Paolo Bonzini
    # Via Paolo Bonzini
    * bonzini/migration-writev:
      win32: add readv/writev emulation
      win32: generate console executable again
      win32: move Makefile dependencies on version-obj-y to rules.mak
      win32: add generic RC rules to rules.mak
    
    Message-id: 1367230284-24612-1-git-send-email-pbonzini@redhat.com
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

>
> Anthony, the patches fix the currently broken build for
> w32/w64 hosts, so please apply them soon when they
> are available.
>
> Thanks,
> Stefan

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

end of thread, other threads:[~2013-05-03 18:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-29 10:11 [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation Paolo Bonzini
2013-04-29 10:11 ` [Qemu-devel] [PATCH 1/4] win32: add generic RC rules to rules.mak Paolo Bonzini
2013-04-29 10:11 ` [Qemu-devel] [PATCH 2/4] win32: move Makefile dependencies on version-obj-y " Paolo Bonzini
2013-04-29 10:11 ` [Qemu-devel] [PATCH 3/4] win32: generate console executable again Paolo Bonzini
2013-04-29 10:11 ` [Qemu-devel] [PATCH 4/4] win32: add readv/writev emulation Paolo Bonzini
2013-05-03 17:04 ` [Qemu-devel] [PULL 1.5 v6 0/4] fix win32 compilation Stefan Weil
2013-05-03 18:54   ` Anthony Liguori

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