文章目录
问题描述
在docker镜像(centos系统)中,编译代码时,有如下错误
fatal error: openssl/ssl.h: No such file or directory
#include <openssl/ssl.h> // SSL_*
解决方法
找不到 openssl/ssl.h
头文件是因为 openssl-devel 缺失导致的,安装该库即可,可用如下命令:sudo yum install -y openssl-devel
- 安装完成后,可以通过
sudo yum list installed | grep openssl-devel
查看是否安装成功。 - 安装前可以通过
sudo yum info openssl-devel
查看源中对应的版本
相关问题
openssl-devel安装过程中报错
使用『sudo yum install openssl-devel -y
』安装openssl-dev过程中有相关依赖包安装失败,如下
...
--> Finished Dependency Resolution
Error: Package: libselinux-devel-2.5-6.el7.x86_64 (base)
Requires: libselinux(x86-64) = 2.5-6.el7
Installed: libselinux-2.5-15.el7.x86_64 (@base)
libselinux(x86-64) = 2.5-15.el7
Available: libselinux-2.5-6.el7.x86_64 (base)
libselinux(x86-64) = 2.5-6.el7
Error: Package: libsepol-devel-2.5-6.el7.x86_64 (base)
Requires: libsepol(x86-64) = 2.5-6.el7
Installed: libsepol-2.5-10.el7.x86_64 (@base)
libsepol(x86-64) = 2.5-10.el7
Available: libsepol-2.5-6.el7.x86_64 (base)
libsepol(x86-64) = 2.5-6.el7
Error: Package: 1:openssl-devel-1.0.1e-60.el7_3.1.x86_64 (updates)
Requires: openssl-libs(x86-64) = 1:1.0.1e-60.el7_3.1
Installed: 1:openssl-libs-1.0.2k-21.el7_9.x86_64 (@updates)
openssl-libs(x86-64) = 1:1.0.2k-21.el7_9
Available: 1:openssl-libs-1.0.1e-60.el7.x86_64 (base)
openssl-libs(x86-64) = 1:1.0.1e-60.el7
Available: 1:openssl-libs-1.0.1e-60.el7_3.1.x86_64 (updates)
openssl-libs(x86-64) = 1:1.0.1e-60.el7_3.1
You could try using --skip-broken to work around the problem
** Found 5 pre-existing rpmdb problem(s), 'yum check' output follows:
glibc-2.17-157.el7_3.1.x86_64 is a duplicate with glibc-2.17-157.el7.x86_64
glibc-common-2.17-157.el7_3.1.x86_64 is a duplicate with glibc-common-2.17-157.el7.x86_64
glibc-devel-2.17-157.el7.x86_64 has missing requires of glibc-headers = ('0', '2.17', '157.el7')
glibc-devel-2.17-157.el7_3.1.x86_64 is a duplicate with glibc-devel-2.17-157.el7.x86_64
glibc-utils-2.17-157.el7_3.1.x86_64 is a duplicate with glibc-utils-2.17-157.el7.x86_64
解决方法:
- 切换源,以下切换为aliyun源,相关命令为:
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sudo yum clean all
sudo yum makecache
sudo yum install -y openssl-devel