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
vcruntime140.dll sometimes missing from top level #1732
Comments
I'm running into a very similar issue. When running my cx_freeze script directly I am shown the dll is copied correctly:
When running the build script as part of a npm script for packaging my app, I am shown that the dll is copied to the
I might have to include the dll manually for later in my packaging process as a work around but I really don't want to have to do that if it is an option available in cx_freeze. Windows 11 64bit |
I cannot reproduce this, but I'll try to change or force the copy to the correct location. |
from that same log (cx-freeze 6.13.1):
Running on 6.14.2, it has been copying the dlls consistently so far. |
Is the .exe copied after these four lines? It should be the first.
Do you mean 6.13.1 has the problem and 6.14.2 doesn't? |
We have not yet built our MSI with 6.14.2. But we still had this problem on 6.14.1 (it does not look like the commits in between would have any effect on this). Here are the last lines of a "failed" build:
Here's a rebuild of the same commit:
Chances are around 50-50 to get a working build. |
I've only had the chance to test 6.14.2 on a few builds and it has worked, but i don't think that confirms this version fixed the issue as @jhoekx mentions. |
Can you test my patch? |
@stevenbronson-wk @jhoekx @marmig0404 ping |
I tried 4 builds this morning with the patched version. All of them included the To be fair, our last 3 builds on 6.14.2 last week were also 'good'. |
In freezer.py, I replaced for source in dependent_files: with one of these for source in sorted(dependent_files, key=lambda p:(p.name.casefold() != 'vcruntime140.dll', p)):
for source in sorted(dependent_files, key=lambda p:(p.name.casefold() != 'vcruntime140_1.dll', p)): 6.14.2 works if vcruntime140.dll is first and doesn't if vcruntime140_1.dll is first. |
Sometimes vcruntime140.dll isn't copied to the top level of our Windows builds even though we pass include_msvcr.
_post_copy_hook calls _pre_copy_hook (which copies vcruntime to lib/) and then _copy_file with the new target returned from _pre_copy_hook (top level). However, _copy_file itself calls _pre_copy_hook, which changes the target from top level to lib/ again because vcruntime is in runtime_files but no longer in runtime_files_to_dup.
So I think we get a top level vcruntime140.dll when _freeze_executable finds it directly and passes it to _copy_top_dependency, but not when it's found as a dependency of another DLL (e.g. vcruntime140_1.dll) and _post_copy_hook tries to copy it.
I think it'd be difficult to reliably reproduce this, but if my explanation doesn't make sense and you need an example, let me know.
Windows (64 bit)
cx_Freeze 6.13.1
Python 3.10.9
The text was updated successfully, but these errors were encountered: