解決'GLIBC_2.14' not found問題時遇到的坑

來源:互聯網
上載者:User

最近用到c++11需要升級glibc庫。

網上有很多解決'GLIBC_2.14' not found問題的文章。

無非就是如下的一些操作命令:

1. glibc下載 從http://www.gnu.org/software/libc/ 下載原始碼。我下載的版本是2.14,連結地址是http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz。 2. 安裝 具體步驟如下:

[root@localhost ~]# tar zxvf glibc-2.14.tar.gz -C /home/software/[root@localhost ~]# cd /home/software/glibc-2.14[root@localhost glibc-2.14]# mkdir /opt/build[root@localhost glibc-2.14]# cd build[root@localhost build]# ../configure --prefix=/opt/glibc-2.14[root@localhost build]# make -j4[root@localhost build]# make install
如果沒有碰到坑,那麼恭喜你已經完成了安裝,後續也就是庫環境設定了。

下面先說一下遇到的坑:

1、在make過程中出現如下錯誤:

/usr/bin/install: `include/limits.h' and `/opt/glibc-2.14/include/limits.h' are the same file


在經過google後,不太理解相關文章的含義,後來自行修鍊後,明白了。

原因就是樓主解壓的glic-2.14.tar.gz源碼和編譯時間定義的目錄../configure --prefix=/home/software/glibc-2.14放到了一起。

所以解決方案就是:

tar zxvf glibc-2.14.tar.gz -C /home/software/
../configure --prefix=/opt/glibc-2.14

只要將編譯定義目錄和源碼目錄區分開就ok了。



2、在make install過程中出現如下錯誤:

Can't open configuration file /opt/glibc-2.14/etc/ld.so.conf: No such file or directory


就是缺少了必要的編譯檔案ld.so.conf。通過find命令找到對應的檔案位置。

[root@localhost build]# find / -name "ld.so.conf"/etc/ld.so.conf


然後我們執行命令把此檔案拷貝到對應的檔案目錄下去,然後繼續編譯。

[root@localhost build]# cp /etc/ld.so.conf /opt/glibc-2.14/etc/[root@localhost build]# make install

Congratulations。 編譯成功。


最後就是設定環境變數,因為glibc庫使用廣泛,為了避免汙染當前系統內容,在使用時候定義一下環境變數。

執行命令

[root@localhost ~]# export LD_LIBRARY_PATH=/opt/glibc-2.14/lib:$LD_LIBRARY_PATH

將庫的位置臨時定位在/opt/glibc-2.14/lib位置。

此時再執行相關程式即可順利運行。



聯繫我們

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