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
--- 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)