Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
What are you trying to do with libpcap? – Braiam Sep 20 '13 at 17:27
I get source code needs libpcap. It uses libpcap to capture network packets. – SuB Sep 20 '13 at 18:25
up vote 19 down vote accepted

Use this:

sudo apt-get install libpcap-dev
share|improve this answer
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). – user126192 Sep 20 '13 at 18:34

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

sudo apt-get install libpcap0.8 libpcap0.8-dev libpcap-dev
share|improve this answer
According to Ubuntu Packages 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

to install libpcap. try these commands

cd /usr
mkdir nembuild
cd nembuild    
tar -xf libpcap-1.5.3.tar.gz
cd libpcap-1.5.3
make && make install


share|improve this answer
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 4:52
because libpcap 1.5.3 is way better than the version 0.8 available from aptitude – ashgromnies Aug 8 '14 at 16:25
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 5 '14 at 16:15

protected by Sylvain Pineau Feb 27 '15 at 21:48

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.