[cx-freeze-users] Automatically copy C runtime libraries (msvcr90.dll and friends)
Brought to you by:
atuining
From: Almar K. <a....@sc...> - 2012-09-29 21:06:08
|
Hi, In follow-up of my response in another thread, I looked into the idea to automatically copy the C-runtime libs to the target directory, so that they are distributed along with the frozen application. First the legal issue. I tried to see what Microsoft has to say about this, and came with these articles: >From Redistribution of the shared C runtime component in Visual C++<http://support.microsoft.com/kb/326922> I read "*... the CRT DLL is no longer considered a system file, therefore, distribute the CRT DLL with any application that relies on it. Because it is no longer a system component, install it in your applications Program Files directory with other application-specific code. This prevents your application from using other versions of the CRT library that may be installed on the system paths.*" And from Redistributing the MFC Library<http://msdn.microsoft.com/en-us/library/ms235264(v=vs.90).aspx> I read "*If you dynamically link your application to the MFC library, you will, at a minimum, have to redistribute Mfc90.dll and Msvcr90.dll with corresponding manifest files for MFC and CRT assemblies.*" Both sources are Microsoft pages, and in both articles there is no mentioning of needing any rights to redistribute these libraries. On some other related pages the right-issue is mentioned, but these pages refer to a broader set of visual C++ libraries. Therefore, in contrast to what you implied in this<http://www.mail-archive.com/cx-...@li.../msg00087.html> thread, it seems to me that there is no legal problem with redistributing the C runtime libraries. Rather, distributing them along with the executable seems to be the advocated approach. But I might be wrong or missing something ... Now the technical side of it. In http://cx_freeze.readthedocs.org/en/latest/overview.html#microsoft-visual-c-2008-redistributable-package it says I have to copy the libraries from my c:\windows\winSxS directory, because "cx_Freeze doesn’t currently automatically copy them". My WinSxS directory has literally thousands of directories, but the one mentioned in the docs is not there. Five of the directories are a x86 C runtime library, all of different versions (and sizes). I tried each of them on a virtual machine (on an app that was created by yet another Windows box), and they all worked. So I wonder, would it be best to ship the version of the dll that came with Python, or is it better to use the latest. Using the latest requires parsing the possibly huge WinSxS directory. Getting the matching version can be done with cx_Freeze.util.GetDependentFiles(path). On a side-note, cx_Freeze does not copy the msvcr90.dll because Freezer._GetDefaultBinPathExcludes() explicitly exludes the 'windows\WinSxS' directory. So my suggestion would be to do a kind of post processing, in which either the latest or the matching runtime libraries (thee of them) are copied to the target directory. Also, a manifest file should be created (or embedded in the exe). What do you think about that? About the manuscript, I read in this<http://www.mail-archive.com/cx-...@li.../msg00087.html> thread that the exe already has a manifest embedded, where does this one point at? I read in several posts that the manuscript can easily be written so it bypasses the WinSxS directory and just uses what's in the application direcory. Sorry for the large post, just hoping to get some clarity on this issue, Almar -- Almar Klein, PhD Science Applied phone: +31 6 19268652 e-mail: a....@sc... |