Linux error while loading shared libraries: cannot open shared object file: No such file or director

Your library is a dynamic library. You need to tell the operating system where it can locate it at runtime.

To do so, we will need to do those easy steps:

(1 ) Find where the library is placed if you don't know it.

sudo find / -name the_name_of_the_file.so

(2) Check for the existence of the dynamic library path environment variable(LD_LIBRARY_PATH)

$ echo $LD_LIBRARY_PATH

if there is nothing to be displayed, add a default path value (or not if you wish to)

$ LD_LIBRARY_PATH=动态库所在的path

(3) We add the desire path, export it and try the application.

Note that the path should be the directory where the path.so.something is. So if path.so.something is in /my_library/path.so.something it should be :

$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/my_library/
$ export LD_LIBRARY_PATH
$ ./my_app

这样的话只会在当前有效,如果重启电脑,会失效,最好的办法是写进bashrc里面

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
This error message usually appears when a program is unable to find a required shared library file. This can happen for a variety of reasons, such as: - The library file is missing or has been deleted. - The library file is located in a different directory than the one the program is looking in. - The program does not have permission to access the library file. To fix this error, you can try the following steps: 1. Check if the required library file is installed on your system. You can do this by running the following command in the terminal: ``` $ sudo ldconfig -p | grep <library_name> ``` Replace `<library_name>` with the name of the library file that the program is looking for. If the library file is not listed, you may need to install it using your system's package manager. 2. Check if the library file is located in the correct directory. Shared library files are typically located in `/usr/lib` or `/usr/local/lib`. You can check if the file is in one of these directories by running the following command in the terminal: ``` $ find /usr/lib -name <library_name> ``` Replace `<library_name>` with the name of the library file. If the file is not in the correct directory, you may need to move it to the correct location. 3. Check if the program has permission to access the library file. Make sure that the file permissions are set correctly and that the program has the necessary permissions to access the file. If none of these steps work, you may need to reinstall the program or the library file.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值