Error creating mongodb from sources
I am trying to build mongodb from sources and get a series of errors.
Here's the pastebin of the entire issue: http://pastebin.com/pyZLTkz4
The first mistake
endian.h does not define __BYTE_ORDER nor BYTE_ORDER. Cannot determine endianness.
And all the other errors are like
error: template with C linkage
error: template specialization with C linkage
My config:
- Debian 8 64 bit
- scons version: 2.3.1
- python version: 2 7 9
- gcc version: gcc (Debian 4.9.2-10) 4.9.2
Installed dependencies with
sudo apt-get build-dep mongodb
I tried to build it under CentOS 7 and had the same result.
source to share
About the first mistake
The sys / param.h header usually defines the symbols __BYTE_ORDER, __BIG_ENDIAN, __LITTLE_ENDIAN, and __PDP_ENDIAN. You can check the assertion by doing something like:
The sys / param.h header usually defines the symbols __BYTE_ORDER, __BIG_ENDIAN, __LITTLE_ENDIAN, and __PDP_ENDIAN. You can check the assertion by doing something like:
#include <sys/param.h>
#ifdef __BYTE_ORDER
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define I_AM_LITTLE_ENDIAN
# else
# if __BYTE_ORDER == __BIG_ENDIAN
# define I_AM_BIG_ENDIAN
# else
Error: unknown byte order!
# endif
# endif
#endif /* __BYTE_ORDER */
If __BYTE_ORDER is not defined, you can check for BYTE_ORDER, BIG_ENDIAN and LITTLE_ENDIAN. Linux defines them as synonymous with underscore versions, in an attempt to be BSD Unix compatible.
If it is not defined, you can try things like:
#if defined (i386) || defined (__i386__) || defined (_M_IX86) || \
defined (vax) || defined (__alpha)
# define I_AM_LITTLE_ENDIAN
#endif
source to share
Several variants:
and. You are missing the glibc development headers.
Try installing libc6-dev (debian) or glibc-headers (redhat)
Q. You have a custom endian.h floating around your include path
You can try running:
g++ -M -Wnon-virtual-dtor -Woverloaded-virtual -std=c++11 -Wno-non-virtual-dtor -fno-omit-frame-pointer -fPIC -fno-strict-aliasing -ggdb -pthread -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -O2 -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-missing-braces -fno-builtin-memcmp -include js-confdefs.h -Wno-invalid-offsetof -DAB_CD -DIMPL_MFBT -DJS_USE_CUSTOM_ALLOCATOR -DNO_NSPR_10_SUPPORT -DSTATIC_JS_API=1 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DPCRE_STATIC -DBOOST_THREAD_VERSION=4 -DBOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS -DBOOST_THREAD_HAS_NO_EINTR_BUG -Isrc -Ibuild/opt -Isrc -Ibuild/opt/third_party/mozjs-38/extract/js/src -Isrc/third_party/mozjs-38/extract/js/src -Ibuild/opt/third_party/mozjs-38/extract/mfbt -Isrc/third_party/mozjs-38/extract/mfbt -Ibuild/opt/third_party/mozjs-38/extract/intl/icu/source/common -Isrc/third_party/mozjs-38/extract/intl/icu/source/common -Ibuild/opt/third_party/mozjs-38/include -Isrc/third_party/mozjs-38/include -Ibuild/opt/third_party/mozjs-38/mongo_sources -Isrc/third_party/mozjs-38/mongo_sources -Ibuild/opt/third_party/mozjs-38/platform/x86_64/linux/build -Isrc/third_party/mozjs-38/platform/x86_64/linux/build -Ibuild/opt/third_party/mozjs-38/platform/x86_64/linux/include -Isrc/third_party/mozjs-38/platform/x86_64/linux/include -Isrc/third_party/zlib-1.2.8 src/third_party/mozjs-38/extract/js/src/builtin/RegExp.cpp | grep endian.h
That the first compilation failure from your pastbin with '-M' is replaced with -o, which should let us see which file you are actually including as endian.h.
source to share