[libvirt] [PATCH] wireshark dissector compile fix

Compiling libvirt wireshark dissector on a debian based system failed: CC wireshark/src/wireshark_src_libvirt_la-packet-libvirt.lo In file included from ../../libvirt/tools/wireshark/src/packet-libvirt.c:27:0: /usr/include/wireshark/epan/proto.h:40:18: fatal error: glib.h: No such file or directory compilation terminated. Makefile:2595: recipe for target 'wireshark/src/wireshark_src_libvirt_la-packet-libvirt.lo' failed Add an explicit dependency to glib. Benedikt Spranger (1): wireshark: glib compile fix m4/virt-wireshark.m4 | 2 ++ tools/Makefile.am | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) -- 2.8.1

libvirt wireshark dissector uses wireshark and glib. Since wireshark development files did not depend on glib add an expicit dependency. Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de> --- m4/virt-wireshark.m4 | 2 ++ tools/Makefile.am | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/m4/virt-wireshark.m4 b/m4/virt-wireshark.m4 index f383e2b..629e190 100644 --- a/m4/virt-wireshark.m4 +++ b/m4/virt-wireshark.m4 @@ -19,6 +19,7 @@ dnl AC_DEFUN([LIBVIRT_CHECK_WIRESHARK],[ LIBVIRT_CHECK_PKG([WIRESHARK_DISSECTOR], [wireshark], [1.11.3]) + LIBVIRT_CHECK_PKG([GLIB], [glib-2.0], [2.46.2]) AC_ARG_WITH([ws-plugindir], [AS_HELP_STRING([--with-ws-plugindir], @@ -52,4 +53,5 @@ AC_DEFUN([LIBVIRT_CHECK_WIRESHARK],[ AC_DEFUN([LIBVIRT_RESULT_WIRESHARK],[ LIBVIRT_RESULT_LIB([WIRESHARK_DISSECTOR]) + LIBVIRT_RESULT_LIB([GLIB]) ]) diff --git a/tools/Makefile.am b/tools/Makefile.am index a01c58d..44c5e9b 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -408,8 +408,8 @@ if WITH_WIRESHARK_DISSECTOR ws_plugindir = $(plugindir) ws_plugin_LTLIBRARIES = wireshark/src/libvirt.la wireshark_src_libvirt_la_CPPFLAGS = \ - -I wireshark/src $(WIRESHARK_DISSECTOR_CFLAGS) -wireshark_src_libvirt_la_LDFLAGS = -avoid-version -module + -I wireshark/src $(WIRESHARK_DISSECTOR_CFLAGS) $(GLIB_CFLAGS) +wireshark_src_libvirt_la_LDFLAGS = -avoid-version -module $(GLIB_LIBS) nodist_wireshark_src_libvirt_la_SOURCES = wireshark/src/plugin.c wireshark_src_libvirt_la_SOURCES = \ wireshark/src/packet-libvirt.h \ -- 2.8.1

On Fri, Jul 29, 2016 at 12:43:41PM +0200, Benedikt Spranger wrote:
Compiling libvirt wireshark dissector on a debian based system failed: CC wireshark/src/wireshark_src_libvirt_la-packet-libvirt.lo In file included from ../../libvirt/tools/wireshark/src/packet-libvirt.c:27:0: /usr/include/wireshark/epan/proto.h:40:18: fatal error: glib.h: No such file or directory compilation terminated. Makefile:2595: recipe for target 'wireshark/src/wireshark_src_libvirt_la-packet-libvirt.lo' failed
Add an explicit dependency to glib.
This is a bug in wireshark packages in debian that they should fix there. Libvirt shouldn't be hardcoding knowledge about what other libs wireshark may happen to depend on. Specifically the wireshark.pc file needs fixing to have the glib dep. For reference, there's the corresponding fedora bug dealing with this same problem: https://bugzilla.redhat.com/show_bug.cgi?id=1300002 Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

Am Fri, 29 Jul 2016 12:27:16 +0100 schrieb "Daniel P. Berrange" <berrange@redhat.com>:
On Fri, Jul 29, 2016 at 12:43:41PM +0200, Benedikt Spranger wrote:
Compiling libvirt wireshark dissector on a debian based system failed: CC wireshark/src/wireshark_src_libvirt_la-packet-libvirt.lo In file included from ../../libvirt/tools/wireshark/src/packet-libvirt.c:27:0: /usr/include/wireshark/epan/proto.h:40:18: fatal error: glib.h: No such file or directory compilation terminated. Makefile:2595: recipe for target 'wireshark/src/wireshark_src_libvirt_la-packet-libvirt.lo' failed
Add an explicit dependency to glib.
This is a bug in wireshark packages in debian that they should fix there. see debian bug #832926
But IMHO this is half of the truth.
Libvirt shouldn't be hardcoding knowledge about what other libs wireshark may happen to depend on. I disagree here. libvirt explicit includes "glib.h" here. Therfore it has a direct dependency to glib and this dependency should be checked. Implicit dependencies tend to be a can of worms.
Regards Benedikt Spranger

On 29.07.2016 18:28, Benedikt Spranger wrote:
Am Fri, 29 Jul 2016 12:27:16 +0100 schrieb "Daniel P. Berrange" <berrange@redhat.com>:
On Fri, Jul 29, 2016 at 12:43:41PM +0200, Benedikt Spranger wrote:
Compiling libvirt wireshark dissector on a debian based system failed: CC wireshark/src/wireshark_src_libvirt_la-packet-libvirt.lo In file included from ../../libvirt/tools/wireshark/src/packet-libvirt.c:27:0: /usr/include/wireshark/epan/proto.h:40:18: fatal error: glib.h: No such file or directory compilation terminated. Makefile:2595: recipe for target 'wireshark/src/wireshark_src_libvirt_la-packet-libvirt.lo' failed
Add an explicit dependency to glib.
This is a bug in wireshark packages in debian that they should fix there. see debian bug #832926
But IMHO this is half of the truth.
Libvirt shouldn't be hardcoding knowledge about what other libs wireshark may happen to depend on. I disagree here. libvirt explicit includes "glib.h" here. Therfore it has a direct dependency to glib and this dependency should be checked. Implicit dependencies tend to be a can of worms.
Ah, you're right. Looks like the only glib function that the dissector actually uses is g_sprintf(), which in this case provides no added value to plain sprintf(). I've posted the patch here: https://www.redhat.com/archives/libvir-list/2016-August/msg00011.html Michal

On Mon, 1 Aug 2016 10:25:48 +0200 Michal Privoznik <mprivozn@redhat.com> wrote:
Ah, you're right. Looks like the only glib function that the dissector actually uses is g_sprintf(), which in this case provides no added value to plain sprintf(). I've posted the patch here:
https://www.redhat.com/archives/libvir-list/2016-August/msg00011.html
Sounds good. Give it a try. Thanks. Benedikt Spranger
participants (3)
-
Benedikt Spranger
-
Daniel P. Berrange
-
Michal Privoznik