Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
1  
I get source code needs libpcap. It uses libpcap to capture network packets. –  SuB Sep 20 '13 at 18:25

4 Answers 4

up vote 11 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). –  Guy Harris 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
2  
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    
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!!!

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

I try and install it on Ubuntu 14.04 "Trusty Tahr" trough the method suggested by Wajid and Jos, but it is better to check first the final release into the tcpdump release, then choose what you need, and install it in the way he suggested. Of course replace the release with the wished one.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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