错误而载入共享库 [英] error while loading shared libraries

查看:142
本文介绍了错误而载入共享库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

感谢你们回答我的previous问题上的undefined参考功能。如你所说,这个问题下的原因是没有链接库。现在,我已经生成的可执行文件(。版本的我的g ++和gcc 4.4.5是我使用Ubuntu 10.10)

Thank you guys answering my previous problem on undefined reference to function. As you suggested, the reason under the problem is not linking the libraries. Now I have generated the executable file with: (the version of my g++ and gcc is 4.4.5. I am using Ubuntu 10.10.)

g++ -o ex_addinst  ./ex_addinst.o -L/home/li/work/tools/lindo/lindoapi/bin/linux64 -m64 -llindo64  -lmosek64 -lconsub3 -lc -ldl -lm -lguide -lpthread -lsvml -limf -lirc

不过,说到另一个问题后,当我运行

./ex_addinst

中出现错误:(我不知道我应该开始一个新的问题或没有当前....)

errors appear: (I am not sure I should start a new problem or not currently....)

./ex_addinst: error while loading shared libraries: liblindo64.so.6.0: cannot open shared object file: No such file or directory

但liblindo64.so.6.0的lib〜/ lindoapi /斌/ LINUX64它包含以下文件夹中的文件是否存在:

But liblindo64.so.6.0 exists in the folder of the lib ~/lindoapi/bin/linux64 which contains following files:

libconsub3.so  libirc.so          liblindojni.so        libmosek64.so.5.0  lindo.par
libguide.so    liblindo64.so      liblindojni.so.6.0.3  libsvml.so         placeholder
libimf.so      liblindo64.so.6.0  libmosek64.so         lindoapivars.sh    runlindo

我已经创建liblindo.so.6.0和liblindo.so之间的符号链接:

I have created a symbolic link between liblindo.so.6.0 and liblindo.so:

ln -sf liblindo64.so.6.0 liblindo64.so

有是'-llindo64'是g ++命令,所以我想的 liblindo64.so.6.0 应该已经联系。
我试图-L改变-llib,但于事无补。

There is '-llindo64' is the g++ command, so I thought liblindo64.so.6.0 should have been linked. I have tried to change -L to -Llib, but doesn't help.

谁能告诉我什么是错在这里?谢谢!

Can anyone tell me what is wrong here? Thanks!

推荐答案

您需要具备其中的.so 文件住在运行时链接程序搜索路径的目录。

You need to have the directory where the .so files live in in runtime linker's search path.

您可以做到这一点通过改变 LD_LIBRARY_PATH 环境变量是这样的:

You can do that by changing the LD_LIBRARY_PATH environment variable like this:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$HOME/lindoapi/bin/linux64

开始你的可执行文件之前。

before starting your executable.

这篇关于错误而载入共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