Centos7 编译安装git 报错 git-compat-util.h:14:2: error
环境:
OS:CentOS7.9
Git版本: git-2.38.1
一、报错现象
[root@0773d8e7fe8f git-2.38.1]# make all doc info
* new build flags
CC fuzz-commit-graph.o
In file included from commit-graph.h:4:0,
from fuzz-commit-graph.c:1:
git-compat-util.h:14:2: error: #error "Required C99 support is in a test phase. Please see git-compat-util.h for more details."
#error "Required C99 support is in a test phase. Please see git-compat-util.h for more details."
^
make: *** [fuzz-commit-graph.o] Error 1
二、原因:
Git version>v2.35 added a balloon test for C99 support
(gitlab-git@7bc341e2).
This test caused builds to fail in CentOS 7, since this uses gcc
v4.8.5, which uses C90 () by default. C11 is a newer
standard than C90, and gcc v5.1.0 switched the default from
to .-std=gnu90std=gnu90std=gnu11
On other platforms, C11 may be required, so to fix the CentOS 7 issue
we only modify for CentOS 7.CFLAGS
三、解决:
sudo yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
之后需要每次输入:
scl enable devtoolset-7 bash
来启用,否则gcc还是系统默认版本。
验证gcc版本
gcc --version
原版本
更新后版本