libevent庫移植

Libevent 是一個用C語言編寫的、輕量級的開源高性能事件通知庫,主要有以下幾個亮點:事件驅動( event-driven),高性能;輕量級,專注於網絡,源代碼相當精煉、易讀;跨平臺,支持 Windows、 Linux、 *BSD 和 Mac Os;支持多種 I/O 多路複用技術, epoll、 poll、 dev/poll、 select 和 kqueue 等;支持 I/O,定時器和信號等事件;註冊事件優先級。
Libevent 已經被廣泛的應用,作爲底層的網絡庫。

我也是在工作中接觸libevent庫,發現該庫作爲底層的網絡庫,用起來非常方便。

先說一下libevent庫的移植,該庫的移植還是非常簡單的。

  1. 解壓源文件
    tar -xvf libevent-2.1.8-stable.tar
    百度雲鏈接:https://pan.baidu.com/s/1S-Jqmzy6SPuwiWeMYUYb_g
    提取碼: akzn

  2. 目錄下是有configure文件的,直接運行
    ./configure

  3. 直接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文件並不是根據本地的環境來配置的,缺少一些必備的東西。

  4. 重新安裝autoconfig 工具,裝載此庫以來的必備文件
    autoreconf --install

  5. 重新生成configure文件
    autoconf configure.ac

  6. ./configure

  7. make

  8. make install

至此,libevent庫已經移植成功。

發佈了29 篇原創文章 · 獲贊 8 · 訪問量 7301
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章