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
Do not embed manifest files in *.pyd when compiling with MSVC #48370
Comments
The MSVC build process currently embeds the .manifest file, which is
The latter is problematic on machines without the MS CRT redistributable We use the python interpreter within our application and do ship The solution is to not embed the manifest in the *.pyd Modules. This way Attached you'll find a patch for the MSVC90 build, apply with -p5. It Trolltech also uses this approach for its plugins: |
I'm skeptical about this patch. It seems like it could produce an If VS 2005 is any similar with VS 2008 wrt. to manifests, I think you I'd be rather interested in seeing the consequences of this approach for |
Yes, i know that v2.5 doesn't officially support MSVC9. But the same Placing just a .manifest next to *.pyd won't work either. If you're
for 1) The WinSXS installation has a higher priority and the local files Sounds fine, but the latter raises another issue: Now you have 2 copies This issue doesn't stop here, here's another situation: I don't know if or for what version this should be addressed for python. |
The point is that even the MSVC8 project files are not supported.
Not necessarily. Take a look at how I deploy Python 2.6. I use a single I'm closing this for 2.5 as rejected; it might cause more problems than If you can come up with a working patch for 2.6: that would be more |
Ok, point taken, so lets aim at v2.6. Should i open a new issue then? Attached you'll find a new diff against v2.6. This time pyd_d.vsprops I checked a per-user v2.6 install with the CRT manifest pointing at The solution i am proposing doesn't need a CRT manifest file in |
I'm just repurposing the issue (despite what I usually claim as a policy) |
To my surprise there indeed is a vista SP1 box in our test farm. We
|
For some reason, the linker *does* generate manifest files for all the FWIW, with the patch alone, the manifest in .DLLs will still be needed, |
In response to 74742:
This is not true. For MSVC9SP (VS2008) Microsoft decided that by |
Hm, works for me. I am using MS SDK v6.1 and PCbuild/build.bat.
You're right, there are defines for that: While that won't load a 2nd copy of the CRT into memory, the embedded |
The TCL85.dll introduces a subtlety (actually it is TK85.dll). The Situation:
Anyone know of an easy-to-build example of a Python extension with |
Instead of reverting the patch for bpo-2563, I propose to strip the I think somehow the manifests of the .pyd's in DLLs should also be |
Skipping the mt.exe call seems fine to me, but there's another solution The automatic manifest binding comes from a "#pragma TCL's manifest is a different problem. I do not use tkinter, but |
.. erm, the nmake line in Tools\buildbot\external.bat and |
_CRT_NOFORCE_MANIFEST sounds nice, but I'm having some trouble getting |
I don't see a problem with this and can see how it would help with |
I tried to use _CRT_NOFORCE_MANIFEST but i couldn't get it working. Microsoft, in its infinite wisdom, decided to compile the CRT itself I'm unsure what the best way to fix this issue for python is... |
OK, so the define is not going to work. For Python extensions built For the .pyd's and .dll's in the DLLs folder: I have opened them in a |
What's wrong with Andre Heider's patch? |
Ah, I wasn't thinking it through. It is fine for all .pyd of course, |
Should this patch be applied to 3.0 before the next RC lands? Barry |
I have now committed Python-2.6-no.manifest.in.pyd.diff as r67120, |
In r67125, r67126, r67127, r67128, r67129, I removed the mt.exe |
Without msvc9compiler_stripruntimes.diff, or a patch like it, it doesn't Using the python-2.6.1 MSI installed "just for me" and the pywin32-212 Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32api
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: This application has failed to start
because the application configuration is incorrect. Reinstalling the
application may fix this problem. Removing the manifest from all the .pyd files installed by pywin32 |
Is the report posted in: Johan |
@Koen: You're aboslutely right. The issue is solved indeed by adding a |
Could msvc9compiler_stripruntimes.diff still be considered for |
It probably won't make 2.6.3 as the final is just out. But can we have Looking at my local extensions installed, Matplotlib has applied this The patch now does a text search/replace on an XML file, if you think |
There are two easy to fix issues with the |
Thanks Christoph, those are two important fixes to the patch. I'm +1 on |
Just a note on the style of the msvc9compiler_stripruntimes_revised.diff
Added Distuils as component, since the patch is targeting distutils and |
The attached patch uses a regular expression. |
Christoph Gohlke wrote:
Much better, thanks. |
Looking at the description of manifest files, it appears that just http://msdn.microsoft.com/en-us/library/aa374219(VS.85).aspx It appears that the entire dependency-element referencing the MS VC90 Looking at the schema, it's enough to just remove the http://msdn.microsoft.com/en-us/library/aa375635(VS.85).aspx Reading up on the manifest trouble-shooting page at (near the end of the http://msdn.microsoft.com/en-us/library/ms235342.aspx it may actually be enough to just place the Microsoft.VC90.CRT.manifest """
|
This patch also removes empty dependentAssembly elements after removing It seems not enough to just place the Microsoft.VC90.CRT.manifest and VC |
I concur with what Christoph says, that is how the embedded |
Just to share my recent experience with this issue: I was attempting to I attempted to apply the patch listed here and recompile the packages I found this: http://blog.kalmbachnet.de/?postid=80 which suggests I then renamed _mssql.pyd to _mssql.dll so that VS2008 could recognize By the way, the pymssql was compiled with VS2005, which is why it |
What's a procedure for testing this patch (please be as precise as |
There are two levels of testing. First, on a Windows development system with Visual Studio 2008, Python Second, verify that distutil generated PYD extensions can also be Importing the testpyd extension built without the patch fails on the Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: This application has failed to start
because the application configuration is incorrect. Reinstalling the
application may fix this problem. Tested with Python 2.6.3 for Windows 32-bit. |
Apparently the msvc9compiler_stripruntimes_regexp2 patch causes problems /* Import the testpyd.pyd module. */
#include <Python.h>
int main(void) {
Py_Initialize();
{
PyObject *p = PyImport_ImportModule("testpyd");
}
Py_Finalize();
return 0;
} |
Christoph Gohlke wrote:
I'm not sure whether this is related to the problem in question. If it doesn't, then this is more likely a problem with how The fact that the above does work without the patch applied |
My last comment was merely reporting that this patch can break MinGW |
The MinGW breakage probably comes from the same "issue" as encountered |
I came across this (very) interesting thread after experiencing some I used to struggled with the SxS Microsoft policy in the past. After I Having now (using the disutils module) the manifest file embedded in the This is why I fully agree with the propositions that were made here, Could anyone tell us if a decision has been made about such a change ? Thanks, |
Thanks for the patch. Committed as r76651, r76652, r76653, r76654, |
With the latest Python3.1 svn version of msvc9compiler.py, I get a |
See bpo-7556 for the "can't use a string pattern on a bytes-like object" |
I'm not sure this issue is really done. The current state works fine, but there is one problem remaining: There are Python extensions that seem to need a manifest pointing to the MSVC runtime libs: dlls that start in-process com servers, like pythoncom.dll (from the PyWin32 extension), and also _ctypes.pyd plays this role. First question: Open a new issue, or discuss it in this one (and repoen it)? |
Hi Thomas, I think we should open a new issue (child from bpo-4120), just to make Regards, Thomas Heller wrote:
-- Eloi Gaudry Free Field Technologies Company Phone: +32 10 487 959 |
I mentioned the problem with pythoncom.dll and suggested a solution in bpo-7833. |
Please open a new issue. AFAICT, the original issues request (do not |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: