This is happening while building the embedded SpiderMonkey engine ("mozjs" - Mozilla JavaScript, version 38).
As you're using a VERBOSE=1 build in SCONS, you're seeing that an include directory is added via the -I
switch to compile with -Ibuild/opt/third_party/mozjs-38/extract/mfbt
. Because of the very aggressive behavior of -I
, this means any include files in that directory will pre-empt any system include files of the same name.
(For why -I
acts this way, see "Why do projects use the -I include switch given the dangers?". I'll add for Google crawlers that builds circa 2018 use SpiderMonkey 45, so the directory is -Ibuild/opt/third_party/mozjs-45/extract/mfbt
)
So what's happening is that the mfbt/Endian.h
file (which brings in a bunch of high-level C++ definitions) is overriding your system's low-level /usr/include/endian.h
file, which is wreaking havoc when anyone tries to #include <endian.h>
to get the system definitions.
The question you likely have is why is it only happening to you...and a few others.
I'm going to guess the reason is probably the same as in my case, which led me to this question: your MongoDB source files are on a filesystem that is retrieving them case-insensitively. So perhaps you are running a Debian Linux VM but have your files on a Windows host.
Most people building on Linux are using fully case-sensitive filesystems, that wouldn't have an Endian.h
considered as a candidate to override their system's endian.h
. So their builds succeed.
If you are running a version of Windows 10 since the April 2018 update, and have the Windows Subsystem for Linux enabled, then you can set specific Windows directories to be case-sensitive, e.g.
fsutil.exe file SetCaseSensitiveInfo C:\Projects\mongo\src\third_party\mozjs-45\extract\mfbt enable
Unfortunately, it's something you have to set up on each individual folder...you can't do it for entire subtrees. :-(