CentOS 7.x 编译安装 高版本 git出错解决方案

CentOS操作系统默认安装的git版本是 

attachments-2023-09-Ol6U68rH6515639d19e36.png


CentOS操作系统默认安装的git版本是 1.8.3.1 ,此版本有任意文件写入漏洞。 需要升级到2.30.9 及以上版本 才可以修复此漏洞。

修复中遇到了问题

imap-send.o: In function `sk_GENERAL_NAME_num':

/usr/local/include/openssl/x509v3.h:165: undefined reference to `OPENSSL_sk_num'

imap-send.o: In function `sk_GENERAL_NAME_value':

/usr/local/include/openssl/x509v3.h:165: undefined reference to `OPENSSL_sk_value'

imap-send.o: In function `sk_GENERAL_NAME_pop_free':

/usr/local/include/openssl/x509v3.h:165: undefined reference to `OPENSSL_sk_pop_free'

/usr/local/include/openssl/x509v3.h:165: undefined reference to `OPENSSL_sk_pop_free'

imap-send.o: In function `ssl_socket_connect':

/usr/local/src/git-2.11.1/imap-send.c:287: undefined reference to `OPENSSL_init_ssl'

/usr/local/src/git-2.11.1/imap-send.c:288: undefined reference to `OPENSSL_init_ssl'

/usr/local/src/git-2.11.1/imap-send.c:290: undefined reference to `TLS_method'

/usr/local/src/git-2.11.1/imap-send.c:303: undefined reference to `SSL_CTX_set_options'

collect2: error: ld returned 1 exit status

make: *** [git-imap-send] Error 1


原因是 openssl的路径不对

解决办法:

1、在编译git之前,先找到openssl的路径,执行以下命令 

which openssl // 获得openssl路径

/usr/local/bin/openssl


2、在git目录编译时加上openssl的路径

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


3、然后正常安装

make prefix=/usr/local/git all 

make prefix=/usr/local/git install


4、设置环境变量并生效

echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile

source /etc/profile

5、查看git版本

git --version 



  • 发表于 2023-09-28 19:36
  • 阅读 ( 1581 )
  • 分类:服务器

0 条评论

请先 登录 后评论
东北大表哥
东北大表哥

自由职业

161 篇文章

作家榜 »

  1. 东北大表哥 161 文章
  2. 小鹄 1 文章
  3. 阿天 0 文章
  4. 新百胜在线 0 文章
  5. 刘明明 0 文章
  6. 个的德3 0 文章
  7. 铂天先生 0 文章
  8. 王达 0 文章