fix win32 compilation
v2 cover fix win32 compilation
Here is a fix for the Win32 compilation problem that Blue reported, and another nit I found while testing.
Paolo Bonzini (3):
add missing inclusions of config-host.h
win32: add readv/writev emulation
win32: generate console executable again
Makefile.target | 2 +- include/qemu-common.h | 22 ++-------------------- include/qemu/osdep.h | 16 ++++++++++++++++ qga/channel-posix.c | 1 + tests/libi2c-omap.c | 1 + tests/libqtest.c | 1 + tests/tcg/test-i386-fprem.c | 1 + tests/test-mul64.c | 1 + ui/sdl_zoom.c | 1 + ui/vnc.c | 1 + util/hbitmap.c | 1 + util/iov.c | 2 +- util/osdep.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 13 files changed, 70 insertions(+), 22 deletions(-)
Signature · 1 line
1.8.2
PATCH v2 1/3 add missing inclusions of config-host.h
The next patch will add a dependency of qemu/osdep.h on config-host.h. It could be nicer to use qemu-common.h, but I prefer to be safer this close to hard feature freeze.
--- qga/channel-posix.c | 1 + tests/libi2c-omap.c | 1 + tests/libqtest.c | 1 + tests/tcg/test-i386-fprem.c | 1 + tests/test-mul64.c | 1 + ui/sdl_zoom.c | 1 + ui/vnc.c | 1 + util/hbitmap.c | 1 + 8 files changed, 8 insertions(+)
qga/channel-posix.c +1 -0
@@ -5,6 +5,7 @@#include <fcntl.h> #include <stdlib.h> #include <string.h> +#include "config-host.h" #include "qemu/osdep.h" #include "qemu/sockets.h" #include "qga/channel.h"
tests/libi2c-omap.c +1 -0
@@ -11,6 +11,7 @@#include <glib.h> #include <string.h> +#include "config-host.h" #include "qemu/osdep.h" #include "qemu/bswap.h" #include "libqtest.h"
tests/libqtest.c +1 -0
@@ -28,6 +28,7 @@#include <unistd.h> #include <string.h> +#include "config-host.h" #include "qemu/compiler.h" #include "qemu/osdep.h"
tests/tcg/test-i386-fprem.c +1 -0
@@ -22,6 +22,7 @@* You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "config-host.h" #include "qemu/compiler.h" #include "qemu/osdep.h" #include <stdio.h>
tests/test-mul64.c +1 -0
@@ -8,6 +8,7 @@#include <glib.h> #include <stdint.h> +#include "config-host.h" #include "qemu/host-utils.h" #include "qemu/osdep.h"
ui/sdl_zoom.c +1 -0
@@ -11,6 +11,7 @@* */ +#include "config-host.h" #include "sdl_zoom.h" #include "qemu/osdep.h" #include <glib.h>
ui/vnc.c +1 -0
@@ -24,6 +24,7 @@* THE SOFTWARE. */ +#include "config-host.h" #include "vnc.h" #include "vnc-jobs.h" #include "sysemu/sysemu.h"
util/hbitmap.c +1 -0
@@ -9,6 +9,7 @@* later. See the COPYING file in the top-level directory. */ +#include "config-host.h" #include <string.h> #include <glib.h> #include <assert.h>
Signature · 1 line
1.8.2
PATCH v2 2/3 win32: add readv/writev emulation
In reply to Paolo BonziniCommit 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).
--- include/qemu-common.h | 22 ++-------------------- include/qemu/osdep.h | 16 ++++++++++++++++ util/iov.c | 2 +- util/osdep.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 21 deletions(-)
include/qemu-common.h +2 -20
@@ -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 */
include/qemu/osdep.h +16 -0
@@ -161,6 +161,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,
util/iov.c +1 -1
@@ -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 definedCONFIG_IOVEC && definedCONFIG_POSIX +#ifdef CONFIG_POSIX ssize_t ret;struct msghdr msg;memset (&msg,0 ,sizeof (msg));
util/osdep.c +42 -0
45 lines not on this page · raw message
Signature · 1 line
1.8.2
PATCH v2 3/3 win32: generate console executable again
In reply to Paolo BonziniThe -mwindows option is not anymore in LIBS at this point of the Makefile, it is only in libs_softmmu. Check the right variable.
--- Makefile.target | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile.target +1 -1
@@ -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
Signature · 1 line
1.8.2
Quoted 7 lines · Paolo Bonzini
Here is a fix for the Win32 compilation problem that Blue reported, and another nit I found while testing.
Paolo Bonzini (3):
add missing inclusions ofconfig-host.h
win32: add readv/writev emulation
win32: generate console executable again
Please rebase:
Applying: add missing inclusions of config-host.h
Applying: win32: add readv/writev emulation
error: patch failed: util/osdep.c:406
error: util/osdep.c: patch does not apply Patch failed at 0002 win32: add readv/writev emulation
Quoted 20 lines
Makefile.target | 2 +- include/qemu-common.h | 22 ++-------------------- include/qemu/osdep.h | 16 ++++++++++++++++ qga/channel-posix.c | 1 + tests/libi2c-omap.c | 1 + tests/libqtest.c | 1 + tests/tcg/test-i386-fprem.c | 1 + tests/test-mul64.c | 1 + ui/sdl_zoom.c | 1 + ui/vnc.c | 1 + util/hbitmap.c | 1 + util/iov.c | 2 +- util/osdep.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 13 files changed, 70 insertions(+), 22 deletions(-)--
1.8.2
Il 26/04/2013 21:38, Blue Swirl ha scritto:
Quoted 9 lines · Paolo Bonzini
Quoted 7 lines
Here is a fix for the Win32 compilation problem that Blue reported, and another nit I found while testing.
Paolo Bonzini (3):
add missing inclusions ofconfig-host.h
win32: add readv/writev emulation
win32: generate console executable again
Quoted 6 lines
Please rebase:
Applying: add missing inclusions ofconfig-host.h
Applying: win32: add readv/writev emulation
error: patch failed:util/osdep.c:406
error:util/osdep.c: patch does not apply Patch failed at 0002 win32: add readv/writev emulation
Ok, will fix.
Paolo