Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Add missing MSVC dependencies #16445

Closed
wants to merge 4 commits into from
Closed

Conversation

@UK992
Copy link
Contributor

UK992 commented Apr 13, 2017

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #16422

This change is Reviewable

@highfive
Copy link

highfive commented Apr 13, 2017

Heads up! This PR modifies the following files:

  • @wafflespeanut: python/servo/build_commands.py, python/servo/package_commands.py
Copy link
Member

aneeshusa left a comment

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.

Copy link
@aneeshusa

aneeshusa Apr 14, 2017

Member

nit: move to the top of the list for alphabetical order

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.

Copy link
@aneeshusa

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.

Copy link
@aneeshusa

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.

Copy link
@UK992

UK992 Apr 14, 2017

Author Contributor

distutils.spawn.find_executable doesn't work on dlls, but i found alternative ctypes.util.find_library.

@aneeshusa aneeshusa assigned aneeshusa and unassigned KiChjang Apr 14, 2017
@UK992 UK992 force-pushed the UK992:mach-package branch from 0ac6181 to 71614d3 Apr 14, 2017
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.

Copy link
@aneeshusa

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.

Copy link
@aneeshusa

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.

Copy link
@aneeshusa

aneeshusa Apr 14, 2017

Member

This could be clearer as if "VS140COMNTOOLS" in os.environ:.

"vcruntime140.dll",
]
for msvc_dll in msvc_deps:
from ctypes.util import find_library

This comment has been minimized.

Copy link
@aneeshusa

aneeshusa Apr 14, 2017

Member

I'd move this outside the for loop to avoid importing for each dll.

@aneeshusa
Copy link
Member

aneeshusa commented Apr 15, 2017

Code changes look good to me, needs a squash.
I'd like answers to the licensing questions before approving this.

@UK992
Copy link
Contributor Author

UK992 commented Apr 15, 2017

@aneeshusa it's ok to redistribute these libraries (link), also i updated code to take these libs from same locations as firefox does.

@UK992 UK992 force-pushed the UK992:mach-package branch from d9e42b9 to a186ee0 Apr 15, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Apr 17, 2017

The latest upstream changes (presumably #16490) made this pull request unmergeable. Please resolve the merge conflicts.

@UK992 UK992 force-pushed the UK992:mach-package branch from a186ee0 to 72459b0 Apr 17, 2017
@jdm
Copy link
Member

jdm commented Apr 17, 2017

Error running mach:
    ['build', '-d', '-v']
The error occurred in the implementation of the invoked mach command.
This should never occur and is likely a bug in the implementation of that
command. Consider filing a bug for this issue.
If filing a bug, please include the full output of mach, including this error
message.
The details of the failure are as follows:
WindowsError: [Error 2] The system cannot find the file specified: u'C:\\projects\\servo\\target\\debug\\api-ms-win-crt-runtime-l1-1-0.dll'
  File "C:\projects\servo\python\servo\build_commands.py", line 358, in build
    os.chmod(servo_dir_dll, stat.S_IWUSR)
Command exited with code 1
@UK992 UK992 force-pushed the UK992:mach-package branch from 78f9c24 to b353f9e Apr 19, 2017
@larsbergstrom
Copy link
Contributor

larsbergstrom commented Apr 23, 2017

@aneeshusa This looks good to me - is it ready for r+?

Copy link
Member

aneeshusa left a comment

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.

Copy link
@aneeshusa

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.

Copy link
@aneeshusa

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.

Copy link
@aneeshusa

aneeshusa Apr 23, 2017

Member

Move to the top level.

]
import stat
for msvc_dll in msvc_deps:
for dll_dir in dll_dirs:

This comment has been minimized.

Copy link
@aneeshusa

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.

Copy link
@UK992

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.

Copy link
@aneeshusa

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.

Copy link
@UK992

UK992 Apr 23, 2017

Author Contributor

This will make sure that DLLs are always up-to-date.

@mbrubeck
Copy link
Contributor

mbrubeck commented Sep 21, 2017

@bors-servo clean retry

@bors-servo
Copy link
Contributor

bors-servo commented Sep 21, 2017

Testing commit 67b1a4e with merge 9dc25a5...

bors-servo added a commit that referenced this pull request Sep 21, 2017
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 21, 2017

💔 Test failed - windows-msvc-dev

@UK992 UK992 force-pushed the UK992:mach-package branch from 67b1a4e to fce7f85 Sep 24, 2017
@UK992
Copy link
Contributor Author

UK992 commented Sep 24, 2017

I made some changes in code for vs 2017.
Please run try build to see why api-ms-win-crt-runtime-l1-1-0.dll is missing. thanks

@aneeshusa
Copy link
Member

aneeshusa commented Sep 24, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Sep 24, 2017

Trying commit fce7f85 with merge 06d147d...

bors-servo added a commit that referenced this pull request Sep 24, 2017
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 24, 2017

💔 Test failed - windows-msvc-dev

@UK992
Copy link
Contributor Author

UK992 commented Sep 24, 2017

Looks like buildbot machines need to update Windows SDK.

@bors-servo
Copy link
Contributor

bors-servo commented Feb 13, 2018

The latest upstream changes (presumably #19975) made this pull request unmergeable. Please resolve the merge conflicts.

@UK992 UK992 closed this Oct 16, 2018
bors-servo added a commit that referenced this pull request Nov 27, 2018
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 -->
bors-servo added a commit that referenced this pull request Feb 1, 2019
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 -->
bors-servo added a commit that referenced this pull request Feb 1, 2019
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 -->
bors-servo added a commit that referenced this pull request Feb 1, 2019
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 -->
bors-servo added a commit that referenced this pull request Feb 1, 2019
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 -->
bors-servo added a commit that referenced this pull request Feb 1, 2019
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 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

10 participants
You can’t perform that action at this time.