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

Error in Microsoft.VC90.CRT.manifest file generates side by side issue #6509

Closed
iFelinto opened this issue Jan 13, 2022 · 4 comments · Fixed by #7784
Closed

Error in Microsoft.VC90.CRT.manifest file generates side by side issue #6509

iFelinto opened this issue Jan 13, 2022 · 4 comments · Fixed by #7784
Labels

Comments

@iFelinto
Copy link

Description of the issue

After generating the exe file, a manifest file was included on the .\dist folder. Running the .exe generated a side-by-side error. Below is the Windows event log message:

Activation context generation failed for "C:\Path\library.pyd".Error in manifest or policy file "C:\Path\Microsoft.VC90.CRT.MANIFEST" on line 17. The application element is not allowed in component manifest.

The content of the manifest file is:

<?xml` version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <noInheritable/>
  <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" processorArchitecture="amd64" version="9.0.30729.9625" publicKeyToken="1fc8b3b9a1e18e3b"/>
  <file name="msvcr90.dll" hashalg="SHA1" hash="eef12dbbab4ecda26049e1d6849ced68f7b4ac86"/>
  <file name="msvcp90.dll" hashalg="SHA1" hash="ec70c91e674b133ae9cc5bdb9b49e00f2e8157f9"/>
  <file name="msvcm90.dll" hashalg="SHA1" hash="765a622b71c5c616e9fa8cbee3e914d85a07214c"/>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
    </application>
  </compatibility>
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
    </windowsSettings>
  </application>
</assembly>

As you can see by the end of the file, there is an "application" section. Removing this solved the issue.

Context information (for bug reports)

  • Output of pyinstaller --version: 4.7
  • Version of Python: 3.10
  • Platform: Windows
  • How you installed Python: python.org/downloads
  • Did you also try this on another platform? NO
@iFelinto iFelinto added the triage Please triage and relabel this issue label Jan 13, 2022
@rokm
Copy link
Member

rokm commented Jan 13, 2022

To clarify, the manifest above is called Microsoft.VC90.CRT.MANIFEST and was collected into the dist along with msvcr*90.dll files? (I.e., this is not an .exe.manifest file, which should be embedded into executable by default in PyInstaller 4.7)

Any chance of getting steps for reproduction? I.e., what package(s) are you using in your program that end up pulling in vc90 runtime?

@iFelinto
Copy link
Author

Correct. The manifest file, along with the corresponding .dll were all collected into de dist folder.

I am using a library called Chilkat2, which has de dependency on the VC90 redistributables.

@rokm
Copy link
Member

rokm commented Jan 14, 2022

Hmm, I can get the same Microsoft.VC90.CRT.MANIFEST with <application> element generated, but it doesn't seem to cause the side-by-side issue on my Windows 10 system.

But the problematic part is that this manifest originally (well, after XML pretty print) looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <noInheritable />
  <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.9625" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b" />
  <file name="msvcr90.dll" hashalg="SHA1" hash="eef12dbbab4ecda26049e1d6849ced68f7b4ac86">
    <asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
      <dsig:Transforms>
        <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
      </dsig:Transforms>
      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
      <dsig:DigestValue>arBitwn4UalXZoX+BBD/nxpK9nA=</dsig:DigestValue>
    </asmv2:hash>
  </file>
  <file name="msvcp90.dll" hashalg="SHA1" hash="ec70c91e674b133ae9cc5bdb9b49e00f2e8157f9">
    <asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
      <dsig:Transforms>
        <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
      </dsig:Transforms>
      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
      <dsig:DigestValue>z7CohkSBVf2XpMLs1pJI5Sxktns=</dsig:DigestValue>
    </asmv2:hash>
  </file>
  <file name="msvcm90.dll" hashalg="SHA1" hash="765a622b71c5c616e9fa8cbee3e914d85a07214c">
    <asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
      <dsig:Transforms>
        <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
      </dsig:Transforms>
      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
      <dsig:DigestValue>nwlj3u1TD7e0iuyfo7sCrvs+HUI=</dsig:DigestValue>
    </asmv2:hash>
  </file>
</assembly>

Which means that it is probably being processed by our manifest parser/write combo, which ends up stripping away the parts the parser does not understand (e.g., the digest), and appends both <compatibility> and <application> elements. I'll have to dig around why we have to process the manifests in the first place, but we clearly should not be adding <application> to any manifest other than the one we generate for the exe...

@rokm rokm added bug and removed triage Please triage and relabel this issue labels Jan 14, 2022
@iFelinto
Copy link
Author

I've been reading a lot about this on SO. Most issues with this side by side message are related to the C++ Redistributables. In my case, what made it work was removing the "application" section.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants