So whenever you'll code something (especially libpcap -based ones) on these platforms, all you can do is to install libpcap library because it has the compatible header file bpf.h. Just copy the
pcap-bpf.h from libpcap and rename it as bpf.h , and your good to go:
It is useful when you get progy written from BSD systems that includes the header /usr/include/net/bpf.h file and build it in a non-BSD system that doesnt support bpf by default.Solution:
1. Install the libpcap library
Download the latest libpcap from here and extract to your own folder.
Note: Read the INSTALL.txt for instruction:
a) ./configure
By default, there is no flex/bison installed, so use the Synaptic Manager (easier way) to get and install flex/bison. They're required in building the libpcap.
Or by using the apt-get:
sudo apt-get install flex
sudo apt-get install bison
b) make
c) make install
2. copy the file:
cp /usr/include/pcap-bpf.h /usr/include/net/bpf.h
Change the path accordingly if needed.3. you can now build your libpcap progy.
Note: If this is the first time you would compile/build libpcap or any C/C++ program in Ubuntu, you probably need to setup/install most of the needed stuff in development, like include files, compiler,etc. Heres how:
Install Linux source:
~$ sudo apt-get install linux-tree
Install Linux headers:
~$ sudo apt-get install linux-headers-'uname -r'
Install C/C++ builder:
~$ sudo apt-get install build-essential
Install Kernel source:
~$ sudo apt-get install linux-source
You can also install your favorite IDE, like GEdit,KDevelop, or the old school vi/vim.
Cheers!
No comments:
Post a Comment