[英]Program cannot load shared library GCC
First things first, here is the error message: ./Game: error while loading shared libraries: libEngine.so: cannot open shared object file: No such file or directory
首先,这是错误消息:
./Game: error while loading shared libraries: libEngine.so: cannot open shared object file: No such file or directory
There was no problems while compiling.编译时没有问题。
Library directories passed to GCC while compiling Game: -L../../bin -L.
编译游戏时传递给 GCC 的库目录:
-L../../bin -L.
Directory tree: ENGINE -bin --Game (executable) --libEngine.so -Game --src ---source code + Game makefile -Engine --src ---source code + shared library makefile
I can provide more info on demand.目录树:
ENGINE -bin --Game (executable) --libEngine.so -Game --src ---source code + Game makefile -Engine --src ---source code + shared library makefile
我可以提供更多信息要求。
Setting LD_LIBRARY_PATH
is a possible, but usually not the best solution.设置
LD_LIBRARY_PATH
是可能的,但通常不是最佳解决方案。 In particular, dependence on environment produces programs which work for you, but not for your coworkers or your professor (because their environment is different).特别是,对环境的依赖会产生适合您的程序,但不适用于您的同事或您的教授(因为他们的环境不同)。
Adding -rpath=/path/to/bin
to the link line eliminates the need to muck with environment.将
-rpath=/path/to/bin
添加到链接行消除了对环境的影响。
Even better: -rpath='$ORIGIN'
lets you move the entire installation directory to a different place, and the program will still find its shared libraries in its own bin/
directory.更好的是:
-rpath='$ORIGIN'
让您可以将整个安装目录移动到不同的位置,并且程序仍将在其自己的bin/
目录中找到其共享库。
Future me, I have found the problem and solved.未来的我,我找到了问题并解决了。 I am writing this to other people that may encountered this problem I solved it by simply adding a library path: You can learn more about it here:
我正在写这个给其他可能遇到这个问题的人我通过简单地添加一个库路径来解决它:你可以在这里了解更多信息:
https://serverfault.com/questions/279068/cant-find-so-in-the-same-directory-as-the-executable?newreg=69e521ef03144cab96110a29a03ff339 https://serverfault.com/questions/279068/cant-find-so-in-the-same-directory-as-the-executable?newreg=69e521ef03144cab96110a29a03ff339
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.