2
I'm attempting to build MongoDB v4.0 on CentOS7 (https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source), and am unfamiliar with the python toolset included for building. The toolset requires gcc8.2 or newer, which I have installed with devtoolset-8-gcc
and devtoolset-8-g++
. I enable the toolset using scl enable devtoolset-8 bash
And execute the scons build following the build guide, however scons appears to build its own environment which doesnt include the library at /opt/rh/devtoolset-8/
.
[user@localhost mongo.git]$ sudo scl enable devtoolset-8 bash
[sudo] password for user:
[root@localhost mongo.git]# gcc --version
gcc (GCC) 8.2.1 20180905 (Red Hat 8.2.1-3)
Copyright (C) 2018 Free Software Foundation, Inc.
...
[root@localhost mongo.git]# ./buildscripts/scons.py
scons: Reading SConscript files ...
scons version: 2.5.0
python version: 2 7 5 'final' 0
...
Checking if C compiler is GCC 8.2 or newer...no
Checking if C++ compiler is GCC 8.2 or newer...no
ERROR: Refusing to build with compiler that does not meet requirements
See /opt/mongodb/mongo.git/build/scons/config.log for details
The log file contents are available at https://pastebin.com/jB2q4NxN.
My attempts to modify the python script to include the path per the scons manual have netted another error:
[root@localhost mongo.git]# buildscripts/scons.py all
Traceback (most recent call last):
File "buildscripts/scons.py", line 7, in <module>
env = Environment(ENV = {'PATH' : os.environ['PATH']})
NameError: name 'Environment' is not defined
After I added the lines
import os
env = Environment(ENV = {'PATH' : os.environ['PATH']})
To my buildscripts/scons.py
file. Am I adding this in the wrong place perhaps? Why is the environment variable not available?
Thanks.
You are already logged in as root, so
sudo
is unnecessary and will change to a new environment. You should be able to build fine as a normal (non-root) user or withoutsudo
. There should be no need to modify the MongoDB build scripts; this is a hint that you're probably taking an incorrect approach. – Stennie – 2019-04-06T00:03:46.630Hi Stennie. Good catch, thanks, but the same error remains.
[user@localhost mongo.git]$ sudo scl enable devtoolset-8 bash [sudo] password for user: [root@localhost mongo.git]# ./buildscripts/scons.py scons: Reading SConscript files ... scons version: 2.5.0 python version: 2 7 5 'final' 0 ... Checking if C compiler is GCC 5.3.0 or newer...no Checking if C++ compiler is GCC 5.3.0 or newer...no ERROR: Refusing to build with compiler that does not meet requirements See /opt/mongodb/mongo.git/build/scons/config.log for details
– gangr33n – 2019-04-08T07:29:01.730Can you edit your question to include the output of
/opt/mongodb/mongo.git/build/scons/config.log
(or a link to pastebin/gist if it's too large to include inline)? – Stennie – 2019-04-08T07:56:40.507I have added a link. It appears to just reiterate the error. – gangr33n – 2019-04-08T09:27:51.603