diff mbox series

configure: disable split_debug on Windows and on non-git builds

Message ID 20250314153824.65303-1-pbonzini@redhat.com (mailing list archive)
State New
Headers show
Series configure: disable split_debug on Windows and on non-git builds | expand

Commit Message

Paolo Bonzini March 14, 2025, 3:38 p.m. UTC
-gsplit-dwarf is reported to produce broken binaries on Windows.
The linker produces warnings but exits successfully:

/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

and as a result qemu-ga.exe fails to start.

On top of this, also disable -gsplit-dwarf unless building from git.
Similar to -Werror, split debug info is probably not the best choice
for people that want to build for installing.

(Random thoughts: there is a tension here between adding an option
that is useful for QEMU developers, and messing things up for everyone
else by doing something decidedly non-standard.  For example, distros
are starting to create a fake git repository just so that they can
use "git am" to apply patches; while some of them, for example Fedora,
are wise, or paranoid, enough to pass --disable-XXX for everything and
then turn back on what they want, it cannot be expected that everyone
does this.  It may be safer to make --enable-split-debug default off
for everybody and add it somewhere in docs/.  For now I am keeping it
enabled but we could consider doing something different during the hard
freeze period).

Reported-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 4 ++++
 meson_options.txt | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Peter Maydell March 14, 2025, 4:44 p.m. UTC | #1
On Fri, 14 Mar 2025 at 15:39, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> -gsplit-dwarf is reported to produce broken binaries on Windows.
> The linker produces warnings but exits successfully:
>
> /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
>
> and as a result qemu-ga.exe fails to start.
>
> On top of this, also disable -gsplit-dwarf unless building from git.
> Similar to -Werror, split debug info is probably not the best choice
> for people that want to build for installing.
>
> (Random thoughts: there is a tension here between adding an option
> that is useful for QEMU developers, and messing things up for everyone
> else by doing something decidedly non-standard.  For example, distros
> are starting to create a fake git repository just so that they can
> use "git am" to apply patches; while some of them, for example Fedora,
> are wise, or paranoid, enough to pass --disable-XXX for everything and
> then turn back on what they want, it cannot be expected that everyone
> does this.  It may be safer to make --enable-split-debug default off
> for everybody and add it somewhere in docs/.  For now I am keeping it
> enabled but we could consider doing something different during the hard
> freeze period).
>
> Reported-by: Konstantin Kostiuk <kkostiuk@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure         | 4 ++++
>  meson_options.txt | 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 02f1dd2311f..9aece67ed08 100755
> --- a/configure
> +++ b/configure
> @@ -1864,6 +1864,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

Same remark as on the other patch: can we have a comment
explaining why we disable this on Windows, please, ideally
with a URL of a bug report against the toolchain ?

thanks
-- PMM
Daniel P. Berrangé March 14, 2025, 4:54 p.m. UTC | #2
On Fri, Mar 14, 2025 at 04:44:01PM +0000, Peter Maydell wrote:
> On Fri, 14 Mar 2025 at 15:39, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >
> > -gsplit-dwarf is reported to produce broken binaries on Windows.
> > The linker produces warnings but exits successfully:
> >
> > /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
> >
> > and as a result qemu-ga.exe fails to start.
> >
> > On top of this, also disable -gsplit-dwarf unless building from git.
> > Similar to -Werror, split debug info is probably not the best choice
> > for people that want to build for installing.
> >
> > (Random thoughts: there is a tension here between adding an option
> > that is useful for QEMU developers, and messing things up for everyone
> > else by doing something decidedly non-standard.  For example, distros
> > are starting to create a fake git repository just so that they can
> > use "git am" to apply patches; while some of them, for example Fedora,
> > are wise, or paranoid, enough to pass --disable-XXX for everything and
> > then turn back on what they want, it cannot be expected that everyone
> > does this.  It may be safer to make --enable-split-debug default off
> > for everybody and add it somewhere in docs/.  For now I am keeping it
> > enabled but we could consider doing something different during the hard
> > freeze period).
> >
> > Reported-by: Konstantin Kostiuk <kkostiuk@redhat.com>
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> >  configure         | 4 ++++
> >  meson_options.txt | 2 +-
> >  2 files changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/configure b/configure
> > index 02f1dd2311f..9aece67ed08 100755
> > --- a/configure
> > +++ b/configure
> > @@ -1864,6 +1864,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
> 
> Same remark as on the other patch: can we have a comment
> explaining why we disable this on Windows, please, ideally
> with a URL of a bug report against the toolchain ?

Two likely candidates open a long time....

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59474
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99973


