This is our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

To enable capture traffic on multiple interfaces at once, I tried to install wireshark 1.8.3. However, I encountered the following errors:

capture-pcap-util.c:274:1: error: static declaration of ‘pcap_datalink_name_to_val’ follows non-static declaration /usr/local/include/pcap/pcap.h:326:5: note: previous declaration of ‘pcap_datalink_name_to_val’ was here capture-pcap-util.c:289:1: error: static declaration of ‘pcap_datalink_val_to_name’ follows non-static declaration /usr/local/include/pcap/pcap.h:327:13: note: previous declaration of ‘pcap_datalink_val_to_name’ was here

After doing some search, I found someone can fix it by reinstall libpcap-dev, or the following commands: step 1:rm & rmdir any file in '/usr/include/pcap';'/usr/local/include/pcap'

step 2:Download libpcap by 'sudo apt-get install libpcap0.8-dev'

step 3:./autogen.sh in wireshark dir

step 4:make clean & make & make install

However, neither is working on ubuntu 12.04/wireshark 1.8.3

Anyone can help?

asked 08 Nov '12, 20:45

geneopenflow's gravatar image

geneopenflow
16334
accept rate: 0%


Please run this command.

apt-get build-dep wireshark

It will install everything that is necessary to build Wireshark on Ubuntu. See also my answer to the following question:

http://ask.wireshark.org/questions/11525/autogen-giving-these-errors-what-wrong-am-i-doing

If you want to run Wireshark without root privileges (after you compiled and installed it), please read the answer of the following question:

http://ask.wireshark.org/questions/7976/wireshark-setup-linux-for-nonroot-user

Regards
Kurt

permanent link

answered 09 Nov '12, 02:39

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
24.8k1039237
accept rate: 15%

since wireshark's version in ubuntu repo is ancient, is it still valid to use apt-get build-dep wireshark? coz I wanna install a newest version from source. thanks a lot

(09 Nov '12, 14:04) geneopenflow

'apt-get build-dep wireshark' just installs all libs and tools (the dependencies) that are necessary to build Wireshark. You still need the current sources (either 1.8.3 or the svn tree) to build your version of Wireshark.

(09 Nov '12, 14:16) Kurt Knochner ♦

thanks, Kurt. However, after I run apt-get build-dep wireshark and make clean, I reconfigure and make the source. the same problems are still there. Any other possibility?

(09 Nov '12, 17:39) geneopenflow

strange, it works out of the box on my Ubuntu 12.04.

However, if you still get an error messages about the file /usr/local/include/pcap/pcap.h, there must be something different/wrong on your system, as I don't have that file and it's not part of libpcap0.8-dev !?!

If there is really a file pcap.h in /usr/local/include, please post the output of the following commands:

dpkg -S /usr/local/include/pcap/pcap.h
diff /usr/local/include/pcap/pcap.h /usr/include/pcap/pcap.h

If the file does not exist, can you please delete your wireshark build directory, download the 1.8.3 sources again and to build it from scratch?

(09 Nov '12, 17:55) Kurt Knochner ♦

Thanks, Kurt. After several operations, I dont have a dir named /usr/local/include/pcap and the error becomes "/usr/include/pcap/pcap.h:327:13: note: previous declaration of ‘pcap_datalink_val_to_name’ was here " So seems I need to delete the wireshark build directory as you suggested. I think it makes sense coz before I build wireshark 1.8.3 I installed wireshark 1.6.2 and then I remove it from the package manager. I highly doute that I do not completely clean the old version. So could you tell me the complete command to delete wireshark build directory? thanks

(11 Nov '12, 14:51) geneopenflow

So could you tell me the complete command to delete wireshark build directory?

well, I suggest to delete the whole source tree and start from scratch. If you extracted the source to /soft/wireshark run the following command to delete everything.

rm -rf /soft/wireshark

Then extract the source again to /soft/wireshark and run

/autogen.sh
./configure
make

(11 Nov '12, 15:30) Kurt Knochner ♦

thanks kurt. I did so, the same problems: capture-pcap-util.c:274:1: error: static declaration of ‘pcap_datalink_name_to_val’ follows non-static declaration /usr/include/pcap/pcap.h:326:5: note: previous declaration of ‘pcap_datalink_name_to_val’ was here capture-pcap-util.c:289:1: error: static declaration of ‘pcap_datalink_val_to_name’ follows non-static declaration /usr/include/pcap/pcap.h:327:13: note: previous declaration of ‘pcap_datalink_val_to_name’ was here

(11 Nov '12, 22:58) geneopenflow

Hm.. strange thing, and I have no good idea.

Let's try the brute force method. Please post the output of the following commands:

find / -name pcap.h | xargs md5sum
md5sum capture-pcap-util.c

(12 Nov '12, 23:58) Kurt Knochner ♦
showing 5 of 8 show 3 more comments

You forgot to configure your build on your platform. The offending routine is protected by HAVE_PCAP_DATALINK_NAME_TO_VAL, which should be setup by configure.

permanent link

answered 08 Nov '12, 23:29

Jaap's gravatar image

Jaap ♦
11.7k16101
accept rate: 14%

I did run ./autogen.sh and ./configure before make. anything else I need to configure? thanks

(09 Nov '12, 14:02) geneopenflow
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1,620
×52

question asked: 08 Nov '12, 20:45

question was seen: 12,824 times

last updated: 12 Nov '12, 23:58

p​o​w​e​r​e​d by O​S​Q​A