Detailed explanation of command-ldconfig
ldconfig is usually run when the system starts. When the user installs a new dynamic link library, this command needs to be run manually.
ldconfig [-v|--verbose] [-n] [-N] [-X] [-f CONF] [-C CACHE] [-r ROOT] [-l] [-p|--print-cache] [-c FORMAT] [--format=FORMAT] [-V] [-?|--<span class="wp_keywordlink">help</span>|--usage] path...
-v或--verbose:用此选项时,ldconfig将显示正在扫描的目录及搜索到的动态链接库,还有它所创建的连接的名字。 -n:用此选项时,ldconfig仅扫描命令行指定的目录,不扫描默认目录(/lib、/usr/lib),也不扫描配置文件/etc/ld.so.conf所列的目录。 -N:此选项指示ldconfig不重建缓存文件(/etc/ld.so.cache),若未用-X选项,ldconfig照常更新文件的连接。 -X:此选项指示ldconfig不更新文件的连接,若未用-N选项,则缓存文件正常更新。 -f CONF:此选项指定动态链接库的配置文件为CONF,系统默认为/etc/ld.so.conf。 -C CACHE:此选项指定生成的缓存文件为CACHE,系统默认的是/etc/ld.so.cache,此文件存放已排好序的可共享的动态链接库的列表。 -r ROOT:此选项改变应用程序的根目录为ROOT(是调用chroot函数实现的)。选择此项时,系统默认的配置文件/etc/ld.so.conf,实际对应的为ROOT/etc/ld.so.conf。如用-r /usr/zzz时,打开配置文件/etc/ld.so.conf时,实际打开的是/usr/zzz/etc/ld.so.conf文件。用此选项,可以大大增加动态链接库管理的灵活性。 -l:通常情况下,ldconfig搜索动态链接库时将自动建立动态链接库的连接,选择此项时,将进入专家模式,需要手工设置连接,一般用户不用此项。 -p或--print-cache:此选项指示ldconfig打印出当前缓存文件所保存的所有共享库的名字。 -c FORMAT 或 --format=FORMAT:此选项用于指定缓存文件所使用的格式,共有三种:old(老格式),new(新格式)和compat(兼容格式,此为默认格式)。 -V:此选项打印出ldconfig的版本信息,而后退出。 -? 或 --help 或 --usage:这三个选项作用相同,都是让ldconfig打印出其帮助信息,而后退出。
A few things to note about ldconfig:
- There is no need to modify /etc/ld.so.conf when adding things to /lib and /usr/lib, but you need to adjust ldconfig after finishing, otherwise the library will not be found.
- When you want to add something to the above two directories, you must modify /etc/ld.so.conf and then call ldconfig, otherwise it will not be found.
- For example, if you install a mysql to /usr/local/mysql, mysql has a lot of libraries under /usr/local/mysql/lib, then you need to add a line /usr under /etc/ld.so.conf /local/mysql/lib, save it and run ldconfig so that the new library can be found when the program is running.
- If you want to put lib outside these two directories, but you don’t want to add things to /etc/ld.so.conf (or you don’t have permission to add things). That's okay, just export a global variable LD_LIBRARY_PATH, and then when you run the program, it will go to this directory to find the library. Generally speaking, this is only a temporary solution, used when there is no permission or temporary need.
- These things ldconfig does are related to the running time of the program and have nothing to do with the compilation time. You still need to add -L when compiling, don't get confused.
- In short, no matter what changes are made to the library, it is best to ldconfig, otherwise some unexpected results will occur. It won't take much time, but it will save a lot of trouble.
- Furthermore, the file header such as libdb-4.3.so will contain information related to the library name (that is, it contains "libdb-4.3.so", which can be viewed with the strings command), so just modify the file name to impersonate someone. Already recognized libraries (such as libdb-4.8.so) will not work. For this purpose, you can directly modify the configuration information in the Makefile of the compiled library and specify a special library name.
The above is the detailed content of Detailed explanation of command-ldconfig. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.
