After sysbench is installed, the following problems occur when checking the sysbench version number sysbench --version
:
/usr/local/sysbench/bin/sysbench: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
The installation directory of mysql is in /app/databases/mysql
. MySQL has a lot of libraries under the lib directory. At this time, you need to add a line /app/database/mysql/lib
under /etc/ld.so.conf
and save it. ldconfig
, the new library can be found when the program is running
The purpose of the ldconfig
command is mainly to search for the sharable dynamic link library (format such as lib. so), and then create the connection and cache files required by the dynamic loader (ld.so). The cache file defaults to /etc/ld.so.cache
. This file saves a sorted list of dynamic link library names. In order to make the dynamic link library shared by the system, you need to run the dynamic link library management command ldconfig
, which executes the program Stored in the /sbin
directory.
ldconfig usually runs when the system starts, and when the user installs a new dynamic link library, you need to manually run this command.
ldconfig several points to note:
/usr/lib
, you don't need to modify /etc/ld.so.conf, but you need to adjust ldconfig after finishing, otherwise the library will not be found./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
/etc/ld.so.conf
(or add things without permission). That's okay, that is, export a global variable LD_LIBRARY_PATH
, and then when you run the program, you will find the library in this directory. Generally speaking, this is only a temporary solution, used when there is no permission or temporary need.ldconfig
are all related to the time of running the program, and have nothing to do with the time of compiling. When compiling, you still need to add -L
, so don't get confused.ldconfig
, otherwise there will be some unexpected results. It won't take too much time, but it will save a lot of things.