Bug 1300002 - Unable to compile packet dissectors due to missing glib dep in wireshark.pc file
Summary: Unable to compile packet dissectors due to missing glib dep in wireshark.pc file
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: wireshark
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Peter Hatina
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-19 17:41 UTC by Daniel Berrangé
Modified: 2016-06-01 01:33 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-02-23 13:31:01 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Daniel Berrangé 2016-01-19 17:41:03 UTC
Description of problem:
Many of the wireshark header files depend on glib, since they #include glib.h.

$ rpm -q wireshark-devel
wireshark-devel-1.12.9-1.fc23.x86_64

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


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>
EOF
$ 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
wireshark-devel-2.0.1-1.fc24.x86_64

$ 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
128


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):
wireshark-devel-2.0.1-1.fc24.x86_64

How reproducible:
Always

Steps to Reproduce:
1. See example program above
2.
3.

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 Berrangé 2016-01-19 17:42:55 UTC
This flaw was introduced locally in Fedora with the 2.0.1 rebase on this commit:

commit fe8ecadd7fbb58b8247b55332723eef5894e8cf6
Author: Peter Hatina <phatina>
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 Berrangé 2016-02-17 11:30:29 UTC
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 13:31:01 UTC
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.