* [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
@ 2018-07-18 6:33 Howard Spoelstra
2018-08-17 7:32 ` David Hildenbrand
2018-08-20 15:04 ` Stefan Weil
0 siblings, 2 replies; 13+ messages in thread
From: Howard Spoelstra @ 2018-07-18 6:33 UTC (permalink / raw)
To: qemu-ppc, QEMU Developers
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
2018-07-18 6:33 [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run Howard Spoelstra
@ 2018-08-17 7:32 ` David Hildenbrand
2018-08-17 7:46 ` Howard Spoelstra
2018-08-18 19:09 ` Stefan Weil
2018-08-20 15:04 ` Stefan Weil
1 sibling, 2 replies; 13+ messages in thread
From: David Hildenbrand @ 2018-08-17 7:32 UTC (permalink / raw)
To: Howard Spoelstra, qemu-ppc, QEMU Developers, Stefan Weil
On 18.07.2018 08:33, Howard Spoelstra wrote:
> 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));
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
These two reports should be independent of general functionality
(sheepdog, migration). So what you see is most likely unrelated to this.
> 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.
This warning is just from GDB, not able to locate you sources I guess.
> (gdb) bt full
> #0 getpagesize () at util/oslib-win32.c:535
Wonder why we should get a SEGFAULT in that simple function. As
discussed offline, the functionality in general seems to work (if this
function is compiled and run independently in your environment).
But maybe this backtrace is just misleading.
> 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}
dwPageSize = 0, I assume this is some random data on the stack and
GetSystemInfo never got executed. I wonder where this segfault comes from.
> #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
>
No being a win32/mingw expert, Stefan any idea?
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
2018-08-17 7:32 ` David Hildenbrand
@ 2018-08-17 7:46 ` Howard Spoelstra
2018-08-18 19:09 ` Stefan Weil
1 sibling, 0 replies; 13+ messages in thread
From: Howard Spoelstra @ 2018-08-17 7:46 UTC (permalink / raw)
To: David Hildenbrand; +Cc: qemu-ppc, QEMU Developers, Stefan Weil
On Fri, Aug 17, 2018 at 9:32 AM, David Hildenbrand <david@redhat.com> wrote:
> On 18.07.2018 08:33, Howard Spoelstra wrote:
>> 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));
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>
> These two reports should be independent of general functionality
> (sheepdog, migration). So what you see is most likely unrelated to this.
>
>> 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.
>
> This warning is just from GDB, not able to locate you sources I guess.
>
>> (gdb) bt full
>> #0 getpagesize () at util/oslib-win32.c:535
>
> Wonder why we should get a SEGFAULT in that simple function. As
> discussed offline, the functionality in general seems to work (if this
> function is compiled and run independently in your environment).
>
> But maybe this backtrace is just misleading.
>
>> 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}
>
> dwPageSize = 0, I assume this is some random data on the stack and
> GetSystemInfo never got executed. I wonder where this segfault comes from.
>
>> #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
>>
>
> No being a win32/mingw expert, Stefan any idea?
>
> --
>
> Thanks,
>
> David / dhildenb
Thanks for taking this up. By now the fedora 29 machine has been
updated to gcc/mingw 8.2, but the issue remains.
Best,
Howard
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
2018-08-17 7:32 ` 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
1 sibling, 2 replies; 13+ messages in thread
From: Stefan Weil @ 2018-08-18 19:09 UTC (permalink / raw)
To: David Hildenbrand, Howard Spoelstra, qemu-ppc, QEMU Developers
Am 17.08.2018 um 09:32 schrieb David Hildenbrand:
> On 18.07.2018 08:33, Howard Spoelstra wrote:
>> 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));
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>
> These two reports should be independent of general functionality
> (sheepdog, migration). So what you see is most likely unrelated to this.
>
>> 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.
>
> This warning is just from GDB, not able to locate you sources I guess.
>
>> (gdb) bt full
>> #0 getpagesize () at util/oslib-win32.c:535
>
> Wonder why we should get a SEGFAULT in that simple function. As
> discussed offline, the functionality in general seems to work (if this
> function is compiled and run independently in your environment).
>
> But maybe this backtrace is just misleading.
>
>> 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}
>
> dwPageSize = 0, I assume this is some random data on the stack and
> GetSystemInfo never got executed. I wonder where this segfault comes from.
>
>> #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
>>
>
> No being a win32/mingw expert, Stefan any idea?
I'd try a debug build (configure [...] --enable-debug).
My installers (https://qemu.weilnetz.de/w64/) were built with
x86_64-w64-mingw32-gcc (GCC) 6.3.0 20170516 (from Debian Stretch).
Howard, perhaps you can try whether they show the same runtime SIGSEGV.
When I run your command line with a dummy disk image, OpenBIOS boots fine.
Kind regards,
Stefan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
2018-08-18 19:09 ` Stefan Weil
@ 2018-08-18 19:45 ` Philippe Mathieu-Daudé
2018-08-18 20:51 ` Howard Spoelstra
1 sibling, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-08-18 19:45 UTC (permalink / raw)
To: Stefan Weil, David Hildenbrand, Howard Spoelstra, qemu-ppc,
QEMU Developers
Hi,
On 08/18/2018 04:09 PM, Stefan Weil wrote:
> Am 17.08.2018 um 09:32 schrieb David Hildenbrand:
>> On 18.07.2018 08:33, Howard Spoelstra wrote:
>>> 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.
I proposed patches replacing strncpy() by g_strlcpy() ...
>>>
>>> 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);
>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... this one here ...:
http://lists.nongnu.org/archive/html/qemu-devel/2018-08/msg03705.html
>>> 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));
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... and this other one here:
http://lists.nongnu.org/archive/html/qemu-devel/2018-08/msg03706.html
>>
>> These two reports should be independent of general functionality
>> (sheepdog, migration). So what you see is most likely unrelated to this.
>>
>>> 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.
>>
>> This warning is just from GDB, not able to locate you sources I guess.
>>
>>> (gdb) bt full
>>> #0 getpagesize () at util/oslib-win32.c:535
>>
>> Wonder why we should get a SEGFAULT in that simple function. As
>> discussed offline, the functionality in general seems to work (if this
>> function is compiled and run independently in your environment).
>>
>> But maybe this backtrace is just misleading.
>>
>>> 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}
>>
>> dwPageSize = 0, I assume this is some random data on the stack and
>> GetSystemInfo never got executed. I wonder where this segfault comes from.
>>
>>> #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
>>>
>>
>> No being a win32/mingw expert, Stefan any idea?
>
>
> I'd try a debug build (configure [...] --enable-debug).
>
> My installers (https://qemu.weilnetz.de/w64/) were built with
> x86_64-w64-mingw32-gcc (GCC) 6.3.0 20170516 (from Debian Stretch).
> Howard, perhaps you can try whether they show the same runtime SIGSEGV.
> When I run your command line with a dummy disk image, OpenBIOS boots fine.
>
> Kind regards,
> Stefan
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
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
1 sibling, 2 replies; 13+ messages in thread
From: Howard Spoelstra @ 2018-08-18 20:51 UTC (permalink / raw)
To: Stefan Weil; +Cc: David Hildenbrand, qemu-ppc, QEMU Developers
On Sat, Aug 18, 2018 at 9:09 PM, Stefan Weil <sw@weilnetz.de> wrote:
> Am 17.08.2018 um 09:32 schrieb David Hildenbrand:
>> On 18.07.2018 08:33, Howard Spoelstra wrote:
>>> 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));
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>
>> These two reports should be independent of general functionality
>> (sheepdog, migration). So what you see is most likely unrelated to this.
>>
>>> 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.
>>
>> This warning is just from GDB, not able to locate you sources I guess.
>>
>>> (gdb) bt full
>>> #0 getpagesize () at util/oslib-win32.c:535
>>
>> Wonder why we should get a SEGFAULT in that simple function. As
>> discussed offline, the functionality in general seems to work (if this
>> function is compiled and run independently in your environment).
>>
>> But maybe this backtrace is just misleading.
>>
>>> 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}
>>
>> dwPageSize = 0, I assume this is some random data on the stack and
>> GetSystemInfo never got executed. I wonder where this segfault comes from.
>>
>>> #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
>>>
>>
>> No being a win32/mingw expert, Stefan any idea?
>
>
> I'd try a debug build (configure [...] --enable-debug).
>
> My installers (https://qemu.weilnetz.de/w64/) were built with
> x86_64-w64-mingw32-gcc (GCC) 6.3.0 20170516 (from Debian Stretch).
> Howard, perhaps you can try whether they show the same runtime SIGSEGV.
> When I run your command line with a dummy disk image, OpenBIOS boots fine.
>
> Kind regards,
> Stefan
The error I reported already came from a debug build.
Other builds with less recent mingw (7.3 in Fedora 28) do not SIGSEGV,
neither do Stefan's.
I can confirm the strncpy warnings are gone using Philippe's patches.
Best,
Howard
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
2018-08-18 20:51 ` Howard Spoelstra
@ 2018-08-18 22:51 ` Ben Pye
2018-08-19 8:49 ` Stefan Weil
1 sibling, 0 replies; 13+ messages in thread
From: Ben Pye @ 2018-08-18 22:51 UTC (permalink / raw)
To: qemu-devel, Howard Spoelstra, Stefan Weil; +Cc: qemu-ppc, David Hildenbrand
I'm also seeing this behaviour using the MSYS2 packaged mingw64 compiler, GCC 8.2. I have managed to cross compile QEMU successfully under Fedora 28 however and the resulting binary works. Certainly seems like a tool chain issue, unfortunately MSYS2 doesn't package any older versions of GCC.
Ben.
On 18 August 2018 21:51:35 BST, Howard Spoelstra <hsp.cat7@gmail.com> wrote:
>On Sat, Aug 18, 2018 at 9:09 PM, Stefan Weil <sw@weilnetz.de> wrote:
>> Am 17.08.2018 um 09:32 schrieb David Hildenbrand:
>>> On 18.07.2018 08:33, Howard Spoelstra wrote:
>>>> 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));
>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>
>>>
>>> These two reports should be independent of general functionality
>>> (sheepdog, migration). So what you see is most likely unrelated to
>this.
>>>
>>>> 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.
>>>
>>> This warning is just from GDB, not able to locate you sources I
>guess.
>>>
>>>> (gdb) bt full
>>>> #0 getpagesize () at util/oslib-win32.c:535
>>>
>>> Wonder why we should get a SEGFAULT in that simple function. As
>>> discussed offline, the functionality in general seems to work (if
>this
>>> function is compiled and run independently in your environment).
>>>
>>> But maybe this backtrace is just misleading.
>>>
>>>> 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}
>>>
>>> dwPageSize = 0, I assume this is some random data on the stack and
>>> GetSystemInfo never got executed. I wonder where this segfault comes
>from.
>>>
>>>> #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
>>>>
>>>
>>> No being a win32/mingw expert, Stefan any idea?
>>
>>
>> I'd try a debug build (configure [...] --enable-debug).
>>
>> My installers (https://qemu.weilnetz.de/w64/) were built with
>> x86_64-w64-mingw32-gcc (GCC) 6.3.0 20170516 (from Debian Stretch).
>> Howard, perhaps you can try whether they show the same runtime
>SIGSEGV.
>> When I run your command line with a dummy disk image, OpenBIOS boots
>fine.
>>
>> Kind regards,
>> Stefan
>
>The error I reported already came from a debug build.
>Other builds with less recent mingw (7.3 in Fedora 28) do not SIGSEGV,
>neither do Stefan's.
>I can confirm the strncpy warnings are gone using Philippe's patches.
>
>Best,
>Howard
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
2018-08-18 20:51 ` Howard Spoelstra
2018-08-18 22:51 ` Ben Pye
@ 2018-08-19 8:49 ` Stefan Weil
1 sibling, 0 replies; 13+ messages in thread
From: Stefan Weil @ 2018-08-19 8:49 UTC (permalink / raw)
To: Howard Spoelstra; +Cc: David Hildenbrand, qemu-ppc, QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 1832 bytes --]
Am 18.08.2018 um 22:51 schrieb Howard Spoelstra:
> On Sat, Aug 18, 2018 at 9:09 PM, Stefan Weil <sw@weilnetz.de> wrote:
>> Am 17.08.2018 um 09:32 schrieb David Hildenbrand:
>>> No being a win32/mingw expert, Stefan any idea?
>>
>>
>> I'd try a debug build (configure [...] --enable-debug).
>>
>> My installers (https://qemu.weilnetz.de/w64/) were built with
>> x86_64-w64-mingw32-gcc (GCC) 6.3.0 20170516 (from Debian Stretch).
>> Howard, perhaps you can try whether they show the same runtime SIGSEGV.
>> When I run your command line with a dummy disk image, OpenBIOS boots fine.
>>
>> Kind regards,
>> Stefan
>
> The error I reported already came from a debug build.
> Other builds with less recent mingw (7.3 in Fedora 28) do not SIGSEGV,
> neither do Stefan's.
> I can confirm the strncpy warnings are gone using Philippe's patches.
>
> Best,
> Howard
I can now reproduce the runtime problem (although I get a different error):
Debian experimental provides x86_64-w64-mingw32-gcc (GCC) 8.2-win32
20180726. I now used that compiler for my build. In addition to the
compiler errors reported by Howard, I also get similar errors for
hw/acpi/core.c and hw/acpi/aml-build.c.
The resulting binary starts running OpenBIOS, but then it fails (tested
with wine):
./configure --cross-prefix=x86_64-w64-mingw32- && make
dd if=/dev/zero of=9.2.qcow2 bs=1M count=32
wine ppc-softmmu/qemu-system-ppc.exe -L 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 9.2.qcow2 -netdev "user,id=network01"
-device "sungem,netdev=network01" -d int
*** stack smashing detected ***: terminated
wine: Unhandled illegal instruction at address 0x68ac2fe0 (thread 002c),
QEMU for Linux with gcc 8.2 works fine.
Stefan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
2018-07-18 6:33 [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run Howard Spoelstra
2018-08-17 7:32 ` David Hildenbrand
@ 2018-08-20 15:04 ` Stefan Weil
2018-08-20 19:41 ` Stefan Weil
1 sibling, 1 reply; 13+ messages in thread
From: Stefan Weil @ 2018-08-20 15:04 UTC (permalink / raw)
To: Howard Spoelstra, qemu-ppc, QEMU Developers
Am 18.07.2018 um 08:33 schrieb Howard Spoelstra:
[...]> 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.
It looks like all functions with local variables crash when they are
called from a global constructor (__do_global_ctors). Such functions
contain this opcode near the function start:
mov %fs:0x0,%rax
Maybe %fs has an illegal value (see example below, called from rcu_init).
Replacing the local variable by a static one avoids the problem, but
would have to be done for any function which is called from a global
constructor (I stopped after I had changed some of them).
Stefan
(gdb) disas
Dump of assembler code for function _nocheck__trace_qemu_mutex_lock:
0x00000000009896e5 <+0>: push %rbp
0x00000000009896e6 <+1>: push %rsi
0x00000000009896e7 <+2>: push %rbx
0x00000000009896e8 <+3>: mov %rsp,%rbp
0x00000000009896eb <+6>: sub $0x60,%rsp
0x00000000009896ef <+10>: mov %rcx,-0x18(%rbp)
0x00000000009896f3 <+14>: mov %rdx,-0x20(%rbp)
0x00000000009896f7 <+18>: mov %r8d,0x30(%rbp)
=> 0x00000000009896fb <+22>: mov %fs:0x0,%rax
0x0000000000989704 <+31>: mov %rax,-0x8(%rbp)
(gdb) i reg
rax 0xe633a0 15086496
rbx 0xa85120 11030816
rcx 0x10fabd0 17804240
rdx 0xe633a0 15086496
rsi 0xa83de0 11025888
rdi 0x5536c10 89353232
rbp 0x22fcc0 0x22fcc0
rsp 0x22fc60 0x22fc60
r8 0x12e 302
r9 0x5538e18 89361944
r10 0x21 33
r11 0x21 33
r12 0xc0 192
r13 0xb8 184
r14 0x0 0
r15 0x0 0
rip 0x9896fb 0x9896fb <_nocheck__trace_qemu_mutex_lock+22>
eflags 0x10206 [ PF IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x2b 43
es 0x2b 43
fs 0x53 83
gs 0x2b 43
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
2018-08-20 15:04 ` Stefan Weil
@ 2018-08-20 19:41 ` Stefan Weil
2018-08-20 19:47 ` Stefan Weil
0 siblings, 1 reply; 13+ messages in thread
From: Stefan Weil @ 2018-08-20 19:41 UTC (permalink / raw)
To: Howard Spoelstra, qemu-ppc, QEMU Developers, David Hildenbrand,
Philippe Mathieu-Daudé,
Ben Pye
> Am 18.07.2018 um 08:33 schrieb Howard Spoelstra:
> [...]> 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.
That's a problem triggered by gcc 8 for Mingw-w64 with compiler options
-fstack-protector-all and -fstack-protector-strong. With any of those
options this simple test program also fails with SIGSEGV:
#include <windows.h>
int main(void) {
SYSTEM_INFO system_info;
GetSystemInfo(&system_info);
return system_info.dwPageSize;
}
With configure option --disable-stack-protector, the resulting binary
should work.
Regards
Stefan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
2018-08-20 19:41 ` Stefan Weil
@ 2018-08-20 19:47 ` Stefan Weil
2018-08-20 20:39 ` Howard Spoelstra
0 siblings, 1 reply; 13+ messages in thread
From: Stefan Weil @ 2018-08-20 19:47 UTC (permalink / raw)
To: Howard Spoelstra, qemu-ppc, QEMU Developers, David Hildenbrand,
Philippe Mathieu-Daudé,
Ben Pye
Am 20.08.2018 um 21:41 schrieb Stefan Weil:
> That's a problem triggered by gcc 8 for Mingw-w64 with compiler options
> -fstack-protector-all and -fstack-protector-strong. With any of those
> options this simple test program also fails with SIGSEGV:
>
> #include <windows.h>
> int main(void) {
> SYSTEM_INFO system_info;
> GetSystemInfo(&system_info);
> return system_info.dwPageSize;
> }
>
> With configure option --disable-stack-protector, the resulting binary
> should work.
I could confirm that now. The following build works for me:
./configure --cross-prefix=x86_64-w64-mingw32- --enable-debug \
--disable-stack-protector --target-list=ppc-softmmu && make
Stefan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
2018-08-20 19:47 ` Stefan Weil
@ 2018-08-20 20:39 ` Howard Spoelstra
2018-08-21 5:29 ` Stefan Weil
0 siblings, 1 reply; 13+ messages in thread
From: Howard Spoelstra @ 2018-08-20 20:39 UTC (permalink / raw)
To: Stefan Weil
Cc: qemu-ppc, QEMU Developers, David Hildenbrand,
Philippe Mathieu-Daudé,
Ben Pye
On Mon, Aug 20, 2018 at 9:47 PM, Stefan Weil <sw@weilnetz.de> wrote:
> Am 20.08.2018 um 21:41 schrieb Stefan Weil:
>> That's a problem triggered by gcc 8 for Mingw-w64 with compiler options
>> -fstack-protector-all and -fstack-protector-strong. With any of those
>> options this simple test program also fails with SIGSEGV:
>>
>> #include <windows.h>
>> int main(void) {
>> SYSTEM_INFO system_info;
>> GetSystemInfo(&system_info);
>> return system_info.dwPageSize;
>> }
>>
>> With configure option --disable-stack-protector, the resulting binary
>> should work.
>
>
> I could confirm that now. The following build works for me:
>
> ./configure --cross-prefix=x86_64-w64-mingw32- --enable-debug \
> --disable-stack-protector --target-list=ppc-softmmu && make
>
> Stefan
Confirmed, adding --disable-stack-protector to configure results in a
working binary.
Great, thanks,
Howard
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run
2018-08-20 20:39 ` Howard Spoelstra
@ 2018-08-21 5:29 ` Stefan Weil
0 siblings, 0 replies; 13+ messages in thread
From: Stefan Weil @ 2018-08-21 5:29 UTC (permalink / raw)
To: Howard Spoelstra
Cc: qemu-ppc, QEMU Developers, David Hildenbrand,
Philippe Mathieu-Daudé,
Ben Pye
Am 20.08.2018 um 22:39 schrieb Howard Spoelstra:
> Confirmed, adding --disable-stack-protector to configure results in a
> working binary.
>
> Great, thanks,
> Howard
There is already a bug report for gcc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86832
It looks like not only Windows but also MacOS is affected.
Cheers
Stefan
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2018-08-21 5:40 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-18 6:33 [Qemu-devel] Bugs when cross-compiling qemu for Windows with mingw 8.1, executable doesn't run Howard Spoelstra
2018-08-17 7:32 ` 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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.