%20%E6%AA%94%E6%A1%88%E6%90%9C%E5%B0%8B%E8%B7%AF%E5%BE%91.png)
載入共享物件檔案時搜尋的路徑順序是什麼?
我正在嘗試運行一個嘗試加載共享對象文件的可執行檔。共享對象文件可以在 中找到/usr/lib/x86_64-linux-gnu/
。
我有兩個用戶,我們稱他們為user1
和user2
。user1
可以運行可執行檔但user2
遇到錯誤:無法開啟共享物件檔案:libicuuc.so
兩個使用者都有相同的LD_LIBRARY_PATH
.缺什麼?
答案1
手動配置可能會幫助你
/etc/ld.so.cache File containing an ordered list of libraries found
in the directories specified in /etc/ld.so.conf, as
well as those found in /lib and /usr/lib.
但您的發行版可能包含除我之外的其他信息,因此您應該閱讀您的發行版。
決定哪些/哪些庫綁定到可執行檔的另一種方法是使用LDD程式範例:
ldd /bin/echo
linux-vdso.so.1 => (0x00007ffc2277a000)
libc.so.6 => /lib64/libc.so.6 (0x0000003edc200000)
/lib64/ld-linux-x86-64.so.2 (0x0000003edbe00000)