Set the Linux LD_LIBRARY_PATH variable

Source: Internet
Author: User


Set the Linux LD_LIBRARY_PATH variable in Linux. If you have written your own dynamic link library and need to call it in other programs, you need to make these programs find these dynamic link libraries. If the setting is incorrect, an error similar to the following will occur: www.2cto.com test: error while loading shared libraries: libexampleso. so.0: cannot open shared object file: No such file or directory. This is because the installation path of the dynamic link library (for example,/usr/local/lib) is not put into the variable LD_LIBRARY_PATH. At this time, you can use the command export to temporarily test whether the problem is true: export LD_LIBRARY_PATH =/usr/local/lib run the above command in the terminal, and then run this executable file, this problem occurs if it runs normally. The following question is: the above practice is to temporarily set the variable LD_LIBRARY_PATH. All the settings will no longer exist at next boot. How can I keep this value in LD_LIBRARY_PATH? We can ~ /. Bashrc or ~ /. Add the export Statement to the bash_profile. The former reads the statement every time you log on and every time you open the shell, and the latter reads the statement only once upon login. My habit is to add ~ /. In bashrc, before the end of the file, you can use the following statement to make the settings take effect: export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/local/lib after modification, remember to turn off the current terminal and re-open a new terminal to make the above configuration take effect.
 

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.