With regards,
Daniel
Paolo Bonzini March 14, 2025, 5:02 p.m. UTC | #3
On 3/14/25 17:54, Daniel P. Berrangé wrote:
>> Same remark as on the other patch: can we have a comment
>> explaining why we disable this on Windows, please, ideally
>> with a URL of a bug report against the toolchain ?
> 
> Two likely candidates open a long time....
> 
>    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59474
>    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99973

OMG...  Given this I think it should rather be reverted, and people can 
use --extra-cflags=-gsplit-dwarf.

(And in fact, since it's just an objcopy trick, it is even possible to 
put a gcc wrapper in ~/bin that will do it for you).

Paolo
Pierrick Bouvier March 14, 2025, 7:12 p.m. UTC | #4
On 3/14/25 08:38, Paolo Bonzini wrote:
> -gsplit-dwarf is reported to produce broken binaries on Windows.
> The linker produces warnings but exits successfully:
> 
> /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
> 
> and as a result qemu-ga.exe fails to start.
> 
> On top of this, also disable -gsplit-dwarf unless building from git.
> Similar to -Werror, split debug info is probably not the best choice
> for people that want to build for installing.
> 
> (Random thoughts: there is a tension here between adding an option
> that is useful for QEMU developers, and messing things up for everyone
> else by doing something decidedly non-standard.  For example, distros
> are starting to create a fake git repository just so that they can
> use "git am" to apply patches; while some of them, for example Fedora,
> are wise, or paranoid, enough to pass --disable-XXX for everything and
> then turn back on what they want, it cannot be expected that everyone
> does this.  It may be safer to make --enable-split-debug default off
> for everybody and add it somewhere in docs/.  For now I am keeping it
> enabled but we could consider doing something different during the hard
> freeze period).
> 
> Reported-by: Konstantin Kostiuk <kkostiuk@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   configure         | 4 ++++
>   meson_options.txt | 2 +-
>   2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 02f1dd2311f..9aece67ed08 100755
> --- a/configure
> +++ b/configure
> @@ -1864,6 +1864,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 3432123fee2..f3546b9abc1 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -362,7 +362,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')

Unfortunate coincidence, this appears at the same time MSYS2 fixed some 
issue triggering a segfault [1]. So I didn't investigate further the 
current issue, thinking something else have been changed I don't know where.

Would be better to revert it completely indeed, creating another build 
configuration is not worth the (cheap) disk storage saved.

[1] https://github.com/msys2/MINGW-packages/issues/23577
Alex Bennée March 14, 2025, 9:14 p.m. UTC | #5
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:

> On 3/14/25 08:38, Paolo Bonzini wrote:
>> -gsplit-dwarf is reported to produce broken binaries on Windows.
>> The linker produces warnings but exits successfully:
>> /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
>> and as a result qemu-ga.exe fails to start.
>> On top of this, also disable -gsplit-dwarf unless building from git.
>> Similar to -Werror, split debug info is probably not the best choice
>> for people that want to build for installing.
>> (Random thoughts: there is a tension here between adding an option
>> that is useful for QEMU developers, and messing things up for everyone
>> else by doing something decidedly non-standard.  For example, distros
>> are starting to create a fake git repository just so that they can
>> use "git am" to apply patches; while some of them, for example Fedora,
>> are wise, or paranoid, enough to pass --disable-XXX for everything and
>> then turn back on what they want, it cannot be expected that everyone
>> does this.  It may be safer to make --enable-split-debug default off
>> for everybody and add it somewhere in docs/.  For now I am keeping it
>> enabled but we could consider doing something different during the hard
>> freeze period).
>> Reported-by: Konstantin Kostiuk <kkostiuk@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>   configure         | 4 ++++
>>   meson_options.txt | 2 +-
>>   2 files changed, 5 insertions(+), 1 deletion(-)
>> diff --git a/configure b/configure
>> index 02f1dd2311f..9aece67ed08 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1864,6 +1864,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 3432123fee2..f3546b9abc1 100644
>> --- a/meson_options.txt
>> +++ b/meson_options.txt
>> @@ -362,7 +362,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')
>
> Unfortunate coincidence, this appears at the same time MSYS2 fixed
> some issue triggering a segfault [1]. So I didn't investigate further
> the current issue, thinking something else have been changed I don't
> know where.
>
> Would be better to revert it completely indeed, creating another build
> configuration is not worth the (cheap) disk storage saved.

Well we should disable debug info on the CI builds then. Nothing is free
and our CI is pretty damned heavy and the builds all add up when debug
info is on by default.

