Environment Variable LD_LIBRARY_PATH in Ubuntu

Source: Internet
Author: User
Problem: (1) Run env on the Ubuntu terminal and no environment variable LD_LIBRARY_PATH is found. (2) open a new terminal and run echo $ LD_LIBRARY_PATH. The result is blank. After adding a directory through export, enter the echo command to display the directory you just added. Close the terminal, open a new terminal, and enter the echo $ LD_LIBRARY_PATH command. The screen is blank. (3) EDIT ~ /. Profi

Problem:

(1) Run env on the Ubuntu terminal and the environment variable LD_LIBRARY_PATH is not found.

(2) open a new terminal, input the echo $ LD_LIBRARY_PATH command, and the result is blank. After adding a directory through export, enter the echo command to display the directory you just added. As follows:

Close the terminal, open a new terminal, and enter the echo $ LD_LIBRARY_PATH command. The screen is blank.

(3) EDIT ~ /. Profile file, add content:

If [-d "$ HOME/lib"]; then

Export LD_LIBRARY_PATH = "/usr/local/netpbm/lib"

Fi

When you use Ctrl + Alt + F1 to log on to tty1, you can use echo $ LD_LIBRARY_PATH to view the set environment variables.

However, on the gnome terminal, enter the echo command, which is still blank. Environment variable settings are ineffective.

(4) Run The sudo vi/etc/environment command to add

LD_LIBRARY_PATH = "/usr/local/netpbm/lib"

Enter the echo command on the terminal.

Run the sudo-I command to access the root user permission. Run the echo command to view the set environment variables.

Then, how to set the shared library path so that the system can search for these libraries. The following methods are used:

1) Place the shared library in the directory/lib or/usr/lib, and use ldconfig to make the addition take effect even if

1) Add the dynamic library directory to the file/etc/ld. so. conf and use ldconfig to make the addition take effect even

2) In the file ~ /Add to the bashrc File

If [-d "$ HOME/lib"]; then

Export LD_LIBRARY_PATH = "$ HOME/lib"

Fi

The environment variable LD_LIBRARY_PATH can only be used in bash. Environment variables such as ksh and tcsh cannot be used in other shells.

3) In ~ /. Profile or/etc/environment. Edit the environment variable LD_LIBRARY_PATH.

Edit the/etc/X11/Xsession. options file and change use-ssh-agent to no-use-ssh-agent.

The environment variable LD_LIBRARY_PATH can be used in this way.

4)-R option specifies the shared library directory

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.