Wireshark-dev: Re: [Wireshark-dev] Qt compilation.

From: Akos Vandra <axos88@xxxxxxxxx>
Date: Mon, 12 Nov 2012 12:27:54 +0100
Can anyone help me on this?

Regards,
  Ákos Vandra


On 7 November 2012 14:37, Akos Vandra <axos88@xxxxxxxxx> wrote:
Hi Roland,

Thanks for the tip, it's mostly working, but only with a single thread. Using more threads (-j10 for ex.) fails, at linking.

However even with only one thread at 75% I get:

Linking C executable dftest
[ 75%] Built target dftest
[ 75%] Building C object CMakeFiles/dumpcap.dir/dumpcap.c.o
In file included from /home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:92:0:
/home/akos/projects/c/wireshark/wireshark_original/trunk/pcapio.h:42:5: error: ‘struct pcap_pkthdr’ declared inside parameter list [-Werror]
In file included from /home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:92:0:
/home/akos/projects/c/wireshark/wireshark_original/trunk/pcapio.h:97:37: error: ‘struct pcap_pkthdr’ declared inside parameter list [-Werror]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:230:5: error: unknown type name ‘pcap_t’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:289:24: error: field ‘phdr’ has incomplete type
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:614:1: error: unknown type name ‘pcap_t’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:616:42: error: ‘PCAP_ERRBUF_SIZE’ undeclared here (not in a function)
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘open_capture_device’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:618:5: error: unknown type name ‘pcap_t’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:714:9: error: implicit declaration of function ‘pcap_open_live’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:616:28: error: unused parameter ‘open_err_str’ [-Werror=unused-parameter]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: At top level:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:802:19: error: unknown type name ‘pcap_t’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:840:43: error: unknown type name ‘pcap_t’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘capture_interface_list’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:958:5: error: implicit declaration of function ‘get_interface_list’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:958:5: error: return makes pointer from integer without a cast [-Werror]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: At top level:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:967:19: error: unknown type name ‘pcap_t’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘create_data_link_info’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1087:5: error: implicit declaration of function ‘pcap_datalink_val_to_name’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1087:10: error: assignment makes pointer from integer without a cast [-Werror]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1092:5: error: implicit declaration of function ‘pcap_datalink_val_to_description’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1092:10: error: assignment makes pointer from integer without a cast [-Werror]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘get_if_capabilities’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1111:17: error: ‘PCAP_ERRBUF_SIZE’ undeclared (first use in this function)
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1111:17: note: each undeclared identifier is reported only once for each function it appears in
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1112:5: error: unknown type name ‘pcap_t’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1203:35: error: ‘MIN_PACKET_SIZE’ undeclared (first use in this function)
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1212:5: error: implicit declaration of function ‘get_pcap_linktype’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1270:5: error: implicit declaration of function ‘pcap_close’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1111:10: error: unused variable ‘errbuf’ [-Werror=unused-variable]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: At top level:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1381:5: error: unknown type name ‘pcap_t’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘print_statistics_loop’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1393:5: error: unknown type name ‘pcap_t’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1394:24: error: ‘PCAP_ERRBUF_SIZE’ undeclared (first use in this function)
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1395:22: error: storage size of ‘ps’ isn’t known
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1397:13: error: assignment makes pointer from integer without a cast [-Werror]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1418:45: error: ‘MIN_PACKET_SIZE’ undeclared (first use in this function)
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1448:13: error: implicit declaration of function ‘pcap_stats’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1395:22: error: unused variable ‘ps’ [-Werror=unused-variable]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:1394:17: error: unused variable ‘errbuf’ [-Werror=unused-variable]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘cap_pipe_dispatch’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:2257:24: error: storage size of ‘phdr’ isn’t known
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:2257:24: error: unused variable ‘phdr’ [-Werror=unused-variable]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘capture_loop_open_input’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:2477:36: error: ‘PCAP_ERRBUF_SIZE’ undeclared (first use in this function)
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:2593:9: error: type of formal parameter 2 is incomplete
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:2645:13: error: implicit declaration of function ‘set_pcap_linktype’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:2688:13: error: implicit declaration of function ‘pcap_fileno’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:2477:23: error: unused variable ‘open_err_str’ [-Werror=unused-variable]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: At top level:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:2758:26: error: unknown type name ‘pcap_t’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘capture_loop_init_output’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:2838:21: error: implicit declaration of function ‘pcap_snapshot’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘capture_loop_close_output’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:2916:38: error: storage size of ‘stats’ isn’t known
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:2916:38: error: unused variable ‘stats’ [-Werror=unused-variable]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘capture_loop_dispatch’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3024:21: error: implicit declaration of function ‘pcap_dispatch’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: At top level:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3382:81: error: ‘struct pcap_stat’ declared inside parameter list [-Werror]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘capture_loop_start’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3443:9: error: implicit declaration of function ‘capture_loop_init_filter’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3453:13: error: implicit declaration of function ‘pcap_geterr’ [-Werror=implicit-function-declaration]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3453:13: error: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Werror=format]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3458:24: error: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Werror=format]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3732:25: error: assignment makes pointer from integer without a cast [-Werror]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3810:33: error: dereferencing pointer to incomplete type
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3814:28: error: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Werror=format]
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘capture_loop_write_packet_cb’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3947:13: error: passing argument 2 of ‘libpcap_write_enhanced_packet_block’ from incompatible pointer type [-Werror]
/home/akos/projects/c/wireshark/wireshark_original/trunk/pcapio.h:91:1: note: expected ‘const struct pcap_pkthdr *’ but argument is of type ‘const struct pcap_pkthdr *’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3949:13: error: passing argument 2 of ‘libpcap_write_packet’ from incompatible pointer type [-Werror]
/home/akos/projects/c/wireshark/wireshark_original/trunk/pcapio.h:41:1: note: expected ‘const struct pcap_pkthdr *’ but argument is of type ‘const struct pcap_pkthdr *’
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3958:24: error: dereferencing pointer to incomplete type
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘capture_loop_queue_packet_cb’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3992:27: error: dereferencing pointer to incomplete type
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3993:48: error: dereferencing pointer to incomplete type
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:3999:39: error: dereferencing pointer to incomplete type
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:4005:33: error: dereferencing pointer to incomplete type
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:4017:19: error: dereferencing pointer to incomplete type
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:4022:19: error: dereferencing pointer to incomplete type
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c: In function ‘main’:
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:4089:26: error: storage size of ‘stats’ isn’t known
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:4735:53: error: ‘MIN_PACKET_SIZE’ undeclared (first use in this function)
/home/akos/projects/c/wireshark/wireshark_original/trunk/dumpcap.c:4089:26: error: unused variable ‘stats’ [-Werror=unused-variable]
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/dumpcap.dir/dumpcap.c.o] Error 1
make[1]: *** [CMakeFiles/dumpcap.dir/all] Error 2
make: *** [all] Error 2


My configuration is:

PCAP_INCLUDE_DIR: /home/akos/projects/c/wireshark/bin/include/pcap/
PCAP_LIBRARY: /home/akos/projects/c/wireshark/bin/lib/libpcap.so

also tried with

PCAP_INCLUDE_DIR: /home/akos/projects/c/wireshark/bin/include/
PCAP_LIBRARY: /home/akos/projects/c/wireshark/bin/lib/libpcap.so

same result.

akos@fm12bq:~/projects/c/wireshark/bin$ ls -lR /home/akos/projects/c/wireshark/bin/include/
/home/akos/projects/c/wireshark/bin/include/:
total 16
drwxr-xr-x 2 akos akos 4096 Oct  9 08:07 pcap
-rw-r--r-- 1 akos akos 2393 Oct  9 08:07 pcap-bpf.h
-rw-r--r-- 1 akos akos 2320 Oct  9 08:07 pcap.h
-rw-r--r-- 1 akos akos 2125 Oct  9 08:07 pcap-namedb.h

/home/akos/projects/c/wireshark/bin/include/pcap:
total 92
-rw-r--r-- 1 akos akos  2016 Oct  9 08:07 bluetooth.h
-rw-r--r-- 1 akos akos 37126 Oct  9 08:07 bpf.h
-rw-r--r-- 1 akos akos  2272 Oct  9 08:07 ipnet.h
-rw-r--r-- 1 akos akos  3421 Oct  9 08:07 namedb.h
-rw-r--r-- 1 akos akos 16920 Oct  9 08:07 pcap.h
-rw-r--r-- 1 akos akos  5563 Oct  9 08:07 sll.h
-rw-r--r-- 1 akos akos  4659 Oct  9 08:07 usb.h
-rw-r--r-- 1 akos akos  2151 Oct  9 08:07 vlan.h
akos@fm12bq:~/projects/c/wireshark/bin$ 



Regards,
  Ákos Vandra


On 7 November 2012 13:26, Roland Knall <rknall@xxxxxxxxx> wrote:
Hi

Try not to run cmake but instead run cmake-gui, using the same parameters. Additionally, it is useful to create a separate build directory. therefore, build-files wil not clutter up the src space.

So, checkout wireshark, make a goto wireshark, create a directory named "build" cd into it and call "cmake-gui .."

After the first configure run, you can set the paths in the gui, and then run configure and  generate again.

Afterwards you can just run "make" or eclipse, depending on the project you created.

regards, 
Roland



On Wed, Nov 7, 2012 at 1:22 PM, Akos Vandra <axos88@xxxxxxxxx> wrote:
Hi guys!

I am new to cmake, and I am unable to compile Wireshark for Qt.

Can someone please write a step-by-step guide on what commands I have to issue in order to build it?

This is what I wanted to try:

edit CMakeOptions is trunk/ and set GTK to OFF, QT to ON.
"cmake ."
"make -j 10"

My output for cmake:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
PCAP_LIBRARY
    linked by target "dftest" in directory /home/akos/projects/c/wireshark/wireshark_original/trunk
    linked by target "qtshark" in directory /home/akos/projects/c/wireshark/wireshark_original/trunk
    linked by target "randpkt" in directory /home/akos/projects/c/wireshark/wireshark_original/trunk
    linked by target "tshark" in directory /home/akos/projects/c/wireshark/wireshark_original/trunk
    linked by target "epan" in directory /home/akos/projects/c/wireshark/wireshark_original/trunk/epan


Problem is that I use a custom libpcap, but don't know how I should tell cmake that.
With ./configure I just added a parameter (--with-pcap="path to custom pcap library", or something similar), and it was fine, but with cmake, I have no idea how to do it. Tried adding some lines to cmakeoptions, but neither of them worked.

Regards,
  Ákos Vandra

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe


___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe