当前位置:网站首页>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 .
边栏推荐
- MySQL Niuke brush questions
- [AI practice] data normalization and standardization of machine learning data processing
- Arthas thread command locates thread deadlock
- Nacos adapts to oracle11g- modify the source code of Nacos
- Spock constraint - call frequency / target / method parameters
- 897. 递增顺序搜索树
- [2022 graduation season] from graduation to transition to the workplace
- GINet
- 313. super ugly number
- 899. ordered queue
猜你喜欢
随机推荐
Akamai-1.75 version-_ Abck parameter generation JS reverse analysis
MySQL(四) — MySQL存储引擎
TensorFlow中的数据类型
Verilog syntax explanation
300. 最长递增子序列
Several characteristics of MySQL database
312. 戳气球
SSM整合
Redis setting password
U-Net: Convolutional Networks for Biomedical Image Segmentation
都是硬盘分区 C盘和D盘到底有什么区别?
GINet
MySQL mvcc multi version concurrency control
深度学习系列46:人脸图像超分GFP-GAN
Advanced drawing skills of Excel lecture 100 (VIII) -excel drawing WiFi diagram
901. 股票价格跨度
启发式的搜索策略
303. 区域和检索 - 数组不可变
Heterogeneous transaction scenario interaction process and consistency assurance
别找了诸位 【十二款超级好用的谷歌插件都在这】(确定不来看看?)

![[game theory] basic knowledge](/img/eb/08b1ce5106e574dc42be58f72fbab9.jpg)







