![ldconfig命令](https://i-blog.csdnimg.cn/blog_migrate/bfbf182e638b2c29f32490534b5362c1.png)
ldconfig命令
Linux applications, tools, services uses libraries to get necessary functionalities. Libraries provides a lot of functionality to the related applications, tools and services. One library can be used by different applications. This is called dynamic library using or loading.
Linux应用程序,工具和服务使用库来获取必要的功能。 库为相关的应用程序,工具和服务提供了很多功能。 一个库可以由不同的应用程序使用。 这称为使用或加载的动态库。
共享库 (Shared Libraries)
Shared libraries reside in /lib
, /lib64
and /usr/lib
. Each library is put into related directories like apt
, gcc
or similar. Dynamic libraries generally have extension .so
but there are also some version related numbering.
共享库位于/lib
, /lib64
和/usr/lib
。 每个库都放在相关的目录中,例如apt
, gcc
或类似目录。 动态库通常具有扩展名.so
但也有一些与版本相关的编号。
For example libvte.so.9
is a dynamic library for vte
which version is 9
.
例如, libvte.so.9
是vte
的动态库,版本为9
。
![Shared Libraries](https://i-blog.csdnimg.cn/blog_migrate/e6dcfec49430efb04b06f3b8bebcf384.png)
将路径添加到ldconfig(Add Path To ldconfig)
Some times the required libraries for the executable is not located in the standard paths. The default library path is hold in LD_LIBRARY_PATH
environments variable. We should add new path to this variable. In the example we assume that the new library path is /foo
有时,可执行文件所需的库不在标准路径中。 默认库路径保存在LD_LIBRARY_PATH
环境变量中。 我们应该为该变量添加新路径。 在示例中,我们假设新的库路径为/foo
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/foo
![Add Path To ldconfig](https://i-blog.csdnimg.cn/blog_migrate/0504c133566bce10d8c8428a45cc48d1.png)
重建缓存 (Rebuild Cache)
ldconfig is located at /etc/ld.so.conf
which content is like below. We will add the library path with include
command. The final content will be like below.
ldconfig位于/etc/ld.so.conf
,其内容如下。 我们将使用include
命令添加库路径。 最终内容将如下所示。
include /etc/ld.so.conf.d/*.conf
include /foo
Now we will run the ldconfig -p
command to read configuration file and rebuild the cache.
现在,我们将运行ldconfig -p
命令来读取配置文件并重建缓存。
$ ldconfig -p
翻译自: https://www.poftut.com/manage-libraries-ldconfig-command-linux/
ldconfig命令