在使用libevent时,有时候出现如下问题:“libevent-pthreads-2.1 cannot open shared object file”,如图(1) 所示。
出现这种现象的原因是 libevent 2.1.x 没有安装。
解决方法,安装对应的 libevent 2.1.x 即可。
这里以安装 libevent 2.1.8 为例,进行说明。
1、 下载libevent 2.1.8
libevent 2.1.8 地址:https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
2、安装libevent 2.1.8
在Linux黑框框里,依次输入如下命令即可:
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar -zxvf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./autogen.sh
./configure -prefix=/usr
make
sudo make install