linux下使用libevent開發遇到的齷齪問題

2021-05-22 18:29:55 字數 2742 閱讀 1646

按照網上例子搞了個httpd的小demo(linvo_httpd.c),遇到一連串問題,努力google了半天,終於得解,記錄之~

環境:linux 2.6.18-164.el5

libevent-1.4.13

首先用gcc編譯時候報了類似下面資訊的一堆錯

應該是找不到編譯後的libevent庫檔案所導致,可能是路徑問題

這次在編譯時加上了-levent引數後(讓其到系統庫中找event庫),順利編譯通過

./linvo_httpd執行之~ 我擦,又來。。。。

依然是路徑問題找不到檔案

whereis libevent看下我的libevent預設裝到**了

libevent: /usr/local/lib/libevent.la /usr/local/lib/libevent.so /usr/local/lib/libevent.a

哦~在/usr/local/lib/目錄下

ld_debug=libs ./linvo_httpd -v看下demo程式究竟是到**去找的該檔案 

32372:     find library=libevent-1.4.so.2 [0]; searching

32372:      search cache=/etc/ld.so.cache

32372:      search path=/lib/tls/i686/sse2:/lib/tls/i686:/lib/tls/sse2:/lib/tls:/lib/i686/sse2:/lib/i686:/lib/sse2:/lib:/usr/lib/tls/i686/sse2:/usr/lib/tls/i686:/usr/lib/tls/sse2:/usr/lib/tls:/usr/lib/i686/sse2:/usr/lib/i686:/usr/lib/sse2:/usr/lib        (system search path)

32372:       trying file=/lib/tls/i686/sse2/libevent-1.4.so.2

32372:       trying file=/lib/tls/i686/libevent-1.4.so.2

32372:       trying file=/lib/tls/sse2/libevent-1.4.so.2

32372:       trying file=/lib/tls/libevent-1.4.so.2

32372:       trying file=/lib/i686/sse2/libevent-1.4.so.2

32372:       trying file=/lib/i686/libevent-1.4.so.2

32372:       trying file=/lib/sse2/libevent-1.4.so.2

32372:       trying file=/lib/libevent-1.4.so.2

32372:       trying file=/usr/lib/tls/i686/sse2/libevent-1.4.so.2

32372:       trying file=/usr/lib/tls/i686/libevent-1.4.so.2

32372:       trying file=/usr/lib/tls/sse2/libevent-1.4.so.2

32372:       trying file=/usr/lib/tls/libevent-1.4.so.2

32372:       trying file=/usr/lib/i686/sse2/libevent-1.4.so.2

32372:       trying file=/usr/lib/i686/libevent-1.4.so.2

32372:       trying file=/usr/lib/sse2/libevent-1.4.so.2

32372:       trying file=/usr/lib/libevent-1.4.so.2

32372:

我勒個去~找了這麼多地方,就是沒到libevent應該在的目錄中去找- -!

做個鏈結吧

ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib/libevent-1.4.so.2

這下歐了-.-

ps:我嘗試加上--prefix=/usr/lib/把libevent重新編安裝到指定目錄,貌似無效。。。。why???

windows下編譯及使用libevent

libevent官網 windows 7下編譯 編譯環境 windows 7 vs2010 1 解壓libevent到f libevent libevent 2.0.21 stable 2 開啟microsoft visual studio 2010命令列工具 3 修改以下三個檔案,新增巨集定義 在...

windows下編譯及使用libevent

libevent官網 windows 7下編譯 編譯環境 windows 7 vs2010 1 解壓libevent到f libevent libevent 2.0.21 stable 2 開啟microsoft visual studio 2010命令列工具 3 修改以下三個檔案,新增巨集定義 在...

Mac下安裝libeven和memcached

網上進行關聯的命令是sudo ln s usr local openssl bin openssl usr bin openssl 而查詢我安裝的位置是ssl,所以命令改為 sudo ln s usr local ssl bin openssl usr bin openssl 重新安裝memcach...