From 442891c4ef6bc127ffa8d95dff6f09ca7f818c69 Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Thu, 18 Jan 2018 14:35:01 +1100 Subject: [PATCH] msan-builder: fix boost build. --- .../msan-builder/compiler_wrapper.py | 7 +++-- infra/base-images/msan-builder/msan_build.py | 5 ++-- .../msan-builder/packages/boost1_58.py | 29 +++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 infra/base-images/msan-builder/packages/boost1_58.py diff --git a/infra/base-images/msan-builder/compiler_wrapper.py b/infra/base-images/msan-builder/compiler_wrapper.py index 48ea36d0a..0643954d1 100755 --- a/infra/base-images/msan-builder/compiler_wrapper.py +++ b/infra/base-images/msan-builder/compiler_wrapper.py @@ -92,7 +92,7 @@ def RemoveZDefs(args): return filtered -def GetCompilerArgs(args): +def GetCompilerArgs(args, is_cxx): """Generate compiler args.""" compiler_args = args[1:] @@ -125,6 +125,9 @@ def GetCompilerArgs(args): # If MSan flags weren't added for some reason, add them here. compiler_args.extend(msan_build.INJECTED_ARGS) + if is_cxx: + compiler_args.append('-stdlib=libc++') + return compiler_args @@ -140,7 +143,7 @@ def main(args): if is_cxx: real_clang += '++' - args = [real_clang] + GetCompilerArgs(args) + args = [real_clang] + GetCompilerArgs(args, is_cxx) debug_log_path = os.getenv('WRAPPER_DEBUG_LOG_PATH') if debug_log_path: with open(debug_log_path, 'a') as f: diff --git a/infra/base-images/msan-builder/msan_build.py b/infra/base-images/msan-builder/msan_build.py index 2aa0cbe1d..0a62ec68e 100755 --- a/infra/base-images/msan-builder/msan_build.py +++ b/infra/base-images/msan-builder/msan_build.py @@ -215,14 +215,15 @@ def GetPackage(package_name): apt_cache = apt.Cache() version = apt_cache[package_name].candidate source_name = version.source_name + local_source_name = source_name.replace('.', '_') - custom_package_path = os.path.join(PACKAGES_DIR, source_name) + '.py' + custom_package_path = os.path.join(PACKAGES_DIR, local_source_name) + '.py' if not os.path.exists(custom_package_path): print('Using default package build steps.') return package.Package(source_name, version) print('Using custom package build steps.') - module = imp.load_source('packages.' + source_name, custom_package_path) + module = imp.load_source('packages.' + local_source_name, custom_package_path) return module.Package(version) diff --git a/infra/base-images/msan-builder/packages/boost1_58.py b/infra/base-images/msan-builder/packages/boost1_58.py new file mode 100644 index 000000000..8071b7ecd --- /dev/null +++ b/infra/base-images/msan-builder/packages/boost1_58.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# Copyright 2017 Google Inc. +# +# 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. +# +################################################################################ + +import package + + +class Package(package.Package): + """boost1.58 package.""" + + def __init__(self, apt_version): + super(Package, self).__init__('boost1.58', apt_version) + + def PreBuild(self, source_directory, env, custom_bin_dir): + # Otherwise py_nonblocking.cpp fails to build. + env['DEB_CXXFLAGS_APPEND'] += ' -std=c++98'