Huge binary size of core binaries (mongod, mongo)

Hi @Andrew_Morrow Thanks for the detailed explanation.
I was able to use --separate-debug alone for the version 4.4.12 and it reduced the size of binaries as well.
command for 4.4.12

python3 buildscripts/scons.py DESTDIR=/opt/IBM/mongo-distro install-core --disable-warnings-as-errors --separate-debug=on

I have one more requirement to build the 4.2.18 version as well. So I tried to use the same command for that, but it did not work…

error:

Cannot use --separate-debug without --install-mode=hygienic

So I tried to use the command as below:

python3 buildscripts/scons.py --prefix=/opt/IBM/mongo-distro install-core --disable-warnings-as-errors --separate-debug=on --install-mode=hygienic

But this procedure did not reduce the size of the binary. I tried to debug and found that for 4.2.18 version, I must enable the SpiderMonkey flag as well.

python3 buildscripts/scons.py --help | grep debug

--separate-debug=[on|off]   Produce separate debug files (only effective in
                              Enable SpiderMonkey debug mode

Final Command for 4.2.18:

python3 buildscripts/scons.py --prefix=/opt/IBM/mongo-distro install-core --disable-warnings-as-errors --separate-debug=on --install-mode=hygienic --spider-monkey-dbg=on

Error:

src/third_party/mozjs-60/extract/js/src/jit/VMFunctions.h:310:42: error: 'const struct js::jit::VMFunction' has no member named 'name_'
  310 |         MOZ_ASSERT(strcmp(f1->name_, f2->name_) == 0);
      |                                          ^~~~~


scons: building terminated because of errors.
build/opt/third_party/mozjs-60/extract/js/src/frontend/Parser.o failed: Error 1

Any idea on this?
Thanks!