Linux ldconfig command

Source: Internet
Author: User

Linux ldconfig command

I. Introduction

Ldconfig is a dynamic link library management command. To share the dynamic link library with the system, you also need to run the dynamic link library management command-ldconfig. The ldconfig command is mainly used in the default search directory (/lib and/usr/lib) and dynamic library configuration file/etc/ld. so. find the shared dynamic link library under the directory listed in conf (format as described earlier, lib *. so *) to create a dynamic loader (ld. so) the required connection and cache file. the default cached file is/etc/ld. so. cache. This file stores the list of Dynamic Linked Library names in the sorted order.

Ii. Precautions

1. Add content in/lib and/usr/lib. You do not need to modify/etc/ld. so. conf, but you need to execute ldconfig. Otherwise, the library cannot be found.

2. Add content outside the preceding two directories. Modify/etc/ld. so. conf and execute ldconfig. Otherwise, the library will not be found.

For example, if you install mysql to/usr/local/mysql, mysql has a lot of Libraries under/usr/local/mysql/lib. In this case, you need to install mysql in/etc/ld. so. add/usr/local/mysql/lib under conf and run ldconfig.

3. if you want to put lib out of these two directories, you do not want to put it in/etc/ld. so. add content in conf. You can export a global variable LD_LIBRARY_PATH, and then find the library in this directory when running the program. Generally, this is only a temporary solution, which is used when you do not have the permission or need it temporarily.

4. ldconfig is related to running the program and has nothing to do with compiling. During compilation, you should add-L instead of obfuscation.

5. In short, it is recommended that you perform ldconfig for any changes to the library. Otherwise, unexpected results may occur. It won't take too much time, but it will save a lot of trouble.

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.