On Wed, 12 Mar 2025 at 14:24, Daniel P. Berrangé <berra...@redhat.com> wrote:
>
> On Wed, Mar 12, 2025 at 02:05:09PM +0000, Daniel P. Berrangé wrote:
> > On Wed, Mar 12, 2025 at 03:52:45PM +0200, Konstantin Kostiuk wrote:
> > > Hi All,
> > >
> > > I cross-compiled qemu-ga from current master branch
> > > (825b96dbcee23d134b691fc75618b59c5f53da32) and found strange behavior.
> > >
> > > Configure CLI:
> > > ./configure --disable-docs --disable-system --disable-user
> > > --cross-prefix=x86_64-w64-mingw32- --enable-guest-agent
> > > --disable-guest-agent-msi --disable-qga-vss
> > > Build CLI:
> > > make -j8 qemu-ga
> > >
> > > Linker wrote the following information but exited with 0 code:
> > >
> > > /usr/lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld:
> > > qga/qemu-ga.exe:/4: section below image base
> > > /usr/lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld:
> > > qga/qemu-ga.exe:/24: section below image base
> > >
> > > As a result, this binary failed to start on Windows without any details,
> > > just a message that the application is not compatible. I also tried to run
> > > it with wine and got the error:
> > >
> > > wine: failed to start
> > > L"Z:\\home\\user\\Documents\\repos\\qemu\\build\\qga\\qemu-ga.exe"
> > > Application could not be started, or no application associated with the
> > > specified file.
> > > ShellExecuteEx failed: Bad EXE format for
> > > Z:\home\user\Documents\repos\qemu\build\qga\qemu-ga.exe.
> > >
> > > I bisected the tree and found the commit that caused the problem:
> > > https://gitlab.com/qemu-project/qemu/-/commit/563b1a35ed1f1151505d4fe5f723827d1b3fd4bc
> > >
> > > Adding --disable-split-debug to the configure CLI fixes the issue.
> > >
> > > $ x86_64-w64-mingw32-gcc --version
> > > x86_64-w64-mingw32-gcc (GCC) 14.2.0
> > >
> > > My question is, is this expected behavior or is this a bug?
> >
> > Your configure args don't include "--enable-debug", so I would
> > not have expected -gsplit-dwarf to have been enabled, so I'm
> > surprised that commit casued a problem.
>
> Hmm it appears that the meson  "get_option('debug')" is entirely
> unconnected to QEMU's --enable-debug configure flag, which I did
> not realize.
>
> IOW, we've got -gsplit-dwarf enabled by default for everyone
> building QEMU, which feels dubious. IMHO only an explicit
> --enable-debug configure arg should have triggered it.
>
> In addition since its breaking Windows builds, it appears we
> need to block its usage on Windows.

Agreed, but also this seems like a bug in the Windows toolchain
here: if -gsplit-dwarf is valid for Windows then it shouldn't
produce bad executables, and if it's not valid then the compiler
should produce an error if it's provided (or ignore it, maybe).

-- PMM

Reply via email to