diff mbox series

building qemu on a system with libxkbcommon installed but not xkeyboard-config produces an core dump

Message ID 94cf974b-05ec-41c2-8d0b-43ffbc8bdeac@gmail.com
State New
Headers show
Series building qemu on a system with libxkbcommon installed but not xkeyboard-config produces an core dump | expand

Commit Message

Zhang Wen Jan. 31, 2024, 8:13 a.m. UTC
With this patch, qemu requires keyboard-config when libxkbcommon is 
found on the system. So if the qemu is configured when libxkbcommon is 
installed but not keyboard-config, the configure stage will produce an 
error message, thus avoid coredump in the build stage.
From e0b1e479e8a82f7a7940ca70b5136bf10e36756b Mon Sep 17 00:00:00 2001
From: Zhang Wen <zhw2101024@gmail.com>
Date: Fri, 26 Jan 2024 17:09:10 +0800
Subject: [PATCH] requires xkeyboard-config when libxkbcommon is available to
 avoid build error

Signed-off-by: Zhang Wen <zhw2101024@gmail.com>
---
 meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michael Tokarev Feb. 1, 2024, 12:11 p.m. UTC | #1
31.01.2024 11:13, Zhang Wen:
> With this patch, qemu requires keyboard-config when libxkbcommon is found on the system. So if the qemu is configured when libxkbcommon is installed 
> but not keyboard-config, the configure stage will produce an error message, thus avoid coredump in the build stage.

I'm not sure what you're talking about.  What *is* keyboard-config anyway?

On a debian system there's no such thing.  There's keyboard-configuration
package but it has nothing to do with that.  It looks like if we apply
such patch, it will be impossible to build qemu on debian.

/mjt
Michael Tokarev Feb. 1, 2024, 12:49 p.m. UTC | #2
01.02.2024 15:11, Michael Tokarev wrote:
> 31.01.2024 11:13, Zhang Wen:
>> With this patch, qemu requires keyboard-config when libxkbcommon is found on the system. So if the qemu is configured when libxkbcommon is installed 
>> but not keyboard-config, the configure stage will produce an error message, thus avoid coredump in the build stage.
> 
> I'm not sure what you're talking about.  What *is* keyboard-config anyway?
> 
> On a debian system there's no such thing.  There's keyboard-configuration
> package but it has nothing to do with that.  It looks like if we apply
> such patch, it will be impossible to build qemu on debian.

Aha, I found it.  On debian it is /usr/share/pkgconfig/keyboard-config.pc,
which is a part of xkb-data package.  And libxkbcommon Depends on xkb-data.
It looks like the distribution here is wrong, there should be no libxkbcommon
without xkb-data which includes keyboard-config.

/mjt
Peter Maydell Feb. 1, 2024, 12:57 p.m. UTC | #3
On Thu, 1 Feb 2024 at 12:50, Michael Tokarev <mjt@tls.msk.ru> wrote:
>
> 01.02.2024 15:11, Michael Tokarev wrote:
> > 31.01.2024 11:13, Zhang Wen:
> >> With this patch, qemu requires keyboard-config when libxkbcommon is found on the system. So if the qemu is configured when libxkbcommon is installed
> >> but not keyboard-config, the configure stage will produce an error message, thus avoid coredump in the build stage.
> >
> > I'm not sure what you're talking about.  What *is* keyboard-config anyway?
> >
> > On a debian system there's no such thing.  There's keyboard-configuration
> > package but it has nothing to do with that.  It looks like if we apply
> > such patch, it will be impossible to build qemu on debian.
>
> Aha, I found it.  On debian it is /usr/share/pkgconfig/keyboard-config.pc,
> which is a part of xkb-data package.  And libxkbcommon Depends on xkb-data.
> It looks like the distribution here is wrong, there should be no libxkbcommon
> without xkb-data which includes keyboard-config.

Are we talking about "keyboard-config" or "xkeyboard-config" here?
The commit message says "keyboard-config" but the patch itself
says "xkeyboard-config".

Zhang: it would be helpful if you could tell us which distro
you are building on where you see this problem.

thanks
-- PMM
Michael Tokarev Feb. 1, 2024, 12:59 p.m. UTC | #4
01.02.2024 15:57, Peter Maydell пишет:
> On Thu, 1 Feb 2024 at 12:50, Michael Tokarev <mjt@tls.msk.ru> wrote:
>>
>> 01.02.2024 15:11, Michael Tokarev wrote:
>>> 31.01.2024 11:13, Zhang Wen:
>>>> With this patch, qemu requires keyboard-config when libxkbcommon is found on the system. So if the qemu is configured when libxkbcommon is installed
>>>> but not keyboard-config, the configure stage will produce an error message, thus avoid coredump in the build stage.
>>>
>>> I'm not sure what you're talking about.  What *is* keyboard-config anyway?
>>>
>>> On a debian system there's no such thing.  There's keyboard-configuration
>>> package but it has nothing to do with that.  It looks like if we apply
>>> such patch, it will be impossible to build qemu on debian.
>>
>> Aha, I found it.  On debian it is /usr/share/pkgconfig/keyboard-config.pc,
>> which is a part of xkb-data package.  And libxkbcommon Depends on xkb-data.
>> It looks like the distribution here is wrong, there should be no libxkbcommon
>> without xkb-data which includes keyboard-config.
> 
> Are we talking about "keyboard-config" or "xkeyboard-config" here?
> The commit message says "keyboard-config" but the patch itself
> says "xkeyboard-config".

It is xkeyboard-config.pc, - I hit the same trap with the wrong commit
message.

