Bug 1792666 - Use -isysroot instead of --sysroot on mac. r?build draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 29 Sep 2022 06:31:30 +0900
changeset 4682688 28306a8364c4a6161dccd8aa4b572423aedcaebc
parent 4680314 d1ae84015c22f2034435b47194fdced878072035
child 4682689 e366d857c6842b9b40aca8fe4fdf89d42adc9ac8
push id858551
push usermh@glandium.org
push dateThu, 29 Sep 2022 08:48:25 +0000
treeherdertry@e6064f7bdc72 [default view] [failures only]
reviewersbuild
bugs1792666
milestone107.0a1
Bug 1792666 - Use -isysroot instead of --sysroot on mac. r?build Differential Revision: https://phabricator.services.mozilla.com/D158302
build/moz.configure/toolchain.configure
python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1171,17 +1171,20 @@ def compiler(
         host_or_target,
         sysroot,
         macos_target,
         multiarch_dir,
     ):
         wrapper = list(compiler_wrapper or ())
         flags = []
         if sysroot.path:
-            flags.extend(("--sysroot", sysroot.path))
+            if host_or_target.kernel == "Darwin":
+                flags.extend(("-isysroot", sysroot.path))
+            else:
+                flags.extend(("--sysroot", sysroot.path))
         if host_or_target.os == "OSX" and macos_target:
             flags.append("-mmacosx-version-min=%s" % macos_target)
         if provided_compiler:
             wrapper.extend(provided_compiler.wrapper)
             flags.extend(provided_compiler.flags)
 
         info = check_compiler(wrapper + [compiler] + flags, language, host_or_target)
 
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -882,17 +882,17 @@ class OSXToolchainTest(BaseToolchainTest
     )
     GCC_5_RESULT = LinuxToolchainTest.GCC_5_RESULT
     GXX_5_RESULT = LinuxToolchainTest.GXX_5_RESULT
     GCC_7_RESULT = LinuxToolchainTest.GCC_7_RESULT
     GXX_7_RESULT = LinuxToolchainTest.GXX_7_RESULT
     SYSROOT_FLAGS = {
         "flags": PrependFlags(
             [
-                "--sysroot",
+                "-isysroot",
                 xcrun("", ("--show-sdk-path",))[1],
                 "-mmacosx-version-min=10.12",
             ]
         )
     }
 
     def test_clang(self):
         # We only try clang because gcc is known not to work.
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py
@@ -212,18 +212,18 @@ class FakeCompiler(dict):
         files = []
         flags = []
         args = iter(args)
         while True:
             arg = next(args, None)
             if arg is None:
                 break
             if arg.startswith("-"):
-                # Ignore --sysroot and the argument that follows it.
-                if arg == "--sysroot":
+                # Ignore -isysroot/--sysroot and the argument that follows it.
+                if arg in ("-isysroot", "--sysroot"):
                     next(args, None)
                 else:
                     flags.append(arg)
             else:
                 files.append(arg)
 
         if "-E" in flags:
             assert len(files) == 1