From: Howard Spoelstra <hsp.cat7@gmail.com>
To: qemu-ppc <qemu-ppc@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
Date: Wed, 18 Jul 2018 08:33:31 +0200 [thread overview]
Message-ID: <CABLmASE2HTZPBVFM=grds+9RmPyh2naJ2KwNjb81LD0+E+yrtA@mail.gmail.com> (raw)
Hi all,
I have two issues when cross compiling current master for Windows with
mingw 8.1. Host is Fedora29. See further below for gcc and mingw
versions.
Reproduce with:
./configure --cross-prefix=x86_64-w64-mingw32-
--target-list="ppc-softmmu" --enable-gtk --with-gtkabi=3.0
--enable-sdl --with-sdlabi=2.0
Issue 1: Two bugs show up during compilation related to strncpy.
Replacing the offenders with memcpy seems to fix this.
First time:
block/sheepdog.c: In function 'find_vdi_name':
block/sheepdog.c:1239:5: error: 'strncpy' specified bound 256 equals
destination size [-Werror=stringop-truncation]
strncpy(buf + SD_MAX_VDI_LEN, tag, SD_MAX_VDI_TAG_LEN);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Second time:
migration/global_state.c: In function 'global_state_store_running':
migration/global_state.c:45:5: error: 'strncpy' specified bound 100
equals destination size [-Werror=stringop-truncation]
strncpy((char *)global_state.runstate,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
state, sizeof(global_state.runstate));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Issue 2: once strncpy has been replaced with memcpy in these two
instances, I can successfully compile, but the executable doesn't run
in Windows.
I tried to debug, and this is what gdb told me:
(gdb) run
Starting program: c:\qemu-fedora29beta\qemu-system-ppc-debug.exe -L
c:\qemu-fedora29beta\pc-bios -boot c -m 256 -M "mac99,via=pmu"
-prom-env "boot-args=-v" -prom-env "auto-boot?=true" -prom-env
"vga-ndrv?=true" -hda c:\Mac-disks\9.2.qcow2 -netdev
"user,id=network01" -device "sungem,netdev=network01" -sdl -d int
[New Thread 948.0x6d8]
[New Thread 948.0x2778]
[New Thread 948.0x286c]
[New Thread 948.0x3d0]
Program received signal SIGSEGV, Segmentation fault.
getpagesize () at util/oslib-win32.c:535
535 util/oslib-win32.c: No such file or directory.
(gdb) bt full
#0 getpagesize () at util/oslib-win32.c:535
system_info = {{dwOemId = 56491488, {wProcessorArchitecture =
64992, wReserved = 861}}, dwPageSize = 0,
lpMinimumApplicationAddress = 0x99cca4
<register_module_init+60>, lpMaximumApplicationAddress = 0x3,
dwActiveProcessorMask = 11102192, dwNumberOfProcessors =
56584576, dwProcessorType = 0,
dwAllocationGranularity = 200, wProcessorLevel = 0,
wProcessorRevision = 0}
#1 0x00000000009b7fcd in init_real_host_page_size () at util/pagesize.c:16
No locals.
#2 0x00000000009bc5f2 in __do_global_ctors ()
No symbol table info available.
#3 0x00000000004013ca in __tmainCRTStartup () at ../crt/crtexe.c:324
lock_free = <optimized out>
fiberid = <optimized out>
nested = <optimized out>
lpszCommandLine = <optimized out>
StartupInfo = {cb = 104, lpReserved = 0x3778e00 "", lpDesktop
= 0x377f440 "Winsta0\\Default",
lpTitle = 0x3786280
"c:\\qemu-fedora29beta\\qemu-system-ppc-debug.exe", dwX = 0, dwY = 0,
dwXSize = 0,
dwYSize = 0, dwXCountChars = 0, dwYCountChars = 0,
dwFillAttribute = 0, dwFlags = 0, wShowWindow = 0,
cbReserved2 = 0, lpReserved2 = 0x0, hStdInput =
0xffffffffffffffff, hStdOutput = 0xffffffffffffffff,
hStdError = 0xffffffffffffffff}
inDoubleQuote = <optimized out>
#4 0x00000000004014fb in WinMainCRTStartup () at ../crt/crtexe.c:184
ret = 255
(gdb)
Gcc and mingw versions used:
[hsp@localhost qemu-master]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-gcc-major-version-only
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--with-isl --enable-libmpx --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.1.1 20180626 (Red Hat 8.1.1-4) (GCC)
[hsp@localhost qemu-master]$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../configure --prefix=/usr --bindir=/usr/bin
--includedir=/usr/include --mandir=/usr/share/man
--infodir=/usr/share/info --datadir=/usr/share
--build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu
--with-gnu-as --with-gnu-ld --verbose --without-newlib
--disable-multilib --disable-plugin --with-system-zlib --disable-nls
--without-included-gettext --disable-win32-registry
--enable-languages=c,c++,objc,obj-c++,fortran
--with-bugurl=http://bugzilla.redhat.com/bugzilla --with-cloog
--enable-threads=posix --enable-libgomp --target=x86_64-w64-mingw32
--with-sysroot=/usr/x86_64-w64-mingw32/sys-root
--with-gxx-include-dir=/usr/x86_64-w64-mingw32/sys-root/mingw/include/c++
Thread model: posix
gcc version 8.1.0 20180502 (Fedora MinGW 8.1.0-1.fc29) (GCC)
Thanks for looking into this,
Best,
Howard
next reply other threads:[~2018-07-18 6:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 6:33 Howard Spoelstra [this message]
2018-08-17 7:32 ` [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run David Hildenbrand
2018-08-17 7:46 ` Howard Spoelstra
2018-08-18 19:09 ` Stefan Weil
2018-08-18 19:45 ` Philippe Mathieu-Daudé
2018-08-18 20:51 ` Howard Spoelstra
2018-08-18 22:51 ` Ben Pye
2018-08-19 8:49 ` Stefan Weil
2018-08-20 15:04 ` Stefan Weil
2018-08-20 19:41 ` Stefan Weil
2018-08-20 19:47 ` Stefan Weil
2018-08-20 20:39 ` Howard Spoelstra
2018-08-21 5:29 ` Stefan Weil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABLmASE2HTZPBVFM=grds+9RmPyh2naJ2KwNjb81LD0+E+yrtA@mail.gmail.com' \
--to=hsp.cat7@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).