Hi Satya,
I tried to compile mongod using the documentation pointed at by @Doug_Duncan on my Mac, and it seems straightforward. Here’s exactly what I did:
$ git clone https://github.com/mongodb/mongo.git
$ cd mongo
$ git checkout r4.2.8
$ pip3 install -r etc/pip/compile-requirements.txt
$ python3 buildscripts/scons.py mongod
... 25 minutes later ...
Install file: "build/opt/mongo/mongod" as "mongod"
scons: done building targets.
$ build/opt/mongo/mongod --version
db version v4.2.8
git version: 43d25964249164d76d5e04dd6cf38f6111e21f5f
allocator: system
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
Seems to be working just fine. One caveat is to check out the build instructions for the version you wanted to build, since for version 4.2.8 that I tried, the build target is called mongod. For the master branch, it’s called install-mongod.
The error you posted: could not derive from version.json or git metadata seems to indicate that you did not do a git clone of the mongo repository, so it doesn’t know which version to build. You might want to check if the step-by-step method using git clone like I did above works first before trying anything else, to confirm that you have the required tools.
Best regards,
Kevin