libevent configure: error: openssl is a must but can not be found.error while loading shared librari

项目场景1:

安装libevent库


问题描述1

执行./configure 时出现以下错误

configure: error: openssl is a must but can not be found. You should add the directory containing openssl.pc' to the PKG_CONFIG_PATH’ environment variable, or set CFLAGS' and LDFLAGS’ directly for openssl, or use `–disable-openssl’ to disable support for openssl encryption

执行make出现以下错误

make: *** No targets specified and no makefile found. Stop.


原因分析1:

缺少openssl


解决方案1:

sudo apt install libssl-dev

项目场景2:

运行用到libevent库的程序

问题描述2

编译hello-world.c,运行hello时,出现如下错误。

./hello: error while loading shared libraries: libevent-2.1.so.7: cannot open shared object file: No such file or directory


原因分析2:

在运行时,程序无法找到libevent-2.1.so.7这个动态库,因为该动态库在默认安装时,存放的路径在/usr/local/lib下,不在系统的默认查找路径内。


解决方案2:

将/usr/local/lib路径添加到/etc/ld.so.conf配置文件中

sudo vi /etc/ld.so.conf  //需要sudo,否则出现 Can‘t open file for writing

添加路径 在这里插入图片描述

sudo ldconfig  //更新一下,使该配置生效

也有说
起不来的运行 export LD_LIBRARY_PATH=/usr/local/lib 就可以了
可以试试

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值