linux中編譯安裝log4cpp

來源:互聯網
上載者:User

介紹

    log4cpp是個基於LGPL的開源項目,是基於優秀的Tlog跟蹤項目Java語言的log4j移植過來的。log4j介紹的文檔很多,在java領域使用的也比較廣泛,而這個功能強大的庫對國內的C++語言開發人員卻使用的不多。

安裝、編譯


1、網站上下載了 log4cpp-1.0.tar.gz,然後將其解包到 /usr/local/ 裡面。configure檔案裡面預設它在/usr/local裡配置,可以通過--prefix=<location>來修改位置,這個我沒試過。

    :http://sourceforge.net/projects/log4cpp/

2、進入到log4cpp-1.0檔案夾中,運行configure檔案。

     [root@localhost log4cpp-1.0]#./configure

3、如果現在make的話,會有兩個錯誤,這個是源檔案的bug【bug 217755】。要修改log4cpp-1.0\src中的兩個cpp檔案:BasicLayout.cpp和PatternLayout.cpp。

BasicLayout.cpp(Line 18):增加一句代碼:#include <memory>

PatternLayout.cpp(LIne 373):修改minWidth類型:abs((float)minWidth) 

參見bug 217755 http://bugs.gentoo.org/attachment.cgi?id=149763&action=diff

4、修改完畢後,返回log4cpp-1.0,進行make操作,

      [root@localhost log4cpp-1.0]#make

5、[root@localhost log4cpp-1.0]#make check
6、[root@localhost log4cpp-1.0]#make install
安裝完畢後,會在 /usr/local/ 裡的include和lib檔案夾裡面看到了log4cpp的標頭檔和庫檔案。


總結:
編譯安裝過程,歸結起來其實只需要依次輸入四個命令:

[root@localhost log4cpp-1.0]#./configure
[root@localhost log4cpp-1.0]#make

[root@localhost log4cpp-1.0]#make check
[root@localhost log4cpp-1.0]#make install

但是源檔案有兩處bug,所以需要修改。
具體的說明可以查看log4cpp-1.0\doc\html\index檔案(這裡並沒有提到修改bug的事情)。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.