Bug 1251313 - Adjust PATH to find pgort140.dll under Visual Studio 2015; r=ted
authorGregory Szorc <gps@mozilla.com>
Sat, 27 Feb 2016 13:18:26 -0800
changeset 322473 708e99f3dd44ca5f7f3e2f664643209cc15b5432
parent 322472 d6df13193dc8109b63cd24f46ed2a908c6e8ad9b
child 322474 7566245cc5ea9e15415e71a2599ec72c953189df
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1251313
milestone47.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 1251313 - Adjust PATH to find pgort140.dll under Visual Studio 2015; r=ted 32-bit PGO builds need to modify the PATH to find pgortXXX.dll. We were doing this for Visual Studio 2013 (VC12) in 2 locations. We weren't doing it for Visual Studio 2015. This resulted in a failure to launch PGO instrumented executables because pgort140.dll could not be found. This commit refactors the PATH munging to support Visual Studio 2015. MozReview-Commit-ID: 4EKf8gjcNH6
build/pgo/profileserver.py
toolkit/mozapps/installer/packager.py
--- a/build/pgo/profileserver.py
+++ b/build/pgo/profileserver.py
@@ -51,22 +51,26 @@ if __name__ == '__main__':
                              preferences=prefs,
                              addons=[os.path.join(build.distdir, 'xpi-stage', 'quitter')],
                              locations=locations)
 
     env = os.environ.copy()
     env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
     env["XPCOM_DEBUG_BREAK"] = "warn"
 
-    # For VC12, make sure we can find the right bitness of pgort120.dll
-    if "VS120COMNTOOLS" in env and not substs["HAVE_64BIT_BUILD"]:
-      vc12dir = os.path.abspath(os.path.join(env["VS120COMNTOOLS"],
-                                             "../../VC/bin"))
-      if os.path.exists(vc12dir):
-        env["PATH"] = vc12dir + ";" + env["PATH"]
+    # For VC12+, make sure we can find the right bitness of pgort1x0.dll
+    if not substs['HAVE_64BIT_BUILD']:
+        for e in ('VS140COMNTOOLS', 'VS120COMNTOOLS'):
+            if e not in env:
+                continue
+
+            vcdir = os.path.abspath(os.path.join(env[e], '../../VC/bin'))
+            if os.path.exists(vcdir):
+                env['PATH'] = '%s;%s' % (vcdir, env['PATH'])
+                break
 
     # Run Firefox a first time to initialize its profile
     runner = FirefoxRunner(profile=profile,
                            binary=build.get_binary_path(where="staged-package"),
                            cmdargs=['javascript:Quitter.quit()'],
                            env=env)
     runner.start()
     runner.wait()
--- a/toolkit/mozapps/installer/packager.py
+++ b/toolkit/mozapps/installer/packager.py
@@ -75,22 +75,26 @@ class ToolLauncher(object):
         for p in ['LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH']:
             if p in env:
                 env[p] = extra_linker_path + ':' + env[p]
             else:
                 env[p] = extra_linker_path
         for e in extra_env:
             env[e] = extra_env[e]
 
-        # For VC12, make sure we can find the right bitness of pgort120.dll
-        if 'VS120COMNTOOLS' in env and not buildconfig.substs['HAVE_64BIT_BUILD']:
-            vc12dir = os.path.abspath(os.path.join(env['VS120COMNTOOLS'],
-                                                   '../../VC/bin'))
-            if os.path.exists(vc12dir):
-                env['PATH'] = vc12dir + ';' + env['PATH']
+        # For VC12+, make sure we can find the right bitness of pgort1x0.dll
+        if not buildconfig.substs['HAVE_64BIT_BUILD']:
+            for e in ('VS140COMNTOOLS', 'VS120COMNTOOLS'):
+                if e not in env:
+                    continue
+
+                vcdir = os.path.abspath(os.path.join(env[e], '../../VC/bin'))
+                if os.path.exists(vcdir):
+                    env['PATH'] = '%s;%s' % (vcdir, env['PATH'])
+                    break
 
         # Work around a bug in Python 2.7.2 and lower where unicode types in
         # environment variables aren't handled by subprocess.
         for k, v in env.items():
             if isinstance(v, unicode):
                 env[k] = v.encode('utf-8')
 
         print >>errors.out, 'Executing', ' '.join(cmd)