ldconfig只链接以lib *开头的文件?

时间:2012-08-07 09:13:46

标签: linux shared-libraries ubuntu-12.04

我正努力让MVTec Halcon 11在Ubuntu上运行。一切都在正确的位置,但程序没有看到图像采集所需的动态库(单独的相机工作正常,驱动程序已安装)

我将库的路径添加到/etc/ld.so.conf并运行ldconfig -v但是目录中存在的28个文件(所有“共享库”类型和.so扩展名),只有“lib * .so“有关联。事实上,ldconfig输出中的所有库都被称为lib * something。

奇怪的是,如果我在文件名前添加“lib”,它们会被链接起来(当然这对软件来说不合适)

为什么?

1 个答案:

答案 0 :(得分:3)

来自ld.so和ld-linux.so的人

部分文件:

  

LIB * *。所以   共享库

来自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;

看起来你必须选择一个以lib开头的名字... libc使用它来确定该文件是否可能是一个共享库。