open failed: No such file or directory
I have built a standalone executable which references my .so object. both are in the same directory. when I try to run executable it gives 开发者_运维百科me the following error:
ld.so.1: myExec: fatal: libMine.so: open failed: No such file or directory
what am I doing wrong?
Unix systems don't look in the current directory for .so files automatically.
You can get around this for development by setting LD_LIBRARY_PATH
, but during the normal installation they should be installed in the appropriate place on the system.
See also why you shouldn't make your users use LD_LIBRARY_PATH
Yes, as Alok says, the lib load path doesn't have the directory in which the .so is contained. Not even the current working directory is assumed; it must be explicitly listed in LD_LIBRARY_PATH
.
Try executing the following line before running your application:
export LD_LIBRARY_PATH=.
精彩评论