rrdtool命令錯誤,libpng12.so.0: no version information available

junsansi發表於2011-01-27

執行rrdtool命令時出現錯誤提示如下:

    [root@BKMonitor002 ~]# /usr/local/rrdtool/bin/rrdtool

    /usr/local/rrdtool/bin/rrdtool: /lib/libpng12.so.0: no version information available (required by /usr/local/rrdtool/lib/librrd.so.2)

一開始通過google四處搜尋解決方案,還別說,這類問題還真不好,google一搜就是一大把,而且說什麼的都有。三思先是通過yum安裝的rrdtool 1.2.27版本,看到網上有說要升級rrdtool版本到1.4的,有說要重新編譯安裝高版本libpng/libart_lgpl等依賴包的,有說要通過原始碼編譯方式安裝的,等等吧。可惜,這些方式不給力啊,按照各種說明配置了一下午,嘗試了各種組合,最後我感覺腦袋都編譯暈了,問題還是沒解決~~

這倒不是定是它們說的不靠譜,我感覺主要應該還是實際情況有差異,比如系統版本,依賴包的版本等,當然也有可能是三思沒能試到正確的組合。最終未果的情況下,三思決定來看看這個libpng12.so.0到底是怎麼回事。找一個與之環境類似的伺服器做對比,拿ldd檢視其依賴的動態連結庫究竟有什麼差異,先找了一臺rrdtool工作正常的伺服器,執行命令如下:

    [root@BKMonitor001 ~]# ldd /usr/local/rrdtool/bin/rrdtool
    librrd.so.2 => /usr/local/rrdtool/lib/librrd.so.2 (0x00002adae2f11000)
    libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x0000003b90200000)
    libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x0000003aa6800000)
    libz.so.1 => /usr/lib64/libz.so.1 (0x0000003b8da00000)
    libart_lgpl_2.so.2 => /usr/lib64/libart_lgpl_2.so.2 (0x0000003aace00000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003b8d600000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003b8ca00000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003b8c600000)

而後再到出問題的伺服器上執行相同語句注意了,報錯資訊馬上就要出來了:

    [root@BKMonitor002 ~]# ldd /usr/local/rrdtool/bin/rrdtool
    /usr/local/rrdtool/bin/rrdtool: /lib/libpng12.so.0: no version information available (required by /usr/local/rrdtool/lib/librrd.so.2)
    librrd.so.2 => /usr/local/rrdtool/lib/librrd.so.2 (0x00002b481bdb1000)
    libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x0000003b90200000)
    libpng12.so.0 => /lib/libpng12.so.0 (0x00002b481c013000)
    libz.so.1 => /usr/lib64/libz.so.1 (0x0000003b8da00000)
    libart_lgpl_2.so.2 => /usr/lib64/libart_lgpl_2.so.2 (0x0000003eae800000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003b8d600000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003b8ca00000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003b8c600000)

兩相對比,我cow,libpng12.so.0檔案路徑不一致,連結的實際檔案也不同啊,檢視一下檔案的資訊:

    [root@BKMonitor001 ~]# ll /usr/lib64/libpng12.so.0*
    lrwxrwxrwx 1 root root 18 Nov 30 07:47 /usr/lib64/libpng12.so.0 -> libpng12.so.0.10.0
    -rwxr-xr-x 1 root root 149344 Jul 15 2010 /usr/lib64/libpng12.so.0.10.0

    [root@BKMonitor002 ~]# ll /lib/libpng12.so.0*
    lrwxrwxrwx 1 root root 19 Nov 30 11:28 /lib/libpng12.so.0 -> libpng12.so.0.1.2.8
    -rwxr-xr-x 1 root root 262576 Nov 30 11:28 /lib/libpng12.so.0.1.2.8

libpng12.so.0是個軟連結,兩臺機器上的實際指定檔案也不一樣,看到這種情況,三思下意識的想法是死馬當成活馬醫,直接拿工作正常的機器中libpng12.so.0替換。通過sftp命令在兩臺機器上傳輸檔案,而後覆蓋檔案:

    [root@BKMonitor002 ~]# mv /lib/libpng12.so.0 /lib/libpng12.so.0.bak
    [root@BKMonitor002 ~]# cp /home/jss/libpng12.so.0.10.0 /lib/libpng12.so.0

再次嘗試執行rrdtool

    [root@BKMonitor002 ~]# rrdtool create
    RRDtool 1.2.27 Copyright 1997-2008 by Tobias Oetiker
    Compiled Apr 6 2008 00:00:25

    Usage: rrdtool [options] command command_options

    * create - create a new RRD

    rrdtool create filename [--start|-b start time]
    [--step|-s step]
    [DS:ds-name:DST:dst arguments]
    [RRA:CF:cf arguments]

    RRDtool is distributed under the Terms of the GNU General
    Public License Version 2. (www.gnu.org/copyleft/gpl.html)

    For more information read the RRD manpages

哈哈,錯誤消失,故障解決啦!

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7607759/viewspace-686368/,如需轉載,請註明出處,否則將追究法律責任。

相關文章