Linux loads the so library problem in /usr/local/lib

When running qTox in Linux, some libraries cannot be loaded (libavcode***, and reinstallation will not work), and then download the source code to compile ( https://my.oschina.net/u/2306127/blog/1616888 ), Then it can be run. The description is caused by incompatible versions of some libraries.

question

However, after compiling qTox, you can use ./qtox in the current directory to run, but if you use the qtox command after using make install, it cannot run, and it prompts that the libtoxcore library cannot be found. Go to /usr/local/lib to see that the library is there , and it was just compiled, and there is no problem with the version.

Later, it was found that /usr/local/lib was not in the Linux search path by default, so it could not be found.

Put the installation path of the dynamic link library (for example, /usr/local/lib) into the variable LD_LIBRARY_PATH, and that's it.

verify

You can use the command  export  to temporarily test to see if this is the problem:

export LD_LIBRARY_PATH=/usr/local/lib

Run the above line of command in the terminal, and then run the executable file. If it runs normally, it means this is the problem.

set up

The above method is only to temporarily set the variable  LD_LIBRARY_PATH  , and the next time you turn on the computer, all settings will no longer exist.

How to keep writing this value to LD_LIBRARY_PATH?

bash settings

We can  add an export statement to ~/.bashrc  or  ~/.bash_profile  , the former is read once for every login and every time the shell is opened, and the latter is only read once at login.

Add to  ~/.bashrc  , at 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 close the current terminal and reopen a new terminal to make the above configuration take effect.

profile settings

It can also be placed in /etc/profile, which is a system global setting, or in ~/.profile, a setting for the current user.

You can use source /etc/profile to make the settings take effect immediately.

 

Guess you like

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