简体   繁体   English

在Iinux OS(定制板)上运行的应用程序不会从导出的LD_LIBRARY_PATH中读取共享库

[英]Application running on Iinux OS (custom board) does not reads the shared libraries from the exported LD_LIBRARY_PATH

I am trying to run an application ( a.out ), very small application contains only one print statement) on Linux OS custom board which is not having the shared libs in /lib or /usr/lib . 我正在尝试在Linux OS定制板上运行一个应用程序( a.out ,一个非常小的应用程序仅包含一个打印语句),而该Linux OS定制板上在/lib/usr/lib没有共享库。

So I am exporting the shared libs path using LD_LIBRARY_PATH 所以我正在使用LD_LIBRARY_PATH导出共享库路径

export LD_LIBRARY_PATH=/media/opensourcelib/toolchainLib/ramfslib

I made sure, shared libraries are in this path /media/opensourcelib/toolchainLib/ramfslib 我确定共享库在此路径中/media/opensourcelib/toolchainLib/ramfslib

Still, after this, when I execute a.out I get the error 仍然,在此之后,当我执行a.out我得到了错误

/bin/sh: ./../usr/lib/a.out: not found

If I copy my shared libs to /lib , the application works fine. 如果我将共享库复制到/lib ,则该应用程序可以正常运行。

But I need to make it work without copying the shared libs. 但是我需要使其工作而不复制共享库。 Please help me, what could be the issue in exporting LD_LIBRARY_PATH . 请帮助我,导出LD_LIBRARY_PATH可能是什么问题。

I would do the following things: 我会做以下事情:

  1. Check that the path is correct. 检查路径是否正确。 Maybe an uppercase or lowercase letter or any other misspelling mistake. 可能是大写或小写字母或任何其他拼写错误。 Try ls /media/opensourcelib/toolchainLib/ramfslib , before any other thing, and check that the library is there. 在进行任何其他操作之前,请先尝试ls /media/opensourcelib/toolchainLib/ramfslib ,然后检查该库是否存在。
  2. Check that the necessary soft links exist into the path for the LD_LIBRARY_PATH. 检查LD_LIBRARY_PATH的路径中是否存在必要的软链接。 This is one of the things that do ldconfig . 这是执行ldconfig的事情之一。 Maybe for your libmylib.so.1.5.8 you will find the links libmylib.so.1.5 , libmylib.so.1 and libmylib.so . 也许对于您的libmylib.so.1.5.8您会找到链接libmylib.so.1.5libmylib.so.1libmylib.so
  3. Check the library dependencies with ldd a.out . 使用ldd a.out检查库依赖关系。
  4. If you have strace installed into the system (if not, I recommend to compile it for your board and copy it to your board), try to launch it exporting previously LD_LIBRARY_PATH and verify the paths are tried to read (and a many other things). 如果您已将strace安装到系统中(如果未安装,则建议为您的开发板进行编译并将其复制到您的开发板中),尝试导出以前的LD_LIBRARY_PATH来启动它,并验证是否尝试读取路径(以及许多其他操作) 。

I hope it could be helpful. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM