I’ve been trying to compile MongoDB 6.0.15 for Alpine Linux 3.19, and it’s been quite challenging, largely due to the use of musl instead of libc.
Among the errors faced are:
In src/mongo/util/aligned.h:
code
src/mongo/util/aligned.h:135:77: warning: use of 'std::hardware_destructive_interference_size' [-Winterference-size]
135 | using CacheAligned = Aligned<T, stdx::hardware_destructive_interference_size>;
Even when trying to pass the flags -mtune, -mcpu, or --param hardware_destructive_interference_size=64, the error still persists.
Another error that has been hindering me is when compiling src/mongo/util/dns_query_posix_imp.h, I am informed that ‘res_nclose’, ‘res_ninit’, and ‘res_nstatus’ are not referenced. I have checked the file, and it contains the include for resolv.h, which I also have in my system.
I tried
python3 buildscripts/scons.py DESTDIR=/usr/bin/mongod/ install-mongod CXXFLAGS="--param hardware_destructive_interference_size=64"
but
(mongodb-src-r6.0.15) mongodb:~/mongodb-src-r6.0.15# python3 buildscripts/scons.py DESTDIR=/usr/bin/mongod/ install-mongod CXXFLAGS="--param hardware_destructive_interference_size=64"
Checking required python packages...
Requirements list:
Cheetah3<=3.2.6.post1
PyYAML==5.3.1
cryptography==2.3; platform_machine == "s390x" or platform_machine == "ppc64le"
cryptography==36.0.2; platform_machine != "s390x" and platform_machine != "ppc64le"
ninja>=1.10.0
packaging<=21.3
psutil<=5.8.0
pymongo<4.0,>=3.9
pypiwin32>=223; sys_platform == "win32" and python_version > "3"
pywin32>=225; sys_platform == "win32" and python_version > "3"
regex<=2021.11.10
requests<=2.26.0,>=2.0.0
requirements_parser<=0.3.1
setuptools
types-PyYAML~=6.0.5
Resolved to these distributions:
certifi 2024.2.2
cffi 1.16.0
charset-normalizer 2.0.12
cheetah3 3.2.6.post1
cryptography 36.0.2
idna 3.7
ninja 1.11.1.1
packaging 21.3
psutil 5.8.0
pycparser 2.22
pymongo 3.13.0
pyparsing 3.1.2
pyyaml 5.3.1
regex 2021.11.10
requests 2.26.0
requirements-parser 0.3.1
setuptools 65.5.0
types-pyyaml 6.0.12.20240311
types-setuptools 57.4.18
urllib3 1.26.18
scons: Reading SConscript files ...
scons: running with args /root/mongodb-src-r6.0.15/bin/python3 buildscripts/scons.py DESTDIR=/usr/bin/mongod/ install-mongod CXXFLAGS=--param hardware_destructive_interference_size=64
scons version: 3.1.2
python version: 3 10 14 'final' 0
CC is gcc
gcc found in $PATH at /usr/bin/gcc
CXX is g++
g++ found in $PATH at /usr/bin/g++
Checking if C++ compiler "g++" is GCC... no
Checking if C++ compiler "g++" is clang... no
Couldn't identify the C++ compiler
See /root/mongodb-src-r6.0.15/build/scons/config.log for details
Guilherme Montelo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.