qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Cross-compilation artifact is broken
@ 2025-03-12 13:52 Konstantin Kostiuk
  2025-03-12 14:05 ` Daniel P. Berrangé
  0 siblings, 1 reply; 11+ messages in thread
From: Konstantin Kostiuk @ 2025-03-12 13:52 UTC (permalink / raw)
  To: QEMU, Alex Bennée, Daniel Berrangé, Paolo Bonzini
  Cc: Yan Vugenfirer

[-- Attachment #1: Type: text/plain, Size: 1495 bytes --]

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?

Best Regards,
Konstantin Kostiuk.

[-- Attachment #2: Type: text/html, Size: 2088 bytes --]

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

* Re: Cross-compilation artifact is broken
  2025-03-12 13:52 Cross-compilation artifact is broken Konstantin Kostiuk
@ 2025-03-12 14:05 ` Daniel P. Berrangé
  2025-03-12 14:10   ` Konstantin Kostiuk
  2025-03-12 14:23   ` Daniel P. Berrangé
  0 siblings, 2 replies; 11+ messages in thread
From: Daniel P. Berrangé @ 2025-03-12 14:05 UTC (permalink / raw)
  To: Konstantin Kostiuk; +Cc: QEMU, Alex Bennée, Paolo Bonzini, Yan Vugenfirer

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.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: Cross-compilation artifact is broken
  2025-03-12 14:05 ` Daniel P. Berrangé
@ 2025-03-12 14:10   ` Konstantin Kostiuk
  2025-03-12 14:23   ` Daniel P. Berrangé
  1 sibling, 0 replies; 11+ messages in thread
From: Konstantin Kostiuk @ 2025-03-12 14:10 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: QEMU, Alex Bennée, Paolo Bonzini, Yan Vugenfirer

[-- Attachment #1: Type: text/plain, Size: 2789 bytes --]

I can provide the full log, but I see on GitLab CI the same results
https://gitlab.com/qemu-project/qemu/-/jobs/9368756844

[3417/3430] Linking target tests/qtest/fuzz-e1000e-test.exe
/usr/lib/gcc/x86_64-w64-mingw32/14.1.1/../../../../x86_64-w64-mingw32/bin/ld:
tests/qtest/fuzz-e1000e-test.exe:/4: section below image base
/usr/lib/gcc/x86_64-w64-mingw32/14.1.1/../../../../x86_64-w64-mingw32/bin/ld:
tests/qtest/fuzz-e1000e-test.exe:/24: section below image base

Best Regards,
Konstantin Kostiuk.


On Wed, Mar 12, 2025 at 4:05 PM Daniel P. Berrangé <berrange@redhat.com>
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.
>
>
> With regards,
> Daniel
> --
> |: https://berrange.com      -o-
> https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-
> https://www.instagram.com/dberrange :|
>
>

[-- Attachment #2: Type: text/html, Size: 4794 bytes --]

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

* Re: Cross-compilation artifact is broken
  2025-03-12 14:05 ` Daniel P. Berrangé
  2025-03-12 14:10   ` Konstantin Kostiuk
@ 2025-03-12 14:23   ` Daniel P. Berrangé
  2025-03-12 14:47     ` Peter Maydell
                       ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: Daniel P. Berrangé @ 2025-03-12 14:23 UTC (permalink / raw)
  To: Konstantin Kostiuk, QEMU, Alex Bennée, Paolo Bonzini,
	Yan Vugenfirer

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.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: Cross-compilation artifact is broken
  2025-03-12 14:23   ` Daniel P. Berrangé
@ 2025-03-12 14:47     ` Peter Maydell
  2025-03-12 14:55       ` Daniel P. Berrangé
  2025-03-12 16:23     ` Alex Bennée
  2025-03-14 14:21     ` Paolo Bonzini
  2 siblings, 1 reply; 11+ messages in thread
From: Peter Maydell @ 2025-03-12 14:47 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Konstantin Kostiuk, QEMU, Alex Bennée, Paolo Bonzini,
	Yan Vugenfirer

On Wed, 12 Mar 2025 at 14:24, Daniel P. Berrangé <berrange@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


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

* Re: Cross-compilation artifact is broken
  2025-03-12 14:47     ` Peter Maydell
@ 2025-03-12 14:55       ` Daniel P. Berrangé
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel P. Berrangé @ 2025-03-12 14:55 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Konstantin Kostiuk, QEMU, Alex Bennée, Paolo Bonzini,
	Yan Vugenfirer

On Wed, Mar 12, 2025 at 02:47:16PM +0000, Peter Maydell wrote:
> On Wed, 12 Mar 2025 at 14:24, Daniel P. Berrangé <berrange@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).