>
> [1] https://github.com/msys2/MINGW-packages/issues/23577
Richard Henderson March 14, 2025, 9:34 p.m. UTC | #6
On 3/14/25 14:14, Alex Bennée wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> 
>> On 3/14/25 08:38, Paolo Bonzini wrote:
>>> -gsplit-dwarf is reported to produce broken binaries on Windows.
>>> The linker produces warnings but exits successfully:
>>> /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
>>> and as a result qemu-ga.exe fails to start.
>>> On top of this, also disable -gsplit-dwarf unless building from git.
>>> Similar to -Werror, split debug info is probably not the best choice
>>> for people that want to build for installing.
>>> (Random thoughts: there is a tension here between adding an option
>>> that is useful for QEMU developers, and messing things up for everyone
>>> else by doing something decidedly non-standard.  For example, distros
>>> are starting to create a fake git repository just so that they can
>>> use "git am" to apply patches; while some of them, for example Fedora,
>>> are wise, or paranoid, enough to pass --disable-XXX for everything and
>>> then turn back on what they want, it cannot be expected that everyone
>>> does this.  It may be safer to make --enable-split-debug default off
>>> for everybody and add it somewhere in docs/.  For now I am keeping it
>>> enabled but we could consider doing something different during the hard
>>> freeze period).
>>> Reported-by: Konstantin Kostiuk <kkostiuk@redhat.com>
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>> ---
>>>    configure         | 4 ++++
>>>    meson_options.txt | 2 +-
>>>    2 files changed, 5 insertions(+), 1 deletion(-)
>>> diff --git a/configure b/configure
>>> index 02f1dd2311f..9aece67ed08 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -1864,6 +1864,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 3432123fee2..f3546b9abc1 100644
>>> --- a/meson_options.txt
>>> +++ b/meson_options.txt
>>> @@ -362,7 +362,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')
>>
>> Unfortunate coincidence, this appears at the same time MSYS2 fixed
>> some issue triggering a segfault [1]. So I didn't investigate further
>> the current issue, thinking something else have been changed I don't
>> know where.
>>
>> Would be better to revert it completely indeed, creating another build
>> configuration is not worth the (cheap) disk storage saved.
> 
> Well we should disable debug info on the CI builds then. Nothing is free
> and our CI is pretty damned heavy and the builds all add up when debug
> info is on by default.

I think it's best reverted, since it isn't implemented properly in gcc for 
cross-compilers.  Add it to --extra-cflags for particular builds if you must.


r~
Pierrick Bouvier March 14, 2025, 9:53 p.m. UTC | #7
On 3/14/25 14:14, Alex Bennée wrote:
> Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> 
>> On 3/14/25 08:38, Paolo Bonzini wrote:
>>> -gsplit-dwarf is reported to produce broken binaries on Windows.
>>> The linker produces warnings but exits successfully:
>>> /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
>>> and as a result qemu-ga.exe fails to start.
>>> On top of this, also disable -gsplit-dwarf unless building from git.
>>> Similar to -Werror, split debug info is probably not the best choice
>>> for people that want to build for installing.
>>> (Random thoughts: there is a tension here between adding an option
>>> that is useful for QEMU developers, and messing things up for everyone
>>> else by doing something decidedly non-standard.  For example, distros
>>> are starting to create a fake git repository just so that they can
>>> use "git am" to apply patches; while some of them, for example Fedora,
>>> are wise, or paranoid, enough to pass --disable-XXX for everything and
>>> then turn back on what they want, it cannot be expected that everyone
>>> does this.  It may be safer to make --enable-split-debug default off
>>> for everybody and add it somewhere in docs/.  For now I am keeping it
>>> enabled but we could consider doing something different during the hard
>>> freeze period).
>>> Reported-by: Konstantin Kostiuk <kkostiuk@redhat.com>
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>> ---
>>>    configure         | 4 ++++
>>>    meson_options.txt | 2 +-
>>>    2 files changed, 5 insertions(+), 1 deletion(-)
>>> diff --git a/configure b/configure
>>> index 02f1dd2311f..9aece67ed08 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -1864,6 +1864,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 3432123fee2..f3546b9abc1 100644
>>> --- a/meson_options.txt
>>> +++ b/meson_options.txt
>>> @@ -362,7 +362,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')
>>
>> Unfortunate coincidence, this appears at the same time MSYS2 fixed
>> some issue triggering a segfault [1]. So I didn't investigate further
>> the current issue, thinking something else have been changed I don't
>> know where.
>>
>> Would be better to revert it completely indeed, creating another build
>> configuration is not worth the (cheap) disk storage saved.
> 
> Well we should disable debug info on the CI builds then. Nothing is free
> and our CI is pretty damned heavy and the builds all add up when debug
> info is on by default.
> 

If the problem is the storage between jobs or artifacts, maybe it's 
possibly to simply strip the binaries?

>>
>> [1] https://github.com/msys2/MINGW-packages/issues/23577
>
diff mbox series

Patch

diff --git a/configure b/configure
index 02f1dd2311f..9aece67ed08 100755
--- a/configure
+++ b/configure
@@ -1864,6 +1864,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 3432123fee2..f3546b9abc1 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -362,7 +362,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')