开发者

Why shared library is linked by absolute path?

I create an application by linking the libociei.so and libcustome.so

CC -o main main.cpp ../lib/libociei.so ../lib/libcustome.so

and copy libociei.so libcustome.so to /usr/lib

then I use ldd to check li开发者_如何学运维brary, it shows:

   main .....
   libcustome.so  ===>   /usr/lib/libcustome.so
   ../lib/libociei.so

why libociei.so is not relocated to /usr/lib/libociei.so ?

ps : ld library path is /lib:/usr/lib and I do not add ../lib to ld library path


If you are on linux (say Ubuntu) then it is probably because you did not run:

sudo ldconfig

On other systems I am not so sure.


When you use readelf -d main does the NEEDED entries have the full path?

My guess is that ldd is seeking the libraries in the default path.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