Bug 1300002 - Unable to compile packet dissectors due to missing glib dep in wireshark.pc file
Unable to compile packet dissectors due to missing glib dep in wireshark.pc file
Product: Fedora
Classification: Fedora
Component: wireshark (Show other bugs)
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Peter Hatina
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2016-01-19 12:41 EST by Daniel Berrange
Modified: 2016-05-31 21:33 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-02-23 08:31:01 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Daniel Berrange 2016-01-19 12:41:03 EST
Description of problem:
Many of the wireshark header files depend on glib, since they #include glib.h.

$ rpm -q wireshark-devel

$ rpm -ql wireshark-devel | grep include | grep '\.h' | xargs grep glib.h | wc -l

Historically wireshark.pc has included 'Requires: glib-2.0' so that pkg-config can report the correct cflags to build wireshark packet dissectors

$ pkg-config --cflags --libs wireshark
-DWS_VAR_IMPORT=extern -DHAVE_STDARG_H -DWS_MSVC_NORETURN= -pthread -I/usr/include/wireshark -I/usr/include/wireshark/epan -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -lwireshark -lwiretap -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 

So on Fedora 23 with wireshark-1.12.9 you can do

$ cat > ws.c <<EOF

#include <wireshark/config.h>
#include <wireshark/epan/proto.h>
$ gcc -c `pkg-config --cflags --libs wireshark` -o ws.o ws.c

And it works.

In Fedora 24, with wireshark-2.0.1, the wireshark.pc file has been changed so that it only has 'Requires: Qt':

$ rpm -q wireshark-devel

$ pkg-config --cflags --libs wireshark
-DWS_VAR_IMPORT=extern -DHAVE_STDARG_H -DWS_MSVC_NORETURN= -I/usr/include/wireshark -I/usr/include/wireshark/epan -lwireshark -lwiretap 

but even more of the header files still #include <glib.h>:

$ rpm -ql wireshark-devel | grep include | grep '\.h' | xargs grep glib.h | wc -l

As a result, when trying to compile dissectors, the compiler is no longer able to locate the glib header files

$ gcc -c `pkg-config --cflags --libs wireshark` -o ws.o ws.c 
In file included from ws.c:3:0:
/usr/include/wireshark/epan/proto.h:40:18: fatal error: glib.h: No such file or directory
compilation terminated.

This flaw is making it impossible to build libvirt's wireshark support as it canot find glib.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. See example program above

Actual results:
Compiler cannot find glib.h due to missing cflags from pkg-config wireshark.pc

Expected results:
wireshark.pc includes all flags neccessary to compile against wireshark.
Comment 1 Daniel Berrange 2016-01-19 12:42:55 EST
This flaw was introduced locally in Fedora with the 2.0.1 rebase on this commit:

commit fe8ecadd7fbb58b8247b55332723eef5894e8cf6
Author: Peter Hatina <phatina@gmail.com>
Date:   Thu Jan 14 11:56:55 2016 +0100

    Ver. 2.0.1

It modified this patch wireshark-0006-Add-pkgconfig-entry.patch to now contain incorrect information
Comment 2 Daniel Berrange 2016-02-17 06:30:29 EST
Can we get some progress on applying this fix please, it is a blocker for anyone building libvirt with wireshark support in Fedora 24
Comment 3 Peter Hatina 2016-02-23 08:31:01 EST
Fixed in 7d05a9a, http://koji.fedoraproject.org/koji/taskinfo?taskID=13106963

Note You need to log in before you can comment on or make changes to this bug.