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

Add msvcp140.dll to Windows 64 bit wheels #24631

Merged
merged 2 commits into from Oct 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions build_tools/github/vendor.py
Expand Up @@ -17,6 +17,7 @@
VCOMP140_SRC_PATH = "C:\\Windows\\System32\\vcomp140.dll"
VCRUNTIME140_SRC_PATH = "C:\\Windows\\System32\\vcruntime140.dll"
VCRUNTIME140_1_SRC_PATH = "C:\\Windows\\System32\\vcruntime140_1.dll"
MSVCP140_SRC_PATH = "C:\\Windows\\System32\\msvcp140.dll"


def make_distributor_init_32_bits(
Expand Down Expand Up @@ -65,12 +66,13 @@ def make_distributor_init_64_bits(
vcomp140_dll_filename,
vcruntime140_dll_filename,
vcruntime140_1_dll_filename,
msvcp140_dll_filename,
):
"""Create a _distributor_init.py file for 64-bit architectures.

This file is imported first when importing the sklearn package
so as to pre-load the vendored vcomp140.dll, vcruntime140.dll
and vcruntime140_1.dll.
so as to pre-load the vendored vcomp140.dll, vcruntime140.dll,
vcruntime140_1.dll and msvcp140.dll.
"""
with open(distributor_init, "wt") as f:
f.write(
Expand All @@ -97,13 +99,16 @@ def make_distributor_init_64_bits(
vcomp140_dll_filename = op.join(libs_path, "{0}")
vcruntime140_dll_filename = op.join(libs_path, "{1}")
vcruntime140_1_dll_filename = op.join(libs_path, "{2}")
msvcp140_dll_filename = op.join(libs_path, "{3}")
WinDLL(op.abspath(vcomp140_dll_filename))
WinDLL(op.abspath(vcruntime140_dll_filename))
WinDLL(op.abspath(vcruntime140_1_dll_filename))
WinDLL(op.abspath(msvcp140_dll_filename))
""".format(
vcomp140_dll_filename,
vcruntime140_dll_filename,
vcruntime140_1_dll_filename,
msvcp140_dll_filename,
)
)
)
Expand All @@ -120,12 +125,16 @@ def main(wheel_dirname, bitness):
if not op.exists(VCRUNTIME140_1_SRC_PATH) and bitness == "64":
raise ValueError(f"Could not find {VCRUNTIME140_1_SRC_PATH}.")

if not op.exists(MSVCP140_SRC_PATH) and bitness == "64":
raise ValueError(f"Could not find {MSVCP140_SRC_PATH}.")

if not op.isdir(wheel_dirname):
raise RuntimeError(f"Could not find {wheel_dirname} file.")

vcomp140_dll_filename = op.basename(VCOMP140_SRC_PATH)
vcruntime140_dll_filename = op.basename(VCRUNTIME140_SRC_PATH)
vcruntime140_1_dll_filename = op.basename(VCRUNTIME140_1_SRC_PATH)
msvcp140_dll_filename = op.basename(MSVCP140_SRC_PATH)

target_folder = op.join(wheel_dirname, TARGET_FOLDER)
distributor_init = op.join(wheel_dirname, DISTRIBUTOR_INIT)
Expand All @@ -144,6 +153,9 @@ def main(wheel_dirname, bitness):
print(f"Copying {VCRUNTIME140_1_SRC_PATH} to {target_folder}.")
shutil.copy2(VCRUNTIME140_1_SRC_PATH, target_folder)

print(f"Copying {MSVCP140_SRC_PATH} to {target_folder}.")
shutil.copy2(MSVCP140_SRC_PATH, target_folder)

# Generate the _distributor_init file in the source tree
print("Generating the '_distributor_init.py' file.")
if bitness == "32":
Expand All @@ -156,6 +168,7 @@ def main(wheel_dirname, bitness):
vcomp140_dll_filename,
vcruntime140_dll_filename,
vcruntime140_1_dll_filename,
msvcp140_dll_filename,
)


Expand Down