$ dpkg -L xkb-data | fgrep .pc
/usr/share/pkgconfig/xkeyboard-config.pc
$ dpkg -s libxkbcommon0 | grep Depends
Depends: xkb-data, libc6 (>= 2.33)

/mjt
Zhang Wen Feb. 6, 2024, 6:35 a.m. UTC | #5
Peter Maydell <peter.maydell@linaro.org> 于2024年2月1日周四 20:57写道:
>
> On Thu, 1 Feb 2024 at 12:50, Michael Tokarev <mjt@tls.msk.ru> wrote:
> >
> > 01.02.2024 15:11, Michael Tokarev wrote:
> > > 31.01.2024 11:13, Zhang Wen:
> > >> With this patch, qemu requires keyboard-config when libxkbcommon is found on the system. So if the qemu is configured when libxkbcommon is installed
> > >> but not keyboard-config, the configure stage will produce an error message, thus avoid coredump in the build stage.
> > >
> > > I'm not sure what you're talking about.  What *is* keyboard-config anyway?
> > >
> > > On a debian system there's no such thing.  There's keyboard-configuration
> > > package but it has nothing to do with that.  It looks like if we apply
> > > such patch, it will be impossible to build qemu on debian.
> >
> > Aha, I found it.  On debian it is /usr/share/pkgconfig/keyboard-config.pc,
> > which is a part of xkb-data package.  And libxkbcommon Depends on xkb-data.
> > It looks like the distribution here is wrong, there should be no libxkbcommon
> > without xkb-data which includes keyboard-config.
>
> Are we talking about "keyboard-config" or "xkeyboard-config" here?
> The commit message says "keyboard-config" but the patch itself
> says "xkeyboard-config".
>
> Zhang: it would be helpful if you could tell us which distro
> you are building on where you see this problem.
>
> thanks
> -- PMM

I'm so sorry for the misspelling in my initial post and the confusion
caused by that.
I'm building my own system following the Linux From Scratch package, which is at
https://www.linuxfromscratch.org.
I accidently built libxkbcommon package but not xkeyboard-config
package, and then
while building qemu I saw this problem. it's a little difficult to
find the root cause from
this error message, so I sent this patch to seek for help from upstream.
Michael Tokarev Feb. 6, 2024, 7:08 a.m. UTC | #6
06.02.2024 09:35, Zhang Wen:
...
> I'm so sorry for the misspelling in my initial post and the confusion
> caused by that.

That's no problem, things happen.

> I'm building my own system following the Linux From Scratch package, which is at
> https://www.linuxfromscratch.org.
> I accidently built libxkbcommon package but not xkeyboard-config
> package, and then
> while building qemu I saw this problem. it's a little difficult to
> find the root cause from
> this error message, so I sent this patch to seek for help from upstream.

Okay, so it is mostly a self-built/self-installed linux.  That works too.

So how the problem manifests itself?  What the actual error message is?
You mentioned some segfault iirc, care to share some details?

It's not a problem at all to pick this change up, but I'd love to know
more details about this first :)

Thanks,

/mjt
Zhang Wen Feb. 6, 2024, 7:50 a.m. UTC | #7
> So how the problem manifests itself?  What the actual error message is?
> You mentioned some segfault iirc, care to share some details?
I'm doing a rebuild, and will attach the error message and coredump
file here in one or two days.
Zhang Wen Feb. 8, 2024, 2 a.m. UTC | #8
Here's my error message and core file attached.
Peter Maydell Feb. 8, 2024, 11:52 a.m. UTC | #9
On Tue, 6 Feb 2024 at 06:35, Zhang Wen <zhw2101024@gmail.com> wrote:
> I'm building my own system following the Linux From Scratch package, which is at
> https://www.linuxfromscratch.org.
> I accidently built libxkbcommon package but not xkeyboard-config
> package, and then
> while building qemu I saw this problem.

I found this interesting commit in FreeBSD:
https://svnweb.freebsd.org/ports?view=revision&revision=490981
"Add a run time dependency on x11/xkeyboard-config in x11/libxkbcommon.

 While not strictly necessary, this is recommended upstream, since almost all
 uses of libxkbcommon also needs xkeyboard-config.  This is similar to how it
 is done in other distributions.

 This solves issues when graphics/xpdf4 is installed without a desktop or
 graphical environment, as well as other places."

That suggests that the intention of X11 upstream is that if
a distro provides libxkbcommon then it should also provide
xkeyboard-config, and if the distro doesn't do that then various
things will not work correctly, not just QEMU.

Looking at the Linux From Scratch website I see that their
libxkbcommon page
https://www.linuxfromscratch.org/blfs/view/svn/general/libxkbcommon.html
says:

# Required
# xkeyboard-config-2.41 (runtime)

So LFS agrees that xkeyboard-config is a required dependency.

My inclination is therefore to say that "libxkbcommon is present
but one of its required dependencies is missing" is not really
a situation we need to change QEMU to handle.

thanks
-- PMM
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index d0329966f1..233c006754 100644
--- a/meson.build
+++ b/meson.build
@@ -1093,6 +1093,7 @@  else
   xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
                          method: 'pkg-config')
 endif
+xkeyboard_config = dependency('xkeyboard-config')
 
 slirp = not_found
 if not get_option('slirp').auto() or have_system
@@ -3978,7 +3979,7 @@  subdir('qga')
 if xkbcommon.found()
   # used for the update-keymaps target, so include rules even if !have_tools
   qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
-                           dependencies: [qemuutil, xkbcommon], install: have_tools)
+                           dependencies: [qemuutil, xkbcommon, xkeyboard_config], install: have_tools)
 endif
 
 if have_tools