安装Git期间"openssl/ssl.h:没有这样的文件或目录"

Mir*_*hdi 13 git

尝试根据安装Git博客上的说明在Unix和Linux机器上安装git,但是失败了以下错误

make prefix=/usr/local all
GIT_VERSION = 1.8.3.4
    * new build flags
    CC credential-store.o
In file included from cache.h:4,
                 from credential-store.c:1:
git-compat-util.h:221:25: warning: openssl/ssl.h: No such file or directory
git-compat-util.h:222:25: warning: openssl/err.h: No such file or directory
In file included from credential-store.c:1:
cache.h:11:21: warning: openssl/sha.h: No such file or directory
cache.h:19:18: warning: zlib.h: No such file or directory
In file included from credential-store.c:1:
cache.h:21: syntax error before "z_stream"
cache.h:21: warning: no semicolon at end of struct or union
cache.h:28: syntax error before '}' token
cache.h:28: warning: type defaults to `int' in declaration of `git_zstream'
cache.h:28: warning: data definition has no type or storage class
cache.h:30: syntax error before '*' token
cache.h:31: syntax error before '*' token
cache.h:32: syntax error before '*' token
cache.h:33: syntax error before '*' token
cache.h:35: syntax error before '*' token
cache.h:36: syntax error before '*' token
cache.h:37: syntax error before '*' token
cache.h:38: syntax error before '*' token
cache.h:39: syntax error before '*' token
cache.h:40: syntax error before '*' token
cache.h:41: syntax error before '*' token
cache.h:42: syntax error before '*' token
cache.h:769: syntax error before '*' token
make: *** [credential-store.o] Error 1
Run Code Online (Sandbox Code Playgroud)

我知道这是因为openssl缺少库,但我无法获得这些库.

我没有在我的机器上使用yum/apt-get来运行以下命令:

$ yum install curl-devel expat-devel gettext-devel \
  openssl-devel zlib-devel

$ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \
  libz-dev libssl-dev
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能在这些机器上获得这些库.这些机器没有互联网接入,如果需要我可以做一个scp.有什么建议.

小智 16

这个答案对我来说很好

/sf/answers/211189051/

做就是了 sudo apt-get install libssl-dev


小智 9

对于RHEL和RHEL衍生产品(如CentOS系统),安装将解决此问题。

$ yum install -y openssl-devel
Run Code Online (Sandbox Code Playgroud)


sat*_*tel 6

对于ubuntu,我安装了openssllibssl-dev

须藤 apt 安装 openssl libssl-dev

检查配置文件代码后,我发现它在预定义路径中搜索“include/openssl/ssl.h”

您可以在您的系统上找到它,并可以使用 --with-openssl 运行配置

例如,如果您在 /usr/include/openssl/ssl.h 中找到 ssl.h 那么您可以运行以下命令

./configure --with-openssl=/usr/


小智 5

如果无法访问 yum、apt-get 等(比如在没有 sudo 访问权限的集群机器上),请在本地手动安装新版本的 openssl,如下所示:

获取源码,解压,进入目录,制作build目录(重要):

wget https://www.openssl.org/source/openssl-1.0.2r.tar.gz
tar -xvzf openssl-1.0.2r.tar.gz
cd openssl-1.0.2r
mkdir builddir
Run Code Online (Sandbox Code Playgroud)

配置到您的本地构建目标(确保它与您的源目录不同,不要只使用 /home/yourdir/openssl-1.0.2r/),制作并安装:

./config --prefix=/home/yourdir/openssl-1.0.2r/builddir --openssldir=/home/yourdir/openssl-1.0.2r/builddir
make
make install
Run Code Online (Sandbox Code Playgroud)

将构建目录中的 bin 和库路径添加到您的 shell 配置文件(即 ~/.bashrc)中的适当变量中,并获取它:

export PATH=/home/yourdir/openssl-1.0.2r/builddir/bin:$PATH
LD_LIBRARY_PATH="/your/other/dirs/libs:/home/yourdir/openssl-1.0.2r/builddir/lib:"
source ~/.bashrc
Run Code Online (Sandbox Code Playgroud)

默认情况下,OpenSSL 现在应该在您的新目录中:

which openssl
> /home/yourdir/openssl-1.0.2r/builddir/bin/openssl
Run Code Online (Sandbox Code Playgroud)

现在尝试重新安装 git,也许使用 make distclean。


tri*_*eee 2

如果您无法访问所需库的预构建包,则必须诉诸包管理器出现之前的古老做法:在本地构建库,以及它们所依赖的库,以及它们所依赖的库,等等。

换句话说,您可能面临一个巨大而复杂的依赖追逐迷宫,其中可能包括修复平台的可移植性错误(如果源代码未立即编译)。

Debian PTS 具有许多软件包上游项目的链接,因此您可能不需要猜测从“openssl source”的 Google 结果中选择哪个结果。请参见http://packages.qa.debian.org/o/openssl.html(“浏览源代码”链接是一个好的开始;每个包的 Debian 版权文件还应该包含一个上游 URL,尽管它可能是历史)。

还:

如果您在本地有一个包管理器(在 Debian 上,这将是基本的dpkg),那么您可以避免查找和编译的麻烦,只需从连接互联网的主机复制所需的依赖包层次结构即可;但同样,请确保您获得完整的递归依赖项集(您所依赖的包反过来依赖的任何东西,递归地)。例如https://packages.debian.org/stable/openssl显示opensslDebian 软件包依赖哪些软件包;其中一些将依次拥有自己的类似依赖项列表。