Docker build for git 2.39.1 error Required C99 support is in a test phase

Hi All,

we are trying to update git version 2.29.1 using docker version 20.X but getting below error -
GIT_VERSION = 2.39.1
* new build flags
CC oss-fuzz/fuzz-commit-graph.o
In file included from ./commit-graph.h:4:0,
from oss-fuzz/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: *** [oss-fuzz/fuzz-commit-graph.o] Error 1

dockerFile code snippet

FROM centos:7
RUN yum clean all
RUN yum remove git -y
#RUN yum install git -y
#Install Git with Required Version(Current Setup - 2.39.1)
RUN yum -y install gcc make
RUN yum -y install wget zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
RUN wget -O v2.39.1.tar.gz
RUN tar -xzvf ./v2.39.1.tar.gz
RUN cd git-2.39.1/
&& make prefix=/usr/local all
&& make prefix=/usr/local install
&& export PATH=/usr/local/git/bin:$PATH
&& source /etc/bashrc

RUN cd …
RUN git --version

Any help to resolve this will be much appreciated

I’m a bit late, but I had this problem recently and was pretty tough for me to figure out. I hope this helps you or someone else running into similar errors.

Linux 7 (RHEL 7, CentOS 7, and Oracle Linux 7 for example) default to an older gcc. On my OS it was 4.x something. You likely need to install devtoolset-12 and compile with scl enable devtoolset-12 'command'

Alternatively, you can launch bash with scl enable devtoolset-12 bash and that will create a new subshell where the v12 of dev tools are enabled and the subsequent commands will run in that subshell (Assuming you have bash installed)

You can get more info from RedHat or some searching to get more info.

For my use case I used the scl enable devtoolset-12 bash and then ran all my Make commands in there. Good luck!

EDIT: I did my first attempt using v10. I see, now, that v12 is the latest available in my Repo. So, probably a good idea to use the newest devtoolset-XY that is available to you.

This is the sum of everything I ended up writing down for later next time I have to build git for an older OS.

curl -sS -o git-2.40.0.tar.gz
tar -zxf git-2.40.0.tar.gz
cd git-2.40.0
curl -sS -o git-manpages-2.40.0.tar.gz
curl -sS -o git-htmldocs-2.40.0.tar.gz

#This works on Oracle Linux 7, may need to be modified for other distros.
# devtoolset-12 and perl-ExtUtils-Embeded were the hard to find additions.
sudo yum install dh-autoreconf curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel asciidoc xmlto docbook2X getopt devtoolset-12 perl-ExtUtils-Embeded

# This will fail if there is already a file there.
sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi && echo "Ignoring that file or link already existed."

# This was another key line for making progress on OL7.
scl enable devtoolset-12 bash

make configure

   # Note to self:  If you get weird **bleep** Perl errors, might need to reinstall perl.

./configure --prefix=/usr ;# as yourself
make all doc info ;# as yourself
sudo make install install-doc install-html install-info;# as root

# If the previous commands don't install the docs, here's the manual way. I needed this.
sudo tar -zxf git-manpages-2.40.0.tar.gz -C $(git --man-path)
sudo tar -zxf git-htmldocs-2.40.0.tar.gz -C $(git --html-path)