Bug 1332022 - Part 1: Use the libc++ headers from the libc++ project being built; r=mystor
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 18 Jan 2017 20:20:55 -0500
changeset 377379 a53ab3797b587497912599a71be22801b0854b67
parent 377378 7de6b3754a9de76b6c1ca01d544118d89ea3056f
child 377380 553487547cc00e8fca060adba4e5c5a64ca3cfe6
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmystor
bugs1332022
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1332022 - Part 1: Use the libc++ headers from the libc++ project being built; r=mystor LLVM relies on new libc++ features that may not be present in the system headers.
build/build-clang/README
build/build-clang/build-clang.py
taskcluster/scripts/misc/build-clang-tidy-macosx.sh
--- a/build/build-clang/README
+++ b/build/build-clang/README
@@ -51,9 +51,8 @@ build-clang.py accepts a JSON config for
 
 Environment Variables
 ---------------------
 
 The following environment variables are used for cross-compile builds targeting OS X on Linux.
 
 * CROSS_CCTOOLS_PATH: Path to the cctools directory where the cross compiler toolchain is located.
 * CROSS_SYSROOT: Path to the OS X SDK directory for cross compile builds.
-* LIBCXX_INCLUDE_PATH: Path to the cross compiler libc++ headers.
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -198,17 +198,17 @@ def is_linux():
 
 def is_windows():
     return platform.system() == "Windows"
 
 
 def build_one_stage(cc, cxx, ld, ar, ranlib,
                     src_dir, stage_dir, build_libcxx,
                     osx_cross_compile, build_type, assertions,
-                    python_path, gcc_dir):
+                    python_path, gcc_dir, libcxx_include_dir):
     if not os.path.exists(stage_dir):
         os.mkdir(stage_dir)
 
     build_dir = stage_dir + "/build"
     inst_dir = stage_dir + "/clang"
 
     # If CMake has already been run, it may have been run with different
     # arguments, so we need to re-run it.  Make sure the cached copy of the
@@ -244,17 +244,17 @@ def build_one_stage(cc, cxx, ld, ar, ran
         cmake_args.insert(-1, "-DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON")
         cmake_args.insert(-1, "-DLLVM_USE_CRT_RELEASE=MT")
     if ranlib is not None:
         cmake_args += ["-DCMAKE_RANLIB=%s" % slashify_path(ranlib)]
     if osx_cross_compile:
         cmake_args += ["-DCMAKE_SYSTEM_NAME=Darwin",
                        "-DCMAKE_SYSTEM_VERSION=10.10",
                        "-DLLVM_ENABLE_THREADS=OFF",
-                       "-DLIBCXXABI_LIBCXX_INCLUDES=%s" % slashify_path(os.getenv("LIBCXX_INCLUDE_PATH")),
+                       "-DLIBCXXABI_LIBCXX_INCLUDES=%s" % libcxx_include_dir,
                        "-DCMAKE_OSX_SYSROOT=%s" % slashify_path(os.getenv("CROSS_SYSROOT")),
                        "-DCMAKE_FIND_ROOT_PATH=%s" % slashify_path(os.getenv("CROSS_CCTOOLS_PATH")),
                        "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER",
                        "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY",
                        "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY",
                        "-DCMAKE_MACOSX_RPATH=@executable_path",
                        "-DCMAKE_OSX_ARCHITECTURES=x86_64",
                        "-DDARWIN_osx_ARCHS=x86_64",
@@ -518,16 +518,19 @@ if __name__ == "__main__":
             symlink(l[0], l[1])
 
     if build_clang_tidy:
         import_clang_tidy(llvm_source_dir)
 
     if not os.path.exists(build_dir):
         os.makedirs(build_dir)
 
+    libcxx_include_dir = os.path.join(llvm_source_dir, "projects",
+                                      "libcxx", "include")
+
     stage1_dir = build_dir + '/stage1'
     stage1_inst_dir = stage1_dir + '/clang'
 
     final_stage_dir = stage1_dir
 
     if is_darwin():
         extra_cflags = []
         extra_cxxflags = ["-stdlib=libc++"]
@@ -577,44 +580,44 @@ if __name__ == "__main__":
                          "-Wl,-dead_strip"]
 
     build_one_stage(
         [cc] + extra_cflags,
         [cxx] + extra_cxxflags,
         [ld] + extra_ldflags,
         ar, ranlib,
         llvm_source_dir, stage1_dir, build_libcxx, osx_cross_compile,
-        build_type, assertions, python_path, gcc_dir)
+        build_type, assertions, python_path, gcc_dir, libcxx_include_dir)
 
     if stages > 1:
         stage2_dir = build_dir + '/stage2'
         stage2_inst_dir = stage2_dir + '/clang'
         final_stage_dir = stage2_dir
         build_one_stage(
             [stage1_inst_dir + "/bin/%s%s" %
                 (cc_name, exe_ext)] + extra_cflags2,
             [stage1_inst_dir + "/bin/%s%s" %
                 (cxx_name, exe_ext)] + extra_cxxflags2,
             [ld] + extra_ldflags,
             ar, ranlib,
             llvm_source_dir, stage2_dir, build_libcxx, osx_cross_compile,
-            build_type, assertions, python_path, gcc_dir)
+            build_type, assertions, python_path, gcc_dir, libcxx_include_dir)
 
     if stages > 2:
         stage3_dir = build_dir + '/stage3'
         final_stage_dir = stage3_dir
         build_one_stage(
             [stage2_inst_dir + "/bin/%s%s" %
                 (cc_name, exe_ext)] + extra_cflags2,
             [stage2_inst_dir + "/bin/%s%s" %
                 (cxx_name, exe_ext)] + extra_cxxflags2,
             [ld] + extra_ldflags,
             ar, ranlib,
             llvm_source_dir, stage3_dir, build_libcxx, osx_cross_compile,
-            build_type, assertions, python_path, gcc_dir)
+            build_type, assertions, python_path, gcc_dir, libcxx_include_dir)
 
     package_name = "clang"
     if build_clang_tidy:
         prune_final_dir_for_clang_tidy(os.path.join(final_stage_dir, "clang"))
         package_name = "clang-tidy"
 
     if is_darwin() or is_windows():
         build_tar_package("tar", package_name + ".tar.bz2", final_stage_dir, "clang")
--- a/taskcluster/scripts/misc/build-clang-tidy-macosx.sh
+++ b/taskcluster/scripts/misc/build-clang-tidy-macosx.sh
@@ -12,17 +12,16 @@ cd $HOME_DIR/src
 TOOLTOOL_MANIFEST=browser/config/tooltool-manifests/macosx64/cross-clang.manifest
 . taskcluster/scripts/misc/tooltool-download.sh
 
 # ld needs libLTO.so from llvm
 export LD_LIBRARY_PATH=$HOME_DIR/src/clang/lib
 # these variables are used in build-clang.py
 export CROSS_CCTOOLS_PATH=$HOME_DIR/src/cctools
 export CROSS_SYSROOT=$HOME_DIR/src/MacOSX10.10.sdk
-export LIBCXX_INCLUDE_PATH=$HOME_DIR/src/clang/include/c++/v1
 # cmake doesn't allow us to specify a path to lipo on the command line.
 ln -sf $CROSS_CCTOOLS_PATH/bin/x86_64-apple-darwin10-lipo /usr/bin/lipo
 
 # gets a bit too verbose here
 set +x
 
 cd build/build-clang
 # |mach python| sets up a virtualenv for us!