It works for a simple "helloworld.exe" file so is not completely  busted
on Windows. I'm unclear what we do that makes it unhappy in our case....

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: Cross-compilation artifact is broken
  2025-03-12 14:23   ` Daniel P. Berrangé
  2025-03-12 14:47     ` Peter Maydell
@ 2025-03-12 16:23     ` Alex Bennée
  2025-03-14  8:21       ` Konstantin Kostiuk
  2025-03-14 14:21     ` Paolo Bonzini
  2 siblings, 1 reply; 11+ messages in thread
From: Alex Bennée @ 2025-03-12 16:23 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Konstantin Kostiuk, QEMU, Paolo Bonzini, Yan Vugenfirer

Daniel P. Berrangé <berrange@redhat.com> writes:

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

--enable-debug is more than debug info, --enable-debug-info is enabled
by default. If you build with --disable-debug-info then -gsplit-dwarf
won't be applied.

>
> In addition since its breaking Windows builds, it appears we
> need to block its usage on Windows.
>
>
> With regards,
> Daniel

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


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

* Re: Cross-compilation artifact is broken
  2025-03-12 16:23     ` Alex Bennée
@ 2025-03-14  8:21       ` Konstantin Kostiuk
  2025-03-14 10:18         ` Alex Bennée
  0 siblings, 1 reply; 11+ messages in thread
From: Konstantin Kostiuk @ 2025-03-14  8:21 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Daniel P. Berrangé, QEMU, Paolo Bonzini, Yan Vugenfirer

[-- Attachment #1: Type: text/plain, Size: 3121 bytes --]

On Wed, Mar 12, 2025 at 6:24 PM Alex Bennée <alex.bennee@linaro.org> wrote:

> Daniel P. Berrangé <berrange@redhat.com> writes:
>
> > 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.
>
> --enable-debug is more than debug info, --enable-debug-info is enabled
> by default. If you build with --disable-debug-info then -gsplit-dwarf
> won't be applied.
>
>
But as this broke the Windows build, maybe we should disable this for
Windows
until resolve this problem


> >
> > In addition since its breaking Windows builds, it appears we
> > need to block its usage on Windows.
> >
> >
> > With regards,
> > Daniel
>
> --
> Alex Bennée
> Virtualisation Tech Lead @ Linaro
>
>

[-- Attachment #2: Type: text/html, Size: 4478 bytes --]

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

* Re: Cross-compilation artifact is broken
  2025-03-14  8:21       ` Konstantin Kostiuk
@ 2025-03-14 10:18         ` Alex Bennée
  0 siblings, 0 replies; 11+ messages in thread
From: Alex Bennée @ 2025-03-14 10:18 UTC (permalink / raw)
  To: Konstantin Kostiuk
  Cc: Daniel P. Berrangé, QEMU, Paolo Bonzini, Yan Vugenfirer

Konstantin Kostiuk <kkostiuk@redhat.com> writes:

> On Wed, Mar 12, 2025 at 6:24 PM Alex Bennée <alex.bennee@linaro.org> wrote:
>
>  Daniel P. Berrangé <berrange@redhat.com> writes:
>
>  > 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.
>  >> > 
<snip>
>  >> > 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.
>
>  --enable-debug is more than debug info, --enable-debug-info is enabled
>  by default. If you build with --disable-debug-info then -gsplit-dwarf
>  won't be applied.
>
> But as this broke the Windows build, maybe we should disable this for Windows
> until resolve this problem

Something like:

if host_os != 'windows'
  if get_option('debug') and get_option('split_debug')
    qemu_cflags += '-gsplit-dwarf'
  endif
endif

>  
>  >
>  > In addition since its breaking Windows builds, it appears we
>  > need to block its usage on Windows.
>  >
>  >
>  > With regards,
>  > Daniel
>
>  -- 
>  Alex Bennée
>  Virtualisation Tech Lead @ Linaro

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


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

* Re: Cross-compilation artifact is broken
  2025-03-12 14:23   ` Daniel P. Berrangé
  2025-03-12 14:47     ` Peter Maydell
  2025-03-12 16:23     ` Alex Bennée
@ 2025-03-14 14:21     ` Paolo Bonzini
  2025-03-14 14:25       ` Daniel P. Berrangé
  2 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2025-03-14 14:21 UTC (permalink / raw)
  To: Daniel P. Berrangé, Konstantin Kostiuk, QEMU,
	Alex Bennée, Yan Vugenfirer

On 3/12/25 15:23, Daniel P. Berrangé wrote:
>>> 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.

Indeed get_option('debug') is connected to --enable-debug-info (which is
default-enabled).

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

I didn't realize that you meant to attach it to --enable-debug.  The
reason why meson.build checks get_option('debug') is simply because
-gsplit-dwarf implies turning on debug info.

Maybe it could use something like

diff --git a/configure b/configure
index 5d19d0036a1..18fd82a187e 100755
--- a/configure
+++ b/configure
@@ -1873,6 +1873,10 @@ if test "$skip_meson" = no; then
        { test "$host_os" = linux || test "$host_os" = "windows"; }; then
        echo 'werror = true' >> $cross
    fi
+  if test -e "$source_path/.git" && test "$host_os" != "windows"; then
+      echo 'split_debug = true' >> $cross
+  fi
+
    echo "[project options]" >> $cross
    if test "$SMBD" != ''; then
      echo "smbd = $(meson_quote "$SMBD")" >> $cross
diff --git a/meson_options.txt b/meson_options.txt
index 809d0b42ef7..751dc39d22f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -360,7 +360,7 @@ option('debug_mutex', type: 'boolean', value: false,
         description: 'mutex debugging support')
  option('debug_stack_usage', type: 'boolean', value: false,
         description: 'measure coroutine stack usage')
-option('split_debug', type: 'boolean', value: true,
+option('split_debug', type: 'boolean', value: false,
         description: 'split debug info from object files')
  option('qom_cast_debug', type: 'boolean', value: true,
         description: 'cast debugging support')

similar to --enable-werror... by the way I'm not sure if checking
for .git still works - I think recent RPM creates a fake git repo
to be able to run "git am", does it get rid of the .git directory
before starting the build?

> In addition since its breaking Windows builds, it appears we
> need to block its usage on Windows.

Yes, that's needed.

Paolo



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

* Re: Cross-compilation artifact is broken
  2025-03-14 14:21     ` Paolo Bonzini
@ 2025-03-14 14:25       ` Daniel P. Berrangé
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel P. Berrangé @ 2025-03-14 14:25 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Konstantin Kostiuk, QEMU, Alex Bennée, Yan Vugenfirer

On Fri, Mar 14, 2025 at 03:21:49PM +0100, Paolo Bonzini wrote:
> On 3/12/25 15:23, Daniel P. Berrangé wrote:
> > > > 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.
> 
> Indeed get_option('debug') is connected to --enable-debug-info (which is
> default-enabled).
> 
> > 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.
> 
> I didn't realize that you meant to attach it to --enable-debug.  The
> reason why meson.build checks get_option('debug') is simply because
> -gsplit-dwarf implies turning on debug info.
> 
> Maybe it could use something like
> 
> diff --git a/configure b/configure
> index 5d19d0036a1..18fd82a187e 100755
> --- a/configure
> +++ b/configure
> @@ -1873,6 +1873,10 @@ if test "$skip_meson" = no; then
>        { test "$host_os" = linux || test "$host_os" = "windows"; }; then
>        echo 'werror = true' >> $cross
>    fi
> +  if test -e "$source_path/.git" && test "$host_os" != "windows"; then
> +      echo 'split_debug = true' >> $cross
> +  fi
> +
>    echo "[project options]" >> $cross
>    if test "$SMBD" != ''; then
>      echo "smbd = $(meson_quote "$SMBD")" >> $cross
> diff --git a/meson_options.txt b/meson_options.txt
> index 809d0b42ef7..751dc39d22f 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -360,7 +360,7 @@ option('debug_mutex', type: 'boolean', value: false,
>         description: 'mutex debugging support')
>  option('debug_stack_usage', type: 'boolean', value: false,
>         description: 'measure coroutine stack usage')
> -option('split_debug', type: 'boolean', value: true,
> +option('split_debug', type: 'boolean', value: false,
>         description: 'split debug info from object files')
>  option('qom_cast_debug', type: 'boolean', value: true,
>         description: 'cast debugging support')
> 
> similar to --enable-werror... by the way I'm not sure if checking
> for .git still works - I think recent RPM creates a fake git repo
> to be able to run "git am", does it get rid of the .git directory
> before starting the build?

The .git dir will always exist in the RPM build, but generally we pass
--disable-XXX for everything and then turn back on what we want.



With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

end of thread, other threads:[~2025-03-14 14:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-12 13:52 Cross-compilation artifact is broken Konstantin Kostiuk
2025-03-12 14:05 ` Daniel P. Berrangé
2025-03-12 14:10   ` Konstantin Kostiuk
2025-03-12 14:23   ` Daniel P. Berrangé
2025-03-12 14:47     ` Peter Maydell
2025-03-12 14:55       ` Daniel P. Berrangé
2025-03-12 16:23     ` Alex Bennée
2025-03-14  8:21       ` Konstantin Kostiuk
2025-03-14 10:18         ` Alex Bennée
2025-03-14 14:21     ` Paolo Bonzini
2025-03-14 14:25       ` Daniel P. Berrangé

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