代码编织梦想

原因

默认情况下,编译器只会使用/lib和/usr/lib这两个目录下的库文件,通常通过源码包进行安装时,如果不指定–prefix,会将库安装在/usr/local/lib目录下;当运行程序需要链接动态库时,提示找不到相关的.so库,会报错。也就是说,/usr/local/lib目录不在系统默认的库搜索目录中,需要将目录加进去。

  1. 首先打开/etc/ld.so.conf文件

  2. 加入动态库文件所在的目录:执行vi /etc/ld.so.conf,在"include ld.so.conf.d/*.conf"下方增加"/usr/local/lib"。这里这个文件为只读文件,可以使用以下操作对其改写:

sudo vim ld.so.conf

修改完成后使用wq!退出即可。

  1. 保存后,在命令行终端执行:/sbin/ldconfig -v;其作用是将文件/etc/ld.so.conf列出的路径下的库文件缓存到/etc/ld.so.cache以供使用,因此当安装完一些库文件,或者修改/etc/ld.so.conf增加了库的新搜索路径,需要运行一下ldconfig,使所有的库文件都被缓存到文件/etc/ld.so.cache中,如果没做,可能会找不到刚安装的库。

经过以上三个步骤,"error while loading shared libraries"的问题通常情况下就可以解决了。

转载:https://blog.csdn.net/bandaoyu/article/details/108302269

动态链接相关-爱代码爱编程

转载自:http://chenzhou123520.iteye.com/blog/1925196 linux上启动Memcache报错: Shell代码   [root@localhost memcached]# ./bin/memcached -d -m 2048 -p 11211 -u root 

error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: no such 。。。_囧超的世界的博客-爱代码爱编程

问题: [root@wwc d0709]# ldd  ./te        linux-gate.so.1 =>  (0x00606000)        libevent-2.0.so.5 => not found        libc.so.6 => /lib/libc.so.6 (0x00a43000)        /lib

error while loading shared libraries: libevent-2.1.so.6:cannot open shared object file: no such fil_苒苒物华休丶的博客-爱代码爱编程

在linux上安装memcache后,执行启动命令时,会报错:error while loading shared libraries: libevent-2.1.so.6: cannot open shared objec

memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file:_踏雪_尋梅的博客-爱代码爱编程

文章转自:https://blog.csdn.net/keda8997110/article/details/8767606 启动memcached报错,如题。 memcached基本选项 -p 端口   监听tcp端口 -d    以守护进程方式运行memcached -u username  以username运行 -m 《num》  最大的内存

启动 Memcached 报错:/usr/local/bin/memcached: error while loading shared libraries: libevent-2.1.so.7-爱代码爱编程

启动 Memcached 报错: /usr/local/bin/memcached: error while loading shared libraries: libevent-2.1.so.7: cannot open shared object file: No such file or directory 解决方法如下: 1、查找libeve

找不到error while loading shared libraries: libevent-2.1.so.6共享库的问题-爱代码爱编程

文章目录 找不到库的问题报错信息如下查看缺什么库查看 libevent-2.1.so.6 是否存在映射参考1共享库(shared library)/动态库共享库的制作共享库的使用如何让系统找到共享库参考2 找不到库的问题 没有安装libevent,先安装。 报错信息如下 $ ./event ./event: error while lo

linux 中如何使用 id 命令_奋斗的工程师的博客-爱代码爱编程

Linux 中如何使用 id 命令 我从cnaaa.com购买了服务器。 在 Linux 中,id 命令用于显示用户的真实有效的用户ID和组ID。 本文我们通过一些例子来介绍一下如何使用 id 命令。 Linux 中

error while loading shared libraries: libevent-爱代码爱编程

系统版本:ubuntu20.04LTS。 libevent库版本:libevent-2.1.so.7 1、问题描述 在使用libevent库编写服务端及客户端程序时,g++编译生成可执行文件后,运行该可执行文件出错。