ILD

ubuntu共享库路径
作者:Herbert Yuan 邮箱:yuanjp@hust.edu.cn
发布时间:2018-6-24 站点:Inside Linux Development

编译tmux,要求安装libevent,下载编译,libevent默认安装到/usr/local/lib,但是执行tmux,找不到libevent的共享库。使用ldd发现找不到。

1
2
3
4
5
6
7
8
$ ldd `which tmux`
    linux-vdso.so.1 =>  (0x00007fffbd38c000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f66c5641000)
    libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f66c5418000)
    libevent-2.1.so.6 => not found
    libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f66c51fd000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f66c4e33000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f66c5844000)


使用ldconfig添加路径

1
sudo ldconfig /usr/local/lib


根据文件系统体系标准,实际上应该安装到/lib。


Depending on library, ubuntu stores its libraries mainly in three locations

  1. /lib

  2. /usr/lib

  3. /usr/local/lib

Following is from File System Hierarchy Standard

/lib

The /lib directory contains those shared library images needed to boot the system and run the commands in the root filesystem, ie. by binaries in /bin and /sbin.


/usr/lib

/usr/lib includes object files, libraries, and internal binaries that are not intended to be executed directly by users or shell scripts. [22]

Applications may use a single subdirectory under /usr/lib. If an application uses a subdirectory, all architecture-dependent data exclusively used by the application must be placed within that subdirectory.


/usr/local/lib 

contains local libraries i.e one specific for this system but I can not find references to /usr/local/lib in FHS, it only contains explanation for /usr/local.


参考

https://unix.stackexchange.com/questions/67781/use-shared-libraries-in-usr-local-lib

https://askubuntu.com/questions/17545/where-does-ubuntu-store-its-library-files



Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.