當我使用ldd查找Drcom所缺少的32為庫的時候提示not a dynamic executable
最后網上找到答案
來自http://forum.ubuntu.org.cn/viewtopic.php?t=462532
內容如下
DrCOM linux 版
DrClient linux 版
一個32位的可執行文件DrClientLinux, 在我的64位系統上無法運行.
代碼:
$ ./DrClientLinux
-bash: ./DrClientLinux: No such file or directory
-bash: ./DrClientLinux: No such file or directory
代碼:
$ ldd DrClientLinux
not a dynamic executable
not a dynamic executable
本來想把這個文件缺少的32動態連接庫都裝齊,但是這ldd無法顯示, ldd是看這個可執行二進制文件依賴依賴哪些動態鏈接庫的。
網上找到答案:
代碼:
$ readelf -l DrClientLinux | grep ld-linux
[Requesting program interpreter: /lib/ld-linux.so.2]
[Requesting program interpreter: /lib/ld-linux.so.2]
附上readelf的使用
readelf命令是Linux下的分析ELF文件的命令,這個命令在分析ELF文件格式時非常有用,下面以ELF格式可執行文件test為例詳細介紹: readelf -v 顯示版本 readelf -h 顯示幫助 readelf -a test 顯示test的全部信息 readelf -h test 顯示test的ELF Header的文件頭信息(就是ELF文件開始的前52個字節) readelf -l test 顯示test的Program Header Table中的每個Prgram Header Entry的信息(如果有) readelf -S test 顯示test的Section Header Table中的每個Section Header Entry的信息(如果有) readelf -g test 顯示test的Section Group的信息(如果有) readelf -s test 顯示test的Symbol Table中的每個Symbol Table Entry的信息(如果有) readelf -e test 顯示test的全部頭信息(包括ELF Header,Section Header和Program Header,等同與 readelf -h -l -S test) readelf -n test 顯示test的note段的信息(如果有) readelf -r test 顯示test中的可重定位段的信息(如果有) readelf -d test 顯示test中的Dynamic Section的信息(如果有) readelf -V test 顯示test中的GNU Version段信息(如果有) 其實上述的命令只是把ELF文件格式的不同部分輸出而已,只要了解ELF文件格式后這些命令就不難了啦~~
找了一下,
代碼:
$ locate ld-linux.so.2
沒有返回
再找
代碼:
$ locate ld-linux
/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
/lib64/ld-linux-x86-64.so.2
/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
/lib64/ld-linux-x86-64.so.2
所以知道缺少32位版本,於是
代碼:
$ sudo apt-get install libstdc++6:i386
再次找ld-linux
代碼:
$ sudo updatedb
$ locate ld-linux.so.2
/lib/ld-linux.so.2
/lib/i386-linux-gnu/ld-linux.so.2
$ locate ld-linux.so.2
/lib/ld-linux.so.2
/lib/i386-linux-gnu/ld-linux.so.2
再次對它ldd
代碼:
$ ldd DrClientLinux
linux-gate.so.1 => not found
libSM.so.6 => not found
libICE.so.6 => not found
libXi.so.6 => not found
libXrender.so.1 => not found
libXrandr.so.2 => not found
libXcursor.so.1 => not found
libXinerama.so.1 => not found
libfreetype.so.6 => not found
....
linux-gate.so.1 => not found
libSM.so.6 => not found
libICE.so.6 => not found
libXi.so.6 => not found
libXrender.so.1 => not found
libXrandr.so.2 => not found
libXcursor.so.1 => not found
libXinerama.so.1 => not found
libfreetype.so.6 => not found
....
返回的就是它需要的動態鏈接庫了, 找到其中not found的項, 如
代碼:
libSM.so.6 => not found
.
使用命令安裝:
代碼:
$ sudo apt-get install libSM6:i386
可以發現, 安裝的包的名字由缺少的庫的 名字+版本+:+類型 決定的, 如 libfreetype.so.6 對應的包就是 libfreetype6:i386
就是這樣把所有not found的庫都裝上, 這樣這個二進制程序應該就可以使用了.
對於我這個程序, 執行完下面的命令就會看到登錄窗口了.
代碼:
./DrClientLinux