最近在学习libevent,记录一下安装过程,方便日后查看。
首先,安装openssl
1.下载openssl源码: /source/index.html (openssl.org)
wget https://www.openssl.org/source/openssl-1.1.1l.tar.gz
2.解压
tar -zxvf openssl-1.1.1l.tar.gz
cd openssl-1.1.1l/
3.编译安装
./config
make -j16
sudo make install
然后,安装libevent
1.到官网找到最新版本并下载 :libevent
wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
2.解压
tar -zxvf libevent-2.1.12-stable.tar.gz
cd libevent-2.1.12-stable/
3.编译安装
mkdir build
cd build
cmake ..
make -j16
sudo make install
至此安装完成
CmakeList中加入:
target_link_libraries(TestInstall event)
编译过程中出现错误:找不到共享库文件
这是因为默认安装到了/usr/local/bin
需要手动拷贝到/usr/bin
sudo cp /usr/local/lib/libevent-2.1.so.7 /usr/lib
Over!