問題:eclipse 下編寫hello world 程序(代碼簡單,此處不貼出),交叉編譯生成可執(zhí)行文件hello,
? ? ? ? ? 放入開發(fā)板? 輸入? ./hello? ? 結(jié)果輸出:-bash: ./hello: No such file or directory
解決:1.chmod +x hello? 并不能解決問題!?。。?!
? ? ? ? ? ?2.在可執(zhí)行文件目錄下輸入readelf? -a? hello? ??會(huì)輸出很多信息

? ? ? ? ? ? ? 其中會(huì)有以下這條信息:

? ? ? ? ? ? ? 然而在開發(fā)板的/lib 目錄下并沒有l(wèi)d-linux.so.3 文件存在。卻有l(wèi)d-linux-armhf.so.3文件存在
輸入ls -l?

發(fā)現(xiàn)ld-linux-armhf.so.3是一個(gè)鏈接符號(hào),指向 arm-linux-gnueabihf/ld-2.15.so。百度一下得知ld-linux.so.3也是一個(gè)鏈接符號(hào),于是 將ld-linux.so.3也鏈接到arm-linux-gnueabihf/ld-2.15.so? ? 輸入ln -s arm-linux-gnueabihf/ld-2.15.so ld-linux.so.3 , 再輸入ls -l ,輸出如下結(jié)果:

再次運(yùn)行 ./hello? , 成功?。。?!

相關(guān)理論參考共享函數(shù)庫、動(dòng)態(tài)鏈接庫、靜態(tài)鏈接庫?Linux動(dòng)態(tài)鏈接庫.so文件的創(chuàng)建與使用 - Jamie - 博客園