【K8S】HAproxy安装报错fatal error: openssl/bn.h: No such file or directory

1.haproxy安装报错如下

Linux:centos8.4, 安装包里面没有openssl-devel; 

[root@K8S8 haproxy-3.0.0]# make TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1 \
> USE_CPU_AFFINITY=1 PREFIX=/usr/local/haproxy
  CC      src/ev_poll.o
  CC      src/ev_epoll.o
  CC      src/cpuset.o
  CC      src/ssl_sock.o
In file included from src/ssl_sock.c:62:
include/haproxy/openssl-compat.h:17:10: fatal error: openssl/bn.h: No such file or directory
 #include <openssl/bn.h>
          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1041: src/ssl_sock.o] Error 1

2.处理方法 

--安装Openssl;
yum install openssl-devel -y
rpm -ivh openssl-devel-1.1.1k-12.el8_9.x86_64.rpm --nodeps


[root@K8S8 soft]# rpm -ivh openssl-devel-1.1.1k-12.el8_9.x86_64.rpm --nodeps
warning: openssl-devel-1.1.1k-12.el8_9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID c21ad6ea: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:openssl-devel-1:1.1.1k-12.el8_9  ################################# [100%]

3.编译 

[root@K8S7 soft]# cd haproxy-2.5.0/
[root@K8S7 haproxy-2.5.0]# make TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1 \
> USE_CPU_AFFINITY=1 PREFIX=/usr/local/haproxy
  CC      src/ssl_sample.o
  CC      src/ssl_sock.o
  CC      src/ssl_crtlist.o
  CC      src/ssl_ckch.o
  CC      src/ssl_utils.o
  CC      src/cfgparse-ssl.o
  CC      src/jwt.o
  CC      src/namespace.o
  CC      src/mux_h2.o
  CC      src/mux_fcgi.o
  CC      src/http_ana.o
  CC      src/mux_h1.o
  CC      src/tcpcheck.o
  CC      src/stream.o
  CC      src/stats.o
  CC      src/server.o
  CC      src/flt_spoe.o
  CC      src/stick_table.o
  CC      src/tools.o
  CC      src/sample.o
  CC      src/log.o
  CC      src/peers.o
  CC      src/resolvers.o
  CC      src/backend.o
  CC      src/cfgparse.o
  CC      src/http_htx.o
  CC      src/cli.o
  CC      src/proxy.o
  CC      src/pattern.o
  CC      src/connection.o
  CC      src/check.o
  CC      src/cfgparse-listen.o
  CC      src/cache.o
  CC      src/haproxy.o
src/haproxy.c:80:10: fatal error: systemd/sd-daemon.h: No such file or directory
 #include <systemd/sd-daemon.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:984: src/haproxy.o] Error 1

还是报错:

--需要安装systemd-devel包。
rpm -ivh systemd-devel-239-51.el8.x86_64.rpm --nodeps
  
 
--再次编译haproxy ,还是报错。 
  CC      src/freq_ctr.o
  CC      src/ebtree.o
  CC      src/hash.o
  CC      src/dgram.o
  CC      src/version.o
  LD      haproxy
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
make: *** [Makefile:951: haproxy] Error 1
--说明是安装的openssl 版本有问题。无法之别:libssl,libcrypto;


--重新安装 openssl;
--openssl-3.0.0 安装失败。

[root@K8S8 openssl-3.0.0]# ./config
Can''t locate IPC/Cmd.pm in @INC (you may need to install the IPC::Cmd module) (@INC contains: /data/soft/openssl-3.0.0/util/perl /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 /data/soft/openssl-3.0.0/external/perl/Text-Template-1.56/lib) at /data/soft/openssl-3.0.0/util/perl/OpenSSL/config.pm line 18.
BEGIN failed--compilation aborted at /data/soft/openssl-3.0.0/util/perl/OpenSSL/config.pm line 18.
Compilation failed in require at /data/soft/openssl-3.0.0/Configure line 23.
BEGIN failed--compilation aborted at /data/soft/openssl-3.0.0/Configure line 23.


--需要安装这个IPC/pod模块。
yum -y install perl-IPC-Cmd
yum -y install perl-Pod*

--重新安装openssl ;
./config 
make 
make install 


--重新编译haproxy;
make TARGET=linux-glibc USE_OPENSSL=1 USE_ZLIB=1 USE_PCRE=1 USE_OPENSSL=1 USE_CPU_AFFINITY=1 PREFIX=/usr/local/haproxy
make install PREFIX=/usr/local/haproxy
/usr/local/haproxy/sbin/haproxy -v
HAProxy version 2.5.0-f2e0833f16a 2021/11/23 - https://haproxy.org/
Status: stable branch - will stop receiving fixes around Q1 2023.
Known bugs: http://www.haproxy.org/bugs/bugs-2.5.0.html
Running on: Linux 4.18.0-305.3.1.el8.x86_64 #1 SMP Tue Jun 1 16:14:33 UTC 2021 x86_64

根据引用\[1\]和引用\[2\]的信息,您在从GitHub上克隆资源时遇到了无法访问主机的错误。这可能是由于网络连接问题导致的。您可以尝试以下解决方法: 1. 检查您的网络连接是否正常。确保您可以访问其他网站,并且没有任何网络问题。 2. 如果您使用了代理,请按照引用\[3\]中提供的步骤设置Git Bash中的代理。确保代理地址和端口正确,并且代理设置生效。 3. 如果您没有使用代理,或者代理设置没有解决问题,您可以尝试使用Git的SSH协议进行克隆。首先,您需要在GitHub上设置SSH密钥。然后,使用SSH URL进行克隆,例如:git clone git@github.com:ros-planning/geometric_shapes.git。 4. 如果上述方法都没有解决问题,可能是由于GitHub服务器出现问题或其他临时问题导致的。您可以稍后再次尝试克隆,或者尝试使用其他网络环境进行克隆。 希望以上解决方法能够帮助您解决问题。如果问题仍然存在,请提供更多详细信息,以便我们能够更好地帮助您。 #### 引用[.reference_title] - *1* [解决Github:fatal:unable to access ‘https://github.com/.../.git‘:Could not resolve host:github.com](https://blog.csdn.net/weixin_44296929/article/details/111242452)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [fatal: 无法访问 https://github.com/ :Failed to connect to github.com port 443: 拒绝连接的解决办法](https://blog.csdn.net/weixin_59168010/article/details/124768747)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [关于git:fatal:无法访问’https://github.com/xxx’:OpenSSL SSL_connect:SSL_ERROR_SYSCALL连接到...](https://blog.csdn.net/qq_37124515/article/details/114190310)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值