前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >keepalived 编译报错undefined reference to `OPENSSL_init_crypto'

keepalived 编译报错undefined reference to `OPENSSL_init_crypto'

原创
作者头像
大大刺猬
发布2023-07-13 13:56:52
6970
发布2023-07-13 13:56:52
举报
文章被收录于专栏:大大刺猬大大刺猬

环境

suse12.5

keepalived 2.1.5

gcc 4.0

openssl 1.0.2 和 1.1.0

报错

编译的时候报错如下

代码语言:javascript
复制
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: check/libcheck.a(check_ssl.o): in function `build_ssl_ctx':
/tmp/keepalived-2.1.5/keepalived/check/check_ssl.c:77: undefined reference to `OPENSSL_init_crypto'
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: /tmp/keepalived-2.1.5/keepalived/check/check_ssl.c:92: undefined reference to `TLS_method'
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: check/libcheck.a(check_ssl.o): in function `ssl_connect':
/tmp/keepalived-2.1.5/keepalived/check/check_ssl.c:235: undefined reference to `BIO_up_ref'
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: /tmp/keepalived-2.1.5/keepalived/check/check_ssl.c:236: undefined reference to `SSL_set0_rbio'
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: /tmp/keepalived-2.1.5/keepalived/check/check_ssl.c:237: undefined reference to `SSL_set0_wbio'
collect2: error: ld returned 1 exit status
Makefile:475: recipe for target 'keepalived' failed
make[2]: *** [keepalived] Error 1
make[2]: Leaving directory '/tmp/keepalived-2.1.5/keepalived'
Makefile:591: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/tmp/keepalived-2.1.5/keepalived'
Makefile:434: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

分析

看起来是没有安装opessl相关库,

但使用ldconfig -p的时候是能看到 ssl库信息的(有两个版本)

查看check_ssl.c 发现应该是识别到 1.1.0的版本了, 但使用的库的信息是1.0.0的

解决办法

configure前 添加 1.1.0的库的环境变量信息

代码语言:javascript
复制
export LDFLAGS="$LDFLAGS -L /usr/local/openssl-1.1.0g"
./configure --prefix=/usr/local/keepalived
make && make install

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 环境
  • 报错
  • 分析
  • 解决办法
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档