Linux programs can be compiled and linked, but *.so cannot be found when executing, generally related to LD_LIBRARY_PATH

Reprint: http://bbs.chinaunix.net/thread-983182-1-1.html

PATH variable:

This variable represents that when the executable program directly enters an instruction to execute at any position, the system will go to the directory marked by this variable to find the corresponding executable program.

The path of some commands is not in the PATH environment variable. You can use the echo $PATH command to query to find out. The method of adding the path to the PATH environment variable is as follows:

(1) If you only want to temporarily add and modify during this boot process, and the next boot will be invalid, you can:

   export PATH=$PATH:path -----path is the path where the command is located

(2) If it is only permanently added to the current user, then:

           Add a line like this near the end of ~/.bash_profile after PATH=$PATH:$HOME/bin    

Add :path, it becomes PATH=$PATH:$HOME/bin:path

After the file is modified and maintained, run the source ~/.bash_profile command to make the modification take effect immediately.

(3) If it is permanently added to all users in the system, then:

           Add export PATH=$PATH:path at the end of the /etc/profile file (with root privileges). After the file is modified and maintained, run the source etc/profile command to make the modification take effect immediately.

LD_LIBRARY_PATH variable

If a variable represents a header file directory, then the directory can only be unique

If a variable represents a dynamic library directory, then this directory can be multiple directories connected by colons

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326095962&siteId=291194637