Backed out 2 changesets (bug 1515579) for causing bugs: 1516228, 1516090, 1516253. a=backout
authorRazvan Maries <rmaries@mozilla.com>
Tue, 25 Dec 2018 00:48:43 +0200
changeset 508986 d2bc993e14ea1384c2d9b80cca098b48eb19948a
parent 508985 b243a5a3fc646329ca5b5d169f7fe2f16dfb56eb
child 508999 f90034ef430e89e9413cfb59791d55175136d40c
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1515579, 1516228, 1516090, 1516253
milestone66.0a1
backs outfcf2cca505d4cb8392d8ba42d827cc9b308f116f
1d645417b0829d67161fba8f60d61c90fc703be4
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
Backed out 2 changesets (bug 1515579) for causing bugs: 1516228, 1516090, 1516253. a=backout Backed out changeset fcf2cca505d4 (bug 1515579) Backed out changeset 1d645417b082 (bug 1515579)
build/moz.configure/toolchain.configure
build/moz.configure/windows.configure
build/win64-aarch64/mozconfig.vs2017
toolkit/moz.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -752,66 +752,44 @@ def vc_compiler_path(host, target, vs_ma
         # Choose the newest version.
         data = all_versions[-1][1]
     paths = data.get(vc_target)
     if not paths:
         return
     return paths
 
 
-@dependable
-@imports(_from='os', _import='environ')
-def original_path():
-    return environ['PATH']
-
-
-@depends(vc_compiler_path, original_path)
+@depends(vc_compiler_path)
 @imports('os')
 @imports(_from='os', _import='environ')
-def toolchain_search_path(vc_compiler_path, original_path):
-    result = [original_path]
+def toolchain_search_path(vc_compiler_path):
+    result = [environ.get('PATH')]
 
     if vc_compiler_path:
-        # The second item, if there is one, is necessary to have in $PATH for
-        # Windows to load the required DLLs from there.
-        if len(vc_compiler_path) > 1:
-            environ['PATH'] = os.pathsep.join(result + vc_compiler_path[1:])
-
-        # The first item is where the programs are going to be
-        result.append(vc_compiler_path[0])
+        result.extend(vc_compiler_path)
 
     # Also add in the location to which `mach bootstrap` or
     # `mach artifact toolchain` installs clang.
     mozbuild_state_dir = environ.get('MOZBUILD_STATE_PATH',
                                      os.path.expanduser(os.path.join('~', '.mozbuild')))
     bootstrap_clang_path = os.path.join(mozbuild_state_dir, 'clang', 'bin')
     result.append(bootstrap_clang_path)
 
     bootstrap_cbindgen_path = os.path.join(mozbuild_state_dir, 'cbindgen')
     result.append(bootstrap_cbindgen_path)
 
+    if vc_compiler_path:
+        # We're going to alter PATH for good in windows.configure, but we also
+        # need to do it for the valid_compiler() check below. This is only needed
+        # on Windows, where MSVC needs PATH set to find dlls.
+        environ['PATH'] = os.pathsep.join(result)
+
     return result
 
 
-# If we modified the PATH environment variable for Windows DLLs, set the PATH
-# variable for the build.
-@depends(toolchain_search_path, original_path)
-@imports(_from='os', _import='environ')
-def altered_path(toolchain_search_path, original_path):
-    # Touch the dependency for the linter. We don't actually need the value,
-    # only its side effects.
-    toolchain_search_path
-
-    if environ['PATH'] != original_path:
-        return environ['PATH']
-
-
-set_config('PATH', altered_path)
-
-
 @template
 def default_c_compilers(host_or_target, other_c_compiler=None):
     '''Template defining the set of default C compilers for the host and
     target platforms.
     `host_or_target` is either `host` or `target` (the @depends functions
     from init.configure.
     `other_c_compiler` is the `target` C compiler when `host_or_target` is `host`.
     '''
@@ -1016,16 +994,36 @@ def compiler(language, host_or_target, c
             wrapper.extend(provided_wrapper)
             flags = provided_compiler.flags
         else:
             flags = []
 
         if not flags and macos_sdk and host_or_target.os == 'OSX':
             flags = ['-isysroot', macos_sdk]
 
+        # Ideally, we'd always use the absolute path, but unfortunately, on
+        # Windows, the compiler is very often in a directory containing spaces.
+        # Unfortunately, due to the way autoconf does its compiler tests with
+        # eval, that doesn't work out. So in that case, check that the
+        # compiler can still be found in $PATH, and use the file name instead
+        # of the full path.
+        if quote(compiler) != compiler:
+            full_path = os.path.abspath(compiler)
+            compiler = os.path.basename(compiler)
+            found_compiler = find_program(compiler)
+            if not found_compiler:
+                die('%s is not in your $PATH'
+                    % quote(os.path.dirname(full_path)))
+            if os.path.normcase(find_program(compiler)) != os.path.normcase(
+                    full_path):
+                die('Found `%s` before `%s` in your $PATH. '
+                    'Please reorder your $PATH.',
+                    quote(os.path.dirname(found_compiler)),
+                    quote(os.path.dirname(full_path)))
+
         info = check_compiler(wrapper + [compiler] + flags, language,
                               host_or_target)
 
         # Check that the additional flags we got are enough to not require any
         # more flags. If we get an exception, just ignore it; it's liable to be
         # invalid command-line flags, which means the compiler we're checking
         # doesn't support those command-line flags and will fail one or more of
         # the checks below.
@@ -1462,18 +1460,17 @@ def pgo_flags(compiler, build_env, targe
 
 
 set_config('PROFILE_GEN_CFLAGS', pgo_flags.gen_cflags)
 set_config('PROFILE_GEN_LDFLAGS', pgo_flags.gen_ldflags)
 set_config('PROFILE_USE_CFLAGS', pgo_flags.use_cflags)
 set_config('PROFILE_USE_LDFLAGS', pgo_flags.use_ldflags)
 
 llvm_profdata = check_prog('LLVM_PROFDATA', ['llvm-profdata'],
-                           allow_missing=True,
-                           paths=toolchain_search_path)
+                           allow_missing=True)
 
 add_old_configure_assignment('LLVM_PROFDATA', llvm_profdata)
 
 
 @depends(c_compiler)
 def preprocess_option(compiler):
     # The uses of PREPROCESS_OPTION depend on the spacing for -o/-Fi.
     if compiler.type in ('gcc', 'clang'):
@@ -1955,18 +1952,17 @@ def as_info(target, c_compiler):
 # One would expect the assembler to be specified merely as a program.  But in
 # cases where the assembler is passed down into js/, it can be specified in
 # the same way as CC: a program + a list of argument flags.  We might as well
 # permit the same behavior in general, even though it seems somewhat unusual.
 # So we have to do the same sort of dance as we did above with
 # `provided_compiler`.
 provided_assembler = provided_program('AS')
 assembler = check_prog('_AS', input=provided_assembler.program,
-                       what='the assembler', progs=as_info.names,
-                       paths=toolchain_search_path)
+                       what='the assembler', progs=as_info.names)
 
 @depends(as_info, assembler, provided_assembler, c_compiler)
 def as_with_flags(as_info, assembler, provided_assembler, c_compiler):
     if provided_assembler:
         return provided_assembler.wrapper + \
             [provided_assembler.program] + \
             provided_assembler.flags
 
--- a/build/moz.configure/windows.configure
+++ b/build/moz.configure/windows.configure
@@ -251,33 +251,37 @@ def valid_ucrt_sdk_dir(windows_sdk_dir, 
     return namespace(
         path=sdk.path,
         include=sdk.include,
         lib=sdk.lib,
         version=version,
     )
 
 
-@depends(c_compiler, toolchain_search_path)
+@depends(c_compiler)
 @imports('os')
-def vc_path(c_compiler, toolchain_search_path):
+def vc_path(c_compiler):
     vc_path_env = os.environ.get('VC_PATH')
     if vc_path_env:
         return os.path.normpath(vc_path_env)
 
     if c_compiler.type not in ('msvc', 'clang-cl'):
         return
 
+    # Normally, we'd start from c_compiler.compiler, but for now, it's not the
+    # ideal full path to the compiler. At least, we're guaranteed find_program
+    # will get us the one we found in toolchain.configure.
     vc_program = c_compiler.compiler
 
     # In clang-cl builds, we use the headers and libraries from an MSVC installation.
     if c_compiler.type == 'clang-cl':
-        vc_program = find_program('cl.exe', paths=toolchain_search_path)
+        vc_program = 'cl.exe'
 
-    result = os.path.dirname(vc_program)
+    cl = find_program(vc_program)
+    result = os.path.dirname(cl)
     while True:
         next, p = os.path.split(result)
         if next == result:
             die('Cannot determine the Visual C++ directory the compiler (%s) '
                 'is in' % cl)
         result = next
         if p.lower() == 'bin':
             break
@@ -459,16 +463,30 @@ link = check_prog('LINKER', ('lld-link.e
                   paths=toolchain_search_path)
 
 host_link = check_prog('HOST_LINKER', ('lld-link.exe', 'link.exe'),
                        paths=toolchain_search_path)
 
 add_old_configure_assignment('LINKER', link)
 
 
+# Normally, we'd just have CC, etc. set to absolute paths, but the build system
+# doesn't currently handle properly the case where the paths contain spaces.
+# Additionally, there's the issue described in toolchain.configure, in
+# valid_compiler().
+@depends(sdk_bin_path)
+@imports('os')
+def alter_path(sdk_bin_path):
+    path = os.pathsep.join(sdk_bin_path)
+    os.environ['PATH'] = path
+    return path
+
+
+set_config('PATH', alter_path)
+
 check_prog('MAKECAB', ('makecab.exe',))
 
 
 @depends(c_compiler, using_sccache)
 def need_showincludes_prefix(info, using_sccache):
     # sccache does its own -showIncludes prefix checking.
     # clang-cl uses a gcc-style dependency scheme, see toolchain.configure.
     if info.type == 'msvc' and not using_sccache:
--- a/build/win64-aarch64/mozconfig.vs2017
+++ b/build/win64-aarch64/mozconfig.vs2017
@@ -40,15 +40,8 @@ if [ -d "${VSPATH}" ]; then
     libs="${libs} -LIBPATH:${VSWINPATH}/SDK/Lib/${win_sdk_version}/ucrt/x64"
     export HOST_LDFLAGS="${libs}"
 
     export WIN64_LINK="${VSPATH}/VC/bin/Hostx64/x64/link.exe"
     export WIN64_LIB="${VSPATH}/VC/lib/x64:${VSPATH}/VC/atlmfc/lib/x64:${VSPATH}/SDK/Lib/${win_sdk_version}/ucrt/x64:${VSPATH}/SDK/Lib/${win_sdk_version}/um/x64:${VSPATH}/DIA SDK/lib/amd64"
 fi
 
 . $topsrcdir/build/mozconfig.vs-common
-
-mk_export_correct_style WINDOWSSDKDIR
-mk_export_correct_style WIN32_REDIST_DIR
-mk_export_correct_style WIN_DIA_SDK_BIN_DIR
-mk_export_correct_style PATH
-mk_export_correct_style INCLUDE
-mk_export_correct_style LIB
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -1083,18 +1083,17 @@ def midl_names(c_compiler, toolchain_pre
 def check_for_midl(target, compile_environment):
     if target.os != 'WINNT':
         return
 
     if compile_environment:
         return True
 
 
-midl = check_prog('MIDL', midl_names, when=check_for_midl, allow_missing=True,
-                  paths=sdk_bin_path)
+midl = check_prog('MIDL', midl_names, when=check_for_midl, allow_missing=True)
 
 
 @depends(c_compiler, target, when=depends(midl, target)(lambda m, t: m and t.kernel == 'WINNT'))
 def midl_flags(c_compiler, target):
     if c_compiler and c_compiler.type in ('msvc', 'clang-cl'):
         env = {
             'x86': 'win32',
             'x86_64': 'x64',
@@ -1271,18 +1270,17 @@ option('--enable-layout-debugger',
 set_config('MOZ_LAYOUT_DEBUGGER', depends_if('--enable-layout-debugger')(lambda _: True))
 
 
 # Shader Compiler for Windows (and MinGW Cross Compile)
 # ==============================================================
 
 with only_when(compile_environment):
     fxc = check_prog('FXC', ('fxc.exe', 'fxc2.exe'), when=depends(target)
-                     (lambda t: t.kernel == 'WINNT'),
-                     paths=sdk_bin_path)
+                     (lambda t: t.kernel == 'WINNT'))
     wine = check_prog('WINE', ['wine'], when=depends(target, host)
                       (lambda t, h: t.kernel == 'WINNT' and h.kernel == 'Linux'))
 
 
 # VPX
 # ===
 
 with only_when(compile_environment):