【SystemTap】c獨立安裝elfutils導致錯誤 cannot load ld backend library ‘libld_elf_x86_64.so’ 和 erro

來源:互聯網
上載者:User

情境:

        運行程式時出現了一系列的錯誤,例如:

(1)編譯核心執行命令 make menuconfig 命令時出現如下錯誤:

/usr/local/bin/ld: cannot load ld backend library 'libld_elf_x86_64.so':
libld_elf_x86_64.so: cannot open shared object file: No such file or directory

/usr/local/bin/ld: cannot load ld backend library 'libld_elf_x86_64.so': libld_elf_x86_64.so: 無法開啟共用對象檔案: 沒有那個檔案或目錄

(2)執行 systemtap下的 ./configure 出現如下錯誤

checking for C compiler default output file name...
configure: error: in `/local/zkl/systemtap-1.1':
configure: error: C compiler cannot create executables
See `config.log' for more details.

{

      我查看 config.log 檔案,搜尋 " C compiler default output file name ",發現以下幾行

         configure:2913: checking for C compiler default output file name
         configure:2935: gcc    conftest.c  >&5
         /usr/local/bin/ld: cannot load ld backend library 'libld_elf_x86_64.so': libld_elf_x86_64.so: cannot open shared  object file: No such file or directory

}

兩個錯誤實際上都是  'libld_elf_x86_64.so' 造成的。

 

原因分析:

獨立安裝 elfutils-0.137 後導致的一系列致命錯誤:

錯誤描述

回想我的操作,可能是因為我安裝 elfutils-0.137  的緣故,因為SystemTap需要elfutils支援,所以我下載了 elfutils-0.137,解壓後執行了:./configure,make,make install 進行安裝,然後就出現了這一系列莫名奇妙的錯誤。libld_elf_x86_64.so 應該是elfutils的庫,最開始也不知道是elfutils導致的問題。

 

網上找了好久,終於在下面的一個網站中找到了眉目: http://permalink.gmane.org/gmane.linux.systemtap/16482

它描述原因是:

The error was because I had "make install" the downloaded elfutils, which subsequently installed "ld" and "ar" into /usr/local/bin, and these latter binaries are not working properly.   But as systemtap just need the source of elfutils, it is not need to "make install" for the elfutils.

download elfutils sources, untar into some directory, then configure systemtap with --with-elfutils=THE_ELFUTILS_SOURCE_DIRECTORY/.

 

原來是因為make install 安裝elfutils產生的庫不能正常工作,systemtap的安裝僅僅是需要elfutils源碼(執行 ./configure --with-elfutils=THE_ELFUTILS_SOURCE_DIRECTORY ),而不是首先 make install 安裝 elfutils

 

因此,歸結為,獨立安裝 elfutils-0.137 導致了錯誤: /usr/local/bin/ld: cannot load ld backend library 'libld_elf_x86_64.so': libld_elf_x86_64.so: cannot open shared object file: No     such file or directory。應該是執行ld命令檢查庫依賴時出現了問題,

 

解決辦法:

進入 elfutils-0.137 目錄,按以下順序執行命令卸載 elfutils,
make uninstall;
make distclean;

注意執行這些命令都需要Makefile檔案,而elfutils是通過 ./configure 產生Makefile檔案,因此若發現沒有makefile檔案,則需要在一台沒有問題的機器上執行 ./configure 命令產生 Makefile 檔案,然後再拷貝過來,再對 elfutils 進行卸載。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.