ldconfig only links files starting with lib*?

 ̄綄美尐妖づ 提交于 2019-12-01 07:03:38

问题


I'm struggling to make MVTec Halcon 11 work on Ubuntu. Everything is in the right place but the program doesn't see the dynamic libraries needed for image acquisition (the cameras alone work fine, the driver is installed)

I added the path with the libraries to /etc/ld.so.conf and ran ldconfig -v but of the 28 files present in the directory (all "Shared Library" type and .so extension), only the "lib*.so" ones are linked. As a matter of fact, ALL the libraries in the output of ldconfig are called lib*something.

Oddly, if I add "lib" in front of the name of the files, they get linked (of course that wouldn't be alright with the software)

Why is that?


回答1:


From the man of ld.so and ld-linux.so

Section FILES :

lib*.so* shared libraries

And from glibc (./elf/ldconfig.c) :

 712       /* Does this file look like a shared library or is it a hwcap
 713          subdirectory?  The dynamic linker is also considered as
 714          shared library.  */
 715       if (((strncmp (direntry->d_name, "lib", 3) != 0
 716             && strncmp (direntry->d_name, "ld-", 3) != 0)
 717            || strstr (direntry->d_name, ".so") == NULL)
 718           && (
 719 #ifdef _DIRENT_HAVE_D_TYPE
 720               direntry->d_type == DT_REG ||
 721 #endif
 722               !is_hwcap_platform (direntry->d_name)))
 723         continue;

Looks like you must choose a name begining with lib... The libc uses this to determine if the file may be a shared library.



来源:https://stackoverflow.com/questions/11842729/ldconfig-only-links-files-starting-with-lib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!