当前位置:网站首页>Ldconfig command
Ldconfig command
2022-06-23 07:18:00 【Wanderer001】
Reference resources ldconfig command - cloud + Community - Tencent cloud
Catalog
1、 brief introduction
ldconfig The command is mainly used to search the default directory /lib and /usr/lib And dynamic library configuration files /etc/ld.so.conf Under the directory listed in , Search for shared dynamic link libraries ( The format is as follows lib*.so*), And then create a dynamic linker (ld.so or ld-linux.so) Required cache files . The cache file defaults to /etc/ld.so.cache, This file holds an ordered list of DLL names , In order to make the DLL shared by the system , Need to run dynamic link library management command ldconfig Update the cache file of the dynamic link library , This executive program is stored in /sbin Under the table of contents .ldconfig Usually run at system startup , When a user installs a new DLL , You need to run this command manually .
2、 Command format
/sbin/ldconfig [ -nNvXV ] [ -f conf ] [ -C cache ] [ -r root ] directory ...
/sbin/ldconfig -l [ -v ] library ...
/sbin/ldconfig -p3、 Parameter description
-v, --verbose
With this option ,ldconfig The directory being scanned and the DLL being searched will be displayed , And the name of the link it creates
-n
ldconfig Scan only the directories specified on the command line , Do not scan the default directory (/lib、/usr/lib), Also do not scan the configuration file /etc/ld.so.conf List of directories .
-N
ldconfig Do not rebuild cache files (/etc/ld.so.cache), If not -X Options ,ldconfig Update the file link as usual
-X
ldconfig Do not update file links , If not -N Options , The cache file is rebuilt as usual
-f <conf >
Specify that the configuration file of the dynamic link library is <conf > , The system defaults to /etc/ld.so.conf
-C <cache>
Specify that the generated cache file is <cache>, The system defaults to /etc/ld.so.cache, This file holds a sorted list of shareable dynamic link libraries
-r <root>
Change the root directory of the application to <root>( Is to call chroot Functionally implemented ). When this option is selected , System default profile /etc/ld.so.conf, The actual correspondence is <root>/etc/ld.so.conf. If used -r /usr/zzz when , Open profile /etc/ld.so.conf when , What is actually opened is /usr/zzz/etc/ld.so.conf file . With this option , It can greatly increase the flexibility of dynamic link library management
-l
Usually ,ldconfig The dynamic link library will be automatically linked when searching the dynamic link library , When this option is selected , Will enter expert mode , You need to set the link manually , General users do not need this item
-p, --print-cache
ldconfig Print out the names of all shared libraries saved in the current cache file
-c FORMAT or --format=FORMAT: This option is used to specify the format used by the cache file , There are three kinds :old( Old format ),new( New format ) and compat( Compatible formats , This is the default format ).
-V
Print out ldconfig Version information for
-?, --help, --usage
These three options work the same , It's all about letting ldconfig Print out its help information 4、 Common examples
(1) Show ldconfig Help information .
ldconfig -?(2) Show ldconfig Version information .
ldconfig -V(3) Refresh the dynamic link library cache file /etc/ld.so.cache.
sudo ldconfig5、 matters needing attention
(1) Go to /lib and /usr/lib Add dynamic link library inside , No need to modify /etc/ld.so.conf Of , But after that, we need to adjust it ldconfig, Otherwise, this library Will find .
(2) When you want to add something to the above two catalogues , Be sure to revise it /etc/ld.so.conf, Then call ldconfig, Otherwise, it will not be found .
Like installing a mysql To /usr/local/mysql,mysql There's a lot of library stay /usr/local/mysql/lib below , And that's where we need to be /etc/ld.so.conf Add a line to it /usr/local/mysql/lib, Execute after saving ldconfig Update the dynamic link library cache /etc/ld.so.cache, new library Can be found when the program is running .
(3) If you want to /lib and /usr/lib These two directories are placed outside lib, And I don't want to /etc/ld.so.conf Directory of China Canada dynamic link library ( Or without permission ). Then you can. export A global variable LD_LIBRARY_PATH, Then when you run the program, you will go to this directory to find library. Generally speaking, it's just a temporary solution , Use it when you don't have permission or need it temporarily .
(4)ldconfig Updating the cache file of the dynamic link library is only related to the program runtime , It has nothing to do with compile time . Compile with -L You have to add , Don't confuse .
(5) All in all , No matter what you do about library After the change , Better all ldconfig once , Otherwise, there will be some unexpected results . It won't take much time , But it will save a lot of things .
边栏推荐
猜你喜欢

Flannel 工作原理

GloRe

对二进制的某一位操作

【***数组***】

20BN-Jester完整数据集下载

NTU-RGBD数据集下载及数据格式解析

Interpreting the spirit of unity and cooperation in maker Education

406-双指针(27. 移除元素、977.有序数组的平方、15. 三数之和、18. 四数之和)

Analysis of personalized learning progress in maker Education

Advanced drawing skills of Excel lecture 100 (VIII) -excel drawing WiFi diagram
随机推荐
306. 累加数
Nacos适配oracle11g-建表ddl语句
Vs2013 ffmpeg environment configuration and common error handling
In depth learning series 47:stylegan summary
Use of Lombok
Analyzing the creation principle in maker Education
Arthas thread command locates thread deadlock
Spock约束-调用频率/目标/方法参数
UNET code implementation
407-栈与队列(232.用栈实现队列、225. 用队列实现栈)
异构交易场景交互流程及一致性保证
307. area and retrieval - array modifiable
U-Net: Convolutional Networks for Biomedical Image Segmentation
都是硬盘分区 C盘和D盘到底有什么区别?
Flannel 工作原理
SSTable详解
901. stock price span
如何优雅的快速下载谷歌云盘的大文件 (二)
Heterogeneous transaction scenario interaction process and consistency assurance
897. incremental sequential search tree