36

How can I install libpcap header files on Ubuntu 12.04?

When I use apt-get install libpcap I receive following message:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libpcap
user.dz
  • 47,137
  • 13
  • 140
  • 258
SuB
  • 4,119
  • 5
  • 24
  • 33

3 Answers3

56

Use this:

sudo apt-get install libpcap-dev
oddone
  • 821
  • 1
  • 7
  • 8
  • 2
    That's because 1) libpcap-dev (probably) depends on the libpcap package, and will bring it in and 2) if you have source code that needs libpcap, you not only will need the libpcap package (whatever it's called - its name might be "libpcap0.8", for various Debian reasons), which provides shared libraries for already-built programs that use libpcap, but you will also need the libpcap-dev package, which provides header files needed to compile the source code for programs that use libpcap (and static libraries in case people want them). –  Sep 20 '13 at 18:34
7

to install libpcap. try these commands

cd /usr
mkdir nembuild
cd nembuild    
wget http://www.tcpdump.org/release/libpcap-1.5.3.tar.gz
tar -xf libpcap-1.5.3.tar.gz
cd libpcap-1.5.3
./configure
make && make install

Enjoy!!!

Jos
  • 28,156
  • 8
  • 82
  • 88
Abdul
  • 79
  • 1
  • 1
  • Why install a package while there is a binary (RPM, DEB , ...) package for it? Your method is the most complex way dude! – SuB Apr 20 '14 at 04:52
  • 1
    because libpcap 1.5.3 is way better than the version 0.8 available from aptitude – ashgromnies Aug 08 '14 at 16:25
  • 4
    Aptitude does not use 0.8, it is only the name of a package. Check "apt-cache show libpcap-dev" to see the version used. – Étienne Sep 05 '14 at 16:15
5

To install libpcap open a terminal by pressing Ctrl+Alt+Tand type:

sudo apt-get install libpcap0.8 libpcap0.8-dev libpcap-dev
M.Tarun
  • 4,981
  • 6
  • 33
  • 64
  • 2
    According to [Ubuntu Packages](http://packages.ubuntu.com/precise/libpcap-dev) `libpcap-dev` depends on `libpcap0.8-dev` and itself depends on `libpcap0.8`. So `libpcap0.8` is redundant. – SuB Sep 20 '13 at 10:52