summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathew Robinson <mathew@chasinglogic.io>2020-02-24 13:44:41 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-24 19:53:44 +0000
commit551ae2747bdbd52b58e29e226d4bc1fb2b603a3e (patch)
tree82dfb4f2edfa77d760b8ee7b725c7930c4f6defd
parenteae0b5ee0dabf2cc01008c3e4eb1c82ced80f629 (diff)
downloadmongo-551ae2747bdbd52b58e29e226d4bc1fb2b603a3e.tar.gz
SERVER-40943 Define a variables file to build with brew llvm and the remote v3 clang
-rw-r--r--etc/scons/icecream_homebrew_macosx.vars28
-rw-r--r--etc/scons/icecream_remote_mongodbtoolchain.vars (renamed from etc/scons/icecream_macosx_via_linux_cross.vars)0
-rw-r--r--etc/scons/icecream_xcode_macosx.vars9
-rw-r--r--etc/scons/mongodbtoolchain_v3_gcc.vars2
-rw-r--r--site_scons/site_tools/icecream.py11
5 files changed, 40 insertions, 10 deletions
diff --git a/etc/scons/icecream_homebrew_macosx.vars b/etc/scons/icecream_homebrew_macosx.vars
new file mode 100644
index 00000000000..0ba7164a456
--- /dev/null
+++ b/etc/scons/icecream_homebrew_macosx.vars
@@ -0,0 +1,28 @@
+# Configures the build to use Toolchain Clang to build with icecream
+# cross compiling for macOS, using homebrew for local and the MongoDB
+# toolchain for remote. You will need brew's llvm@7 installed.
+
+import os
+import subprocess
+import SCons.Defaults
+
+exec(open('etc/scons/xcode_macosx.vars', "rb").read())
+
+# TODO: When we bump the toolchain, these need to move to an equivalent
+# LLVM version. Currently, the stable MongoDB toolchain (v3) uses clang 7.
+CC = "/usr/local/opt/llvm@7/bin/clang"
+CXX = "/usr/local/opt/llvm@7/bin/clang++"
+
+for tool in [CC, CXX]:
+ try:
+ result = subprocess.check_output([tool, '--version']).decode('utf-8').strip()
+ except subprocess.CalledProcessError as e:
+ print('Failed while invoking toolchain binary ' + CXX + ': ' + str(e.output))
+ print('Please ensure that the homebrew llvm@7 package is correctly installed')
+ SCons.Script.Exit(-1)
+ except OSError as e:
+ print('Failed to invoke toolchain binary ' + CXX + ': ' + str(e))
+ print('Please install the homebrew llvm@7 package')
+ SCons.Script.Exit(-1)
+
+exec(open('etc/scons/icecream_remote_mongodbtoolchain.vars', "rb").read())
diff --git a/etc/scons/icecream_macosx_via_linux_cross.vars b/etc/scons/icecream_remote_mongodbtoolchain.vars
index b8f3e75f979..b8f3e75f979 100644
--- a/etc/scons/icecream_macosx_via_linux_cross.vars
+++ b/etc/scons/icecream_remote_mongodbtoolchain.vars
diff --git a/etc/scons/icecream_xcode_macosx.vars b/etc/scons/icecream_xcode_macosx.vars
index 1d0060a01f3..dc8237b416b 100644
--- a/etc/scons/icecream_xcode_macosx.vars
+++ b/etc/scons/icecream_xcode_macosx.vars
@@ -1,4 +1,9 @@
# Configures the build to use Toolchain Clang to build with icecream
-# cross compiling for macOS
+# cross compiling for macOS, using Xcode for local and the MongoDB
+# toolchain for remote. This will only work if your Xcode version
+# closely matches the mongodbtoolchain version w.r.t. clang. Currently
+# the MongoDB toolchain v3 uses clang-7, so this would only work with
+# XCode 10.
+
exec(open('etc/scons/xcode_macosx.vars', "rb").read())
-exec(open('etc/scons/icecream_macosx_via_linux_cross.vars', "rb").read())
+exec(open('etc/scons/icecream_remote_mongodbtoolchain.vars', "rb").read())
diff --git a/etc/scons/mongodbtoolchain_v3_gcc.vars b/etc/scons/mongodbtoolchain_v3_gcc.vars
index 784d981568e..f4d08f688ef 100644
--- a/etc/scons/mongodbtoolchain_v3_gcc.vars
+++ b/etc/scons/mongodbtoolchain_v3_gcc.vars
@@ -33,7 +33,7 @@ try:
AS = subprocess.check_output([CXX, '-print-prog-name=as']).decode('utf-8').strip()
OBJCOPY = subprocess.check_output([CXX, '-print-prog-name=objcopy']).decode('utf-8').strip()
except subprocess.CalledProcessError as e:
- print('Failed while invoking toolchain binary ' + CXX + ': ' + e.output)
+ print('Failed while invoking toolchain binary ' + CXX + ': ' + str(e.output))
SCons.Script.Exit(-1)
except OSError as e:
print('Failed to invoke toolchain binary ' + CXX + ': ' + str(e))
diff --git a/site_scons/site_tools/icecream.py b/site_scons/site_tools/icecream.py
index a20b5d9bdba..5ed9faa9456 100644
--- a/site_scons/site_tools/icecream.py
+++ b/site_scons/site_tools/icecream.py
@@ -148,13 +148,10 @@ def generate(env):
env.Command(
target="$ICECC_VERSION",
source=["$CC", "$CXX"],
- action=SCons.Action.ListAction(
- [
- SCons.Defaults.Mkdir("${ICECC_VERSION.Dir('').abspath}"),
- cmdstr + " -o $TARGET $ICECC_VERSION_URL",
- ],
- "Downloading environment: $TARGET from $ICECC_VERSION_URL",
- ),
+ action=[
+ SCons.Defaults.Mkdir("${ICECC_VERSION.Dir('').abspath}"),
+ cmdstr + " -o $TARGET $ICECC_VERSION_URL",
+ ],
)
else:
env["ICECC_VERSION"] = env.File("$ICECC_VERSION")