Bug 1704766 - Remove libstdc++ from clang toolchains. r=firefox-build-system-reviewers,andi

Differential Revision: https://phabricator.services.mozilla.com/D119140
This commit is contained in:
Mike Hommey
2021-07-16 04:09:54 +00:00
parent 2664022732
commit 6c61b3d0e3
18 changed files with 5 additions and 63 deletions

View File

@@ -30,7 +30,6 @@ build-clang.py accepts a JSON config format with the following fields:
* stages: Use 1, 2, 3 or 4 to select different compiler stages. The default is 3.
* python_path: Path to the Python 2.7 installation on the machine building clang.
* gcc_dir: Path to the gcc toolchain installation, only required on Linux.
* cc: Path to the bootsraping C Compiler.
* cxx: Path to the bootsraping C++ Compiler.
* as: Path to the assembler tool.

View File

@@ -21,7 +21,6 @@ import sys
import tarfile
from contextlib import contextmanager
from distutils.dir_util import copy_tree
from distutils.file_util import copy_file
from shutil import which
@@ -167,37 +166,6 @@ def delete(path):
pass
def install_libgcc(gcc_dir, clang_dir, is_final_stage):
gcc_bin_dir = os.path.join(gcc_dir, "bin")
out = subprocess.check_output(
[os.path.join(gcc_bin_dir, "gcc"), "-print-libgcc-file-name"]
)
libgcc_dir = os.path.dirname(out.decode().rstrip())
clang_lib_dir = os.path.join(
clang_dir,
"lib",
"gcc",
"x86_64-unknown-linux-gnu",
os.path.basename(libgcc_dir),
)
mkdir_p(clang_lib_dir)
copy_tree(libgcc_dir, clang_lib_dir, preserve_symlinks=True)
libgcc_dir = os.path.join(gcc_dir, "lib64")
# This is necessary as long as CI runs on debian8 docker images.
copy_file(
os.path.join(libgcc_dir, "libstdc++.so.6"), os.path.join(clang_dir, "lib")
)
copy_tree(libgcc_dir, clang_lib_dir, preserve_symlinks=True)
libgcc_dir = os.path.join(gcc_dir, "lib32")
clang_lib_dir = os.path.join(clang_lib_dir, "32")
copy_tree(libgcc_dir, clang_lib_dir, preserve_symlinks=True)
include_dir = os.path.join(gcc_dir, "include")
clang_include_dir = os.path.join(clang_dir, "include")
copy_tree(include_dir, clang_include_dir, preserve_symlinks=True)
def install_import_library(build_dir, clang_dir):
shutil.copy2(
os.path.join(build_dir, "lib", "clang.lib"), os.path.join(clang_dir, "lib")
@@ -248,7 +216,6 @@ def build_one_stage(
build_type,
assertions,
python_path,
gcc_dir,
libcxx_include_dir,
build_wasm,
compiler_rt_source_dir=None,
@@ -314,6 +281,10 @@ def build_one_stage(
sysroot = os.path.join(os.environ.get("MOZ_FETCHES_DIR", ""), "sysroot")
if os.path.exists(sysroot):
cmake_args += ["-DCMAKE_SYSROOT=%s" % sysroot]
# Work around the LLVM build system not building the i386 compiler-rt
# because it doesn't allow to use a sysroot for that during the cmake
# checks.
cmake_args += ["-DCAN_TARGET_i386=1"]
if is_windows():
cmake_args.insert(-1, "-DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON")
cmake_args.insert(-1, "-DLLVM_USE_CRT_RELEASE=MT")
@@ -439,8 +410,6 @@ def build_one_stage(
cmake_args += [src_dir]
build_package(build_dir, cmake_args)
if is_linux():
install_libgcc(gcc_dir, inst_dir, is_final_stage)
# For some reasons the import library clang.lib of clang.exe is not
# installed, so we copy it by ourselves.
if is_windows():
@@ -746,11 +715,6 @@ if __name__ == "__main__":
if "python_path" not in config:
raise ValueError("Config file needs to set python_path")
python_path = config["python_path"]
gcc_dir = None
if "gcc_dir" in config:
gcc_dir = config["gcc_dir"].format(**os.environ)
if not os.path.exists(gcc_dir):
raise ValueError("gcc_dir must point to an existing path")
ndk_dir = None
android_targets = None
if "android_targets" in config:
@@ -770,9 +734,6 @@ if __name__ == "__main__":
if not all(isinstance(t, str) for t in extra_targets):
raise ValueError("members of extra_targets should be strings")
if is_linux() and gcc_dir is None:
raise ValueError("Config file needs to set gcc_dir")
if is_darwin() or osx_cross_compile:
os.environ["MACOSX_DEPLOYMENT_TARGET"] = (
"11.0" if os.environ.get("OSX_ARCH") == "arm64" else "10.12"
@@ -924,7 +885,6 @@ if __name__ == "__main__":
build_type,
assertions,
python_path,
gcc_dir,
libcxx_include_dir,
build_wasm,
is_final_stage=(stages == 1),
@@ -954,7 +914,6 @@ if __name__ == "__main__":
build_type,
assertions,
python_path,
gcc_dir,
libcxx_include_dir,
build_wasm,
compiler_rt_source_dir,
@@ -987,7 +946,6 @@ if __name__ == "__main__":
build_type,
assertions,
python_path,
gcc_dir,
libcxx_include_dir,
build_wasm,
compiler_rt_source_dir,
@@ -1029,7 +987,6 @@ if __name__ == "__main__":
build_type,
assertions,
python_path,
gcc_dir,
libcxx_include_dir,
build_wasm,
compiler_rt_source_dir,

View File

@@ -6,7 +6,6 @@
"build_type": "Release",
"assertions": false,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -4,7 +4,6 @@
"build_type": "Release",
"assertions": false,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -6,7 +6,6 @@
"build_type": "Release",
"assertions": false,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -5,7 +5,6 @@
"assertions": false,
"osx_cross_compile": true,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/clang/bin/clang",
"cxx": "{MOZ_FETCHES_DIR}/clang/bin/clang++",
"as": "{MOZ_FETCHES_DIR}/clang/bin/clang",

View File

@@ -4,7 +4,6 @@
"build_type": "Release",
"assertions": false,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -6,7 +6,6 @@
"build_type": "Release",
"assertions": false,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -5,7 +5,6 @@
"assertions": false,
"osx_cross_compile": true,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/clang/bin/clang",
"cxx": "{MOZ_FETCHES_DIR}/clang/bin/clang++",
"as": "{MOZ_FETCHES_DIR}/clang/bin/clang",

View File

@@ -5,7 +5,6 @@
"build_type": "Release",
"assertions": false,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -4,7 +4,6 @@
"build_type": "Release",
"assertions": false,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -4,7 +4,6 @@
"build_type": "Release",
"assertions": false,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -6,7 +6,6 @@
"build_type": "Release",
"assertions": false,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -5,7 +5,6 @@
"assertions": false,
"build_clang_tidy": true,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -5,7 +5,6 @@
"assertions": false,
"build_clang_tidy": true,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -6,7 +6,6 @@
"build_clang_tidy": true,
"osx_cross_compile": true,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/clang/bin/clang",
"cxx": "{MOZ_FETCHES_DIR}/clang/bin/clang++",
"as": "{MOZ_FETCHES_DIR}/clang/bin/clang",

View File

@@ -5,7 +5,6 @@
"build_type": "Release",
"assertions": false,
"python_path": "/usr/bin/python2.7",
"gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",

View File

@@ -72,6 +72,7 @@ linux64-toolchain-sysroot:
# For clang
- binutils-dev
- gcc-multilib
- lib32stdc++-7-dev
- libxml2-dev
# For minidump-stackwalk
- libcurl4-openssl-dev