tags: linux ubuntu server Telecommunication
1. Introduction
The libpcap library is installed on the x86-based Ubuntu. The predecessors have written very clearly. For details, please refer to:
as well as
If you need any dependency packages during the installation process, just apt-get install xxx related packages directly.
This article mainly introduces how to transplant libpcap library to arm platform to realize the function of grabbing network packets on arm architecture.
2. Start transplanting
Many porting libpcap library to arm on the Internet are all old versions such as libpcap-1.0.0, which have little reference value. This article transplants the latest version of libpcap-1.9.1, I hope it will be used for future reference.
A. Download and unzip
(1) Go to the official websitehttp://www.tcpdump.org/Download libpcap library, pay attention to download libpcap, not download tcpdump library.
(2) Unzip: tart -xvzf libpcap-1.9.1.tar.gz; then enter the libpcap-1.9.1 directory.
(3) There is no Makefile in the libpcap-1.9.1 directory. First, you need to configure it to generate a Makefile.
Enter the command: ./configure --host=arm-linux-gnueabihf --build=i686-pc-linux
In this instruction, the --build=i686-pc-linux part is for 64-bit Linux, and this parameter can be omitted.
(4) Under normal circumstances, a Makefile will be generated.
B. Modify the Makefile
(1) Open Makefile and change the value of prefix to the installation path of your cross-compiler. My installation path is:

The cross compiler installed by CC compiler (I installed arm-linux-gnueabihf-gcc):

Note: The Makefile file may have permission problems and cannot be modified, so you need to chmod 777 Makefile to change the Makefile permissions.
(2) After the Makefile is modified, make it first, and then make install.

Done appears, indicating that the installation is successful.
C. Copy of link library
If the libpacp library is successfully installed, libpcap.a and libpcap.so.1.9.1 will be generated. Copy these generated libraries to the root directory /usr/local/lib/ directory:

Because, when arm-linux-gnueabihf-gcc is compiling, it will first search for the corresponding library in the /usr/local/lib directory.
D. Code compilation
In your code.c directory, enter the command (if you did not write the Makefile yourself):
arm-linux-gnueabihf-gcc test.c -o test -lpcap
Can generate executable files for arm architecture:

The test is the executable file of the arm platform:

Hello there! Here is the kite blog, Welcome to communicate with me. FFmpeg is an open source and free cross-platform video and audio streaming solution. It belongs to free software and uses the LGPL o...
First use ifconfig to query the network card of the machine, and then modify it in the main function The enp9s0 here is what we need...
xz -d Python-2.7.3.tar.xz tar xvf Python-2.7.3.tar Compile HOST version interpreter Compiling the embedded version of Python requires the interpreter to parse the setup.py to compile the Python module...
Install libpcap Reference blog: The official website to download the libpacp compression package, the official website address:Click Download the current latest version shown in the image: Unzip libpc...
Because of research, it is necessary to port opencv under Linux to use with qt, andOpencv is transplanted on the arm side. Since I encountered many problems in the process of operation, and solved the...
Because the board used is ZLG's imx280a, the Ubuntu I installed directly used them. System environment:VM-Ubuntu-12.04-64bit-zlg (this doesn’t matter, I installed it directly with the official Z...
Reference article: SDL (Simple DirectMedia Layer) is a free cross-platform multimedia development kit suitable for games, game SDKs, presentation software, emulators, MPEG players and othe...
In project (1), we successfully captured the data packet and extracted the basic information in the data packet. This time we will output the various protocols used by the data packet and output the m...
First introduce the usage of libpcap library functions: Here I use two functions, pcap_open_live () and pcap_next (), you can jump through the portal to see the specific usage. The comments in the cod...
In project three, we completed the parsing of a package in the "hospital mirror stream.pcapng" file. The next thing we need to do is to write the parsed data into the file, so that the TS st...