adding libcxx (msan version) to all rbe containers (#42)

adding libcxx (msan version) to all rbe containers

diff --git a/WORKSPACE b/WORKSPACE
index 53ea58e..cd436f0 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -209,6 +209,33 @@
     urls = ["https://storage.googleapis.com/clang-builds-stable/clang-ubuntu16_04/clang_" + CLANG_REVISION + ".tar.gz"],
 )
 
+load(
+    "//third_party/libcxx:revision.bzl",
+    "LIBCXX_REVISION",
+    "DEBIAN8_LIBCXX_SHA256",
+    "DEBIAN9_LIBCXX_SHA256",
+    "UBUNTU16_04_LIBCXX_SHA256",
+)
+
+# libcxx
+http_file(
+    name = "debian8_libcxx_release",
+    sha256 = DEBIAN8_LIBCXX_SHA256,
+    urls = ["https://storage.googleapis.com/clang-builds-stable/clang-debian8/libcxx-msan_" + LIBCXX_REVISION + ".tar.gz"],
+)
+
+http_file(
+    name = "debian9_libcxx_release",
+    sha256 = DEBIAN9_LIBCXX_SHA256,
+    urls = ["https://storage.googleapis.com/clang-builds-stable/clang-debian9/libcxx-msan_" + LIBCXX_REVISION + ".tar.gz"],
+)
+
+http_file(
+    name = "ubuntu16_04_libcxx_release",
+    sha256 = UBUNTU16_04_LIBCXX_SHA256,
+    urls = ["https://storage.googleapis.com/clang-builds-stable/clang-ubuntu16_04/libcxx-msan_" + LIBCXX_REVISION + ".tar.gz"],
+)
+
 # Test purpose only. bazel-toolchains repo at release for Bazel 0.10.0.
 # https://github.com/bazelbuild/bazel-toolchains/releases/tag/acffd62
 http_file(
diff --git a/container/experimental/rbe-debian8/BUILD b/container/experimental/rbe-debian8/BUILD
index d106805..a80ea69 100644
--- a/container/experimental/rbe-debian8/BUILD
+++ b/container/experimental/rbe-debian8/BUILD
@@ -64,9 +64,14 @@
     debs = clang_layer_packages(),
     env = {
         "CC": "/usr/local/bin/clang",
+        "ASAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
+        "MSAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
     },
     tags = ["manual"],
-    tars = ["//third_party/clang:debian8_tar"],
+    tars = [
+        "//third_party/clang:debian8_tar",
+        "//third_party/libcxx:debian8_tar",
+    ],
 )
 
 container_layer(
diff --git a/container/experimental/rbe-debian9/BUILD b/container/experimental/rbe-debian9/BUILD
index 5d0fd85..479f9ec 100644
--- a/container/experimental/rbe-debian9/BUILD
+++ b/container/experimental/rbe-debian9/BUILD
@@ -74,11 +74,15 @@
     env = {
         "CC": "/usr/local/bin/clang",
         "ASAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
+        "MSAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
     },
     packages = [
         "libstdc++-6-dev",
     ],
-    tars = ["//third_party/clang:debian9_tar"],
+    tars = [
+        "//third_party/clang:debian9_tar",
+        "//third_party/libcxx:debian9_tar",
+    ],
 )
 
 language_tool_layer(
diff --git a/container/experimental/rbe-ubuntu16_04/BUILD b/container/experimental/rbe-ubuntu16_04/BUILD
index ca70491..dc22a2b 100644
--- a/container/experimental/rbe-ubuntu16_04/BUILD
+++ b/container/experimental/rbe-ubuntu16_04/BUILD
@@ -74,11 +74,15 @@
     env = {
         "CC": "/usr/local/bin/clang",
         "ASAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
+        "MSAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
     },
     packages = [
         "libstdc++-4.9-dev",
     ],
-    tars = ["//third_party/clang:ubuntu16_04_tar"],
+    tars = [
+        "//third_party/clang:ubuntu16_04_tar",
+        "//third_party/libcxx:ubuntu16_04_tar",
+    ],
 )
 
 language_tool_layer(
diff --git a/container/rbe-debian8/BUILD b/container/rbe-debian8/BUILD
index 79a2efc..abc2b07 100644
--- a/container/rbe-debian8/BUILD
+++ b/container/rbe-debian8/BUILD
@@ -74,11 +74,15 @@
     env = {
         "CC": "/usr/local/bin/clang",
         "ASAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
+        "MSAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
     },
     packages = [
         "libstdc++-4.9-dev",
     ],
-    tars = ["//third_party/clang:debian8_tar"],
+    tars = [
+        "//third_party/clang:debian8_tar",
+        "//third_party/libcxx:debian8_tar",
+    ],
 )
 
 language_tool_layer(
diff --git a/container/test/rbe-debian8.yaml b/container/test/rbe-debian8.yaml
index 82a9181..e5abeab 100644
--- a/container/test/rbe-debian8.yaml
+++ b/container/test/rbe-debian8.yaml
@@ -85,6 +85,10 @@
   isDirectory: false
   path: '/usr/local/go/bin/go'
   shouldExist: true
+- name: 'llvm-symbolizer'
+  isDirectory: false
+  path: '/usr/local/bin/llvm-symbolizer'
+  shouldExist: true
 - name: 'sanitizer'
   isDirectory: true
   path: '/usr/local/lib/clang/7.0.0/include/sanitizer'
diff --git a/container/test/rbe-debian9.yaml b/container/test/rbe-debian9.yaml
index 2a04453..a259fab 100644
--- a/container/test/rbe-debian9.yaml
+++ b/container/test/rbe-debian9.yaml
@@ -85,6 +85,10 @@
   isDirectory: false
   path: '/usr/local/go/bin/go'
   shouldExist: true
+- name: 'llvm-symbolizer'
+  isDirectory: false
+  path: '/usr/local/bin/llvm-symbolizer'
+  shouldExist: true
 - name: 'sanitizer'
   isDirectory: true
   path: '/usr/local/lib/clang/7.0.0/include/sanitizer'
diff --git a/container/test/rbe-ubuntu16_04.yaml b/container/test/rbe-ubuntu16_04.yaml
index 62c1379..b958520 100644
--- a/container/test/rbe-ubuntu16_04.yaml
+++ b/container/test/rbe-ubuntu16_04.yaml
@@ -85,6 +85,10 @@
   isDirectory: false
   path: '/usr/local/go/bin/go'
   shouldExist: true
+- name: 'llvm-symbolizer'
+  isDirectory: false
+  path: '/usr/local/bin/llvm-symbolizer'
+  shouldExist: true
 - name: 'sanitizer'
   isDirectory: true
   path: '/usr/local/lib/clang/7.0.0/include/sanitizer'
diff --git a/third_party/clang/revision.bzl b/third_party/clang/revision.bzl
index c6cc608..5e91319 100644
--- a/third_party/clang/revision.bzl
+++ b/third_party/clang/revision.bzl
@@ -1,4 +1,4 @@
-CLANG_REVISION="r327695"
-DEBIAN8_CLANG_SHA256="588ddbd83c32e7ab87fad58038c3712f6d1b0056f12ea746169ac7ecd33c93bf"
-DEBIAN9_CLANG_SHA256="434bbe2195845e42eb36ad2b88f6aec658d192614d47f71e15b861e09f71b4bd"
-UBUNTU16_04_CLANG_SHA256="48bfc470810d483ffb2e826ed3540efc1da45fa89f416f8efa439242495e6239"
+CLANG_REVISION="r328903"
+DEBIAN8_CLANG_SHA256="8f460b909788ffd8dd467ea4ee106ccd08b4a43408dd98ac8e3938a9b6452bb7"
+DEBIAN9_CLANG_SHA256="350f77999033e39a02294406250df819cacb2106daa7b04b5fd6bfe7aa0ab5a1"
+UBUNTU16_04_CLANG_SHA256="f1874c57aa1e34c09595a4a0e03b91d7bf89dd7ad044ff4834b46198ff2e9d14"
diff --git a/third_party/libcxx/BUILD b/third_party/libcxx/BUILD
new file mode 100644
index 0000000..2e0979d
--- /dev/null
+++ b/third_party/libcxx/BUILD
@@ -0,0 +1,67 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This BUILD file is used for installing clang.tar.gz into /usr/local
+# of debian8-clang-fully-loaded container. The clang.tar.gz file was
+# downloaded by gsutil_cp rule in the WORKSPACE file, and contains
+# the same compiled clang binary as in
+# https://console.cloud.google.com/launcher/details/google/clang-debian8
+
+licenses(["notice"])  # Apache 2.0
+
+package(default_visibility = ["//visibility:public"])
+
+load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
+
+pkg_tar(
+    name = "debian8_tar",
+    srcs = glob(
+        ["**/*"],
+        exclude = ["**/BUILD"],
+    ),
+    package_dir = "/usr/local/",
+    strip_prefix = ".",
+    tags = ["manual"],
+    deps = [
+        "@debian8_libcxx_release//file",
+    ],
+)
+
+pkg_tar(
+    name = "debian9_tar",
+    srcs = glob(
+        ["**/*"],
+        exclude = ["**/BUILD"],
+    ),
+    package_dir = "/usr/local/",
+    strip_prefix = ".",
+    tags = ["manual"],
+    deps = [
+        "@debian9_libcxx_release//file",
+    ],
+)
+
+pkg_tar(
+    name = "ubuntu16_04_tar",
+    srcs = glob(
+        ["**/*"],
+        exclude = ["**/BUILD"],
+    ),
+    package_dir = "/usr/local/",
+    strip_prefix = ".",
+    tags = ["manual"],
+    deps = [
+        "@ubuntu16_04_libcxx_release//file",
+    ],
+)
diff --git a/third_party/libcxx/revision.bzl b/third_party/libcxx/revision.bzl
new file mode 100644
index 0000000..28baf11
--- /dev/null
+++ b/third_party/libcxx/revision.bzl
@@ -0,0 +1,4 @@
+LIBCXX_REVISION="r328903"
+DEBIAN8_LIBCXX_SHA256="d9798333832690577ca740acb3016a803be684ad0ed02e78922424b4b651f8ce"
+DEBIAN9_LIBCXX_SHA256="66219b838f8d243c071a4c094e13ef78082cd858d87841dd607839a351680b90"
+UBUNTU16_04_LIBCXX_SHA256="786a35a813e493342a018c04b8fb951a8b34a7d7e377e1ac793db738fc240451"