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.
There is no good reason for a specification to demand a version of MongoDB with any more specificity than major.minor version, which is what describes the feature set. So, it would be reasonable for a product specification to say it required MongoDB v3.6, or v4.2, or similar. But specifying the patch level simply means that the resulting product will be forever ineligible for bugfixes to the database layer, which can’t be what was intended. You should endeavor to get this restriction lifted so you can use v.3.6.17 or newer. Or, please let us know what is so special about v3.6.9 that you can’t use a newer v3.6 version. Is there a bug in v3.6 versions newer than v3.6.9 that has not yet been fixed on the v3.6 branch? If so, we would want to know so we could address it. More information here will be very helpful.
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
This all looks fine. Note that the system SCons version is irrelevant, since the MongoDB source tree contains its own copy of SCons, used by buildscripts/scons.py.
how you obtained the source code
Downloaded from below link
Fine, but see my notes below. You will have an easier time if you download instead from the download center.
any local edits to the source code
[quote=“Harpinder_Kaur, post:4, topic:2701”]
- I had to include dummy version.json file, kept at root of code directory with below content as compilation was halting due to version not getting derived. Followed SERVER-21317 for the workaround
More on this below.
- As per
Mongo Ticket SERVER-36206
, included --disable-warnings-as-errors
flag
This shouldn’t be necessary if you are building with GCC 5.4 as you indicate. What happens if you don’t use it?
- Per
Mongo Ticket SERVER-31439
, added os.environ in PATH in SConstruct file
[/quote]
This also shouldn’t be necessary, especially since you are using --variables-files=…/propagate_shell_environment.vars, which does this for you. I suggest backing this change out, as it will make your build nondeterministic.
python buildscripts/scons.py all --variables-files=etc/scons/propagate_shell_environment.vars --disable-warnings-as-errors
With a properly configured GCC 5.4 installation, neither of these flags should be required. Also, I don’t see where you are specifying that you want to use your GCC 5.4 installation. I’d expect to see something like CC=gcc-5.4 CXX=g+±5.4 here. Where did you install GCC-5.4 and what are the paths to the GCC 5.4 gcc and g++ binaries?
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
This was my mistake - the variable is called MONGO_GIT_HASH (note the extra _).
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.
The problem is that the github based archives don’t contain the version metadata, which is why you need to mess around with MONGO_VERSION and MONGO_GIT_HASH to make this work. However, the source downloads from the mongodb download site do contain the data already. Please try downloading the source from Download MongoDB Community Server | MongoDB instead. That will contain a pre-populated version.json.
Alternatively, use MONGO_GIT_HASH, and it won’t try to call git describe.
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
Please post the contents of the config.log. Anytime you get this message, you should post the contents of config.log.