Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upWindows: Add missing MSVC dependencies #16445
Conversation
highfive
commented
Apr 13, 2017
|
Heads up! This PR modifies the following files:
|
|
Looks good so far! I'd also like to know a) what are the licensing terms for these libraries, and b) are we OK to redistribute these libraries as part of our nightly builds? |
| "libsslMD.dll" | ||
| "msvcp140.dll", | ||
| "vcruntime140.dll", | ||
| "api-ms-win-crt-runtime-l1-1-0.dll", |
This comment has been minimized.
This comment has been minimized.
| if os.environ["VisualStudioVersion"] == "14.0": | ||
| vs_dir = os.environ["VS140COMNTOOLS"] | ||
| vs_dll_dir = path.join(vs_dir, "..", "IDE", "Remote Debugger", os.environ["PLATFORM"].lower()) | ||
| for vs_dll in ["api-ms-win-crt-runtime-l1-1-0.dll"]: |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Apr 14, 2017
Member
No need to make this a loop for just one item, we can always re-add the loop in the future if necessary.
| "api-ms-win-crt-runtime-l1-1-0.dll", | ||
| ] | ||
| for msvc_dll in msvc_deps: | ||
| dll = subprocess.Popen(["where", msvc_dll], stdout=subprocess.PIPE) |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Apr 14, 2017
Member
Can this use distutils.spawn.find_executable instead? If not, please add a comment about why that doesn't work.
This comment has been minimized.
This comment has been minimized.
UK992
Apr 14, 2017
Author
Contributor
distutils.spawn.find_executable doesn't work on dlls, but i found alternative ctypes.util.find_library.
| if os.environ.get("VS140COMNTOOLS", ""): | ||
| vs_dir = os.environ["VS140COMNTOOLS"] | ||
| vs_dll_dir = path.join(vs_dir, "..", "IDE", "Remote Debugger", os.environ["PLATFORM"].lower()) | ||
| os.environ['PATH'] = os.environ['PATH'] + os.pathsep + vs_dll_dir |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Apr 14, 2017
Member
I don't like modifying environment variables in process, it can be confusing and potentially can cause memory leaks, etc. I believe you had an approach that involved copying before - can we use that instead? Or maybe symlinking?
| "msvcp140.dll", | ||
| "vcruntime140.dll", | ||
| ] | ||
| [shutil.copy(path.join(binary_path, d), destination) for d in deps] |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Apr 14, 2017
Member
Since the return value of the list comprehension is not used, this is better written as a regular for loop.
| @@ -324,6 +324,20 @@ def build(self, target=None, release=False, dev=False, jobs=None, | |||
| for ssl_lib in ["libcryptoMD.dll", "libsslMD.dll"]: | |||
| shutil.copy(path.join(env['OPENSSL_LIB_DIR'], "../bin" + msvc_x64, ssl_lib), | |||
| servo_exe_dir) | |||
| if os.environ.get("VS140COMNTOOLS", ""): | |||
This comment has been minimized.
This comment has been minimized.
| "vcruntime140.dll", | ||
| ] | ||
| for msvc_dll in msvc_deps: | ||
| from ctypes.util import find_library |
This comment has been minimized.
This comment has been minimized.
|
Code changes look good to me, needs a squash. |
|
@aneeshusa it's ok to redistribute these libraries (link), also i updated code to take these libs from same locations as firefox does. |
|
|
|
|
@aneeshusa This looks good to me - is it ready for r+? |
|
I've left some comments and questions on this due to the new implementation. |
| shutil.make_archive(path.join(dir_to_msi, "Servo"), "zip", dir_to_temp) | ||
| print("Packaged Servo into " + path.join(dir_to_msi, "Servo.zip")) | ||
| zip_path = path.join(dir_to_msi, "Servo.zip") | ||
| import zipfile |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Apr 23, 2017
Member
It would be best to create the zip archive in a deterministic way; it's probably easiest to fold this into archive_deterministically or make a similar helper method. See https://reproducible-builds.org/docs/archives/ for a list of major considerations.
That method also has some other important features, like using with statements to close files and automatically un-cd, and atomic renaming of the output to prevent half-finished archives from being uploaded.
| vs_dll_dir = redist1 | ||
| elif os.path.isdir(redist2): | ||
| vs_dll_dir = redist2 | ||
| if vs_version == "15.0" or is_vs14: |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Apr 23, 2017
Member
I'm not sure, but I think if vs_dll_dir: may have better semantics here.
Also, if these deps are required, it would be nice to have some error handling in case we can't find the vs_dll_dir.
| vs_dll_dir, | ||
| path.join(os.environ["WindowsSdkDir"], "Redist", "ucrt", "DLLs", vs_platform), | ||
| ] | ||
| import stat |
This comment has been minimized.
This comment has been minimized.
| ] | ||
| import stat | ||
| for msvc_dll in msvc_deps: | ||
| for dll_dir in dll_dirs: |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Apr 23, 2017
Member
This seems to copy each dll from two different locations to the same place in the servo_dir_dll. Is the intent to instead do one copy of dll, from the first location it is found?
This comment has been minimized.
This comment has been minimized.
UK992
Apr 23, 2017
Author
Contributor
I added break in loop, but doesn't make a difference, because in Windows Sdk directory are only api-ms-*.dll files
| servo_dir_dll = path.join(servo_exe_dir, msvc_dll) | ||
| if os.path.isfile(dll): | ||
| if os.path.isfile(servo_dir_dll): | ||
| # avoid permission denied error when overwrite dll in servo build directory |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Apr 23, 2017
Member
Why would we overwrite DLLs? If we already have the DLL, why copy (presumably) the same DLL over top?
This comment has been minimized.
This comment has been minimized.
|
@bors-servo clean retry |
Windows: Add missing MSVC dependencies - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #16422 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16445) <!-- Reviewable:end -->
|
|
|
I made some changes in code for vs 2017. |
|
@bors-servo try |
Windows: Add missing MSVC dependencies - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #16422 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16445) <!-- Reviewable:end -->
|
|
|
Looks like buildbot machines need to update Windows SDK. |
|
|
Windows: Add missing dependencies Rebased #16445 and updated with Gstreamer DLLs. About msi installer, there is also included gstreamer installer, should be removed and replaced by needed gstreamer DLLs or keep it at is it? <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21968) <!-- Reviewable:end -->
Windows: Add missing dependencies Rebased #16445 and updated with Gstreamer DLLs. About msi installer, there is also included gstreamer installer, should be removed and replaced by needed gstreamer DLLs or keep it at is it? Fixes #16422. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21968) <!-- Reviewable:end -->
Windows: Add missing dependencies Rebased #16445 and updated with Gstreamer DLLs. About msi installer, there is also included gstreamer installer, should be removed and replaced by needed gstreamer DLLs or keep it at is it? Fixes #16422. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21968) <!-- Reviewable:end -->
Windows: Add missing dependencies Rebased #16445 and updated with Gstreamer DLLs. About msi installer, there is also included gstreamer installer, should be removed and replaced by needed gstreamer DLLs or keep it at is it? Fixes #16422. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21968) <!-- Reviewable:end -->
Windows: Add missing dependencies Rebased #16445 and updated with Gstreamer DLLs. About msi installer, there is also included gstreamer installer, should be removed and replaced by needed gstreamer DLLs or keep it at is it? Fixes #16422. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21968) <!-- Reviewable:end -->
Windows: Add missing dependencies Rebased #16445 and updated with Gstreamer DLLs. About msi installer, there is also included gstreamer installer, should be removed and replaced by needed gstreamer DLLs or keep it at is it? Fixes #16422. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21968) <!-- Reviewable:end -->
UK992 commentedApr 13, 2017
•
edited
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is