Libevent 是一个用C语言编写的、轻量级的开源高性能事件通知库,主要有以下几个亮点:事件驱动( event-driven),高性能;轻量级,专注于网络,源代码相当精炼、易读;跨平台,支持 Windows、 Linux、 *BSD 和 Mac Os;支持多种 I/O 多路复用技术, epoll、 poll、 dev/poll、 select 和 kqueue 等;支持 I/O,定时器和信号等事件;注册事件优先级。
Libevent 已经被广泛的应用,作为底层的网络库。
我也是在工作中接触libevent库,发现该库作为底层的网络库,用起来非常方便。
先说一下libevent库的移植,该库的移植还是非常简单的。
-
解压源文件
tar -xvf libevent-2.1.8-stable.tar
百度云链接:https://pan.baidu.com/s/1S-Jqmzy6SPuwiWeMYUYb_g
提取码: akzn -
目录下是有configure文件的,直接运行
./configure -
直接make 提示错误:
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /home/zhoudy/libevent-2.1.8-stable/libevent-2.1.8-stable/missing aclocal-1.15 -I m4
/home/zhoudy/libevent-2.1.8-stable/libevent-2.1.8-stable/missing: 行 81: aclocal-1.15: 未 找到命令
WARNING: ‘aclocal-1.15’ is missing on your system.
You should only need it if you modified ‘acinclude.m4’ or
‘configure.ac’ or m4 files included by ‘configure.ac’.
The ‘aclocal’ program is part of the GNU Automake package:
http://www.gnu.org/software/automake
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
http://www.gnu.org/software/autoconf
http://www.gnu.org/software/m4/
http://www.perl.org/
make: *** [aclocal.m4] 错误 127出现此现象,是由于configure文件并不是根据本地的环境来配置的,缺少一些必备的东西。
-
重新安装autoconfig 工具,装载此库以来的必备文件
autoreconf --install -
重新生成configure文件
autoconf configure.ac -
./configure
-
make
-
make install
至此,libevent库已经移植成功。