Facing issues while compiling "v3.6.9-dbaas-testing" branch

Noted, thanks for the feedback

As per the product specifications I have to specifically work for MongoDB 3.6.9 version and there is no plan for updates in near future so I’ll have to stick to it only.

OS Distro and Version → Centos 7
[root@portal4 mongo-r3.6.9]# uname -a Linux portal4 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

GCC Version
gcc (GCC) 5.4.0
Followed https://community.webfaction.com/questions/20158/installing-gcc-54 link to install gcc 5.4.0 version.
Python version
[root@portal4 mongo-r3.6.9]# python --version Python 2.7.5
Clang version
[root@portal4 mongo-r3.6.9]# clang --version
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
Target: x86_64-redhat-linux-gnu
Thread model: posix
SCons version
[root@portal4 mongo-r3.6.9]# scons --version
SCons by Steven Knight et al.:
script: v3.1.2.bee7caf9defd6e108fc2998a2520ddb36a967691, 2019-12-17 02:07:09, by bdeegan on octodog
engine: v3.1.2.bee7caf9defd6e108fc2998a2520ddb36a967691, 2019-12-17 02:07:09, by bdeegan on octodog
engine path: ['/usr/lib/scons/SCons']
Copyright (c) 2001 - 2019 The SCons Foundation

how you obtained the source code
Downloaded from below link

any local edits to the source code

python buildscripts/scons.py all --variables-files=etc/scons/propagate_shell_environment.vars --disable-warnings-as-errors

Not sure, no other process was running on machine while compiling the code. The VM was dedicated for compilation purpose only
[root@portal4 mongo-r3.6.9]# free -m
total used free shared buff/cache available
Mem: 11853 624 524 8 10704 11094
Swap: 4095 0 4095

This was the error:
[root@portal4 mongo-r3.6.9]# python buildscripts/scons.py all --disable-warnings-as-errors
scons: Reading SConscript files ...
Invalid MONGO_VERSION '', or could not derive from version.json or git metadata. Please add a conforming MONGO_VERSION=x.y.z[-extra] as an argument to SCons
[root@portal4 mongo-r3.6.9]#
[root@portal4 mongo-r3.6.9]# python buildscripts/scons.py all
scons: Reading SConscript files ...
Invalid MONGO_VERSION '', or could not derive from version.json or git metadata. Please add a conforming MONGO_VERSION=x.y.z[-extra] as an argument to SCons

I had tried below command which resulted in unknown variable message MONGO_GITHASH but instead of removing MONGO_GITHASH from command line I added version.json
[root@portal4 mongo-r3.6.9]# python buildscripts/scons.py MONGO_VERSION=3.6.9 MONGO_GITHASH=none all
scons: Reading SConscript files ...
Mkdir("build/scons")
scons version: 2.5.0
python version: 2 7 5 'final' 0
Unknown variables specified: MONGO_GITHASH

Also git describe was not going to return any output as I had downloaded the code instead of cloning it. So opted for version.json workaround.

If I don’t add PATH in SConstruct file I get below error:
[root@portal4 mongo-r3.6.9]# python buildscripts/scons.py all
scons: Reading SConscript files ...
scons version: 2.5.0
python version: 2 7 5 'final' 0
Checking whether the C compiler works... yes
Checking whether the C++ compiler works... yes
Checking that the C++ compiler can link a C++ program... yes
Checking if C++ compiler "g++" is GCC... yes
Checking if C compiler "gcc" is GCC... yes
Detected a x86_64 processor
Checking if target OS linux is supported by the toolchain... yes
Checking if C compiler is GCC 5.3.0 or newer...no
Checking if C++ compiler is GCC 5.3.0 or newer...no
ERROR: Refusing to build with compiler that does not meet requirements
See /root/mongoCompilation_TagCode/mongo-r3.6.9/build/scons/config.log for details
So i had to include the PATH variable to SConstruct file

I hope I have answered the required questions, let me know if you need further information.
Thanks in advance!