Multiple CRTs: visual studio 2008 creates DLLs with manifest dependencies to both VC80 & VC90 CRTs

StackOverflow https://stackoverflow.com/questions/4142229

  •  30-09-2019
  •  | 
  •  

문제

I've been looking into why the debug build of our open scene graph plugins can't be loaded correctly (error code 14001, ERROR_SXS_CANT_GEN_ACTCTX). After much googling I've found out that the problem is that e.g. the freetype debug dll has a manifest that depends on both VC90 and VC80 debug crts.

Since I built the DLL from scratch using visual studio 2008 (generated w/ cmake) I can't think of any reason why the depenency to VC80 debug crt is there. And since VS 2005 is not installed I don't have any debug CRTs for that, and it's illegal to redist, so I need to figure this out.

Using the dependency walker on the dll the only crt dlls I find are

  • msvcr90d.dll
  • msvcp90d.dll
  • msvcrt.dll

No reference to any vc80 crts here. So where does that come from?

This is the manifest for the dll.

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC90.DebugCRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC80.DebugCRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
</assembly>

Additional info:

Linker command line:

/OUT:"osgdb_freetyped.dll" 
/VERSION:0.0 
/INCREMENTAL 
/NOLOGO 
/DLL 
/MANIFEST 
/MANIFESTFILE:"osgdb_freetype.dir\Debug\osgdb_freetyped.dll.intermediate.manifest" 
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" 
/DEBUG 
/PDB:"osgdb_freetyped.pdb" 
/DYNAMICBASE 
/NXCOMPAT 
/IMPLIB:"osgdb_freetyped.lib" 
/ERRORREPORT:PROMPT 
/STACK:10000000 
/machine:I386 
/debug
kernel32.lib user32.lib gdi32.lib winspool.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib 
advapi32.lib  OpenThreadsd.lib osgd.lib osgDBd.lib osgUtild.lib 
osgTextd.lib freetype235_D.lib glu32.lib opengl32.lib 
osgDBd.lib osgd.lib OpenThreadsd.lib glu32.lib opengl32.lib  

Manifest command line:

    /nologo 
    /out:".\osgdb_freetype.dir\Debug\osgdb_freetyped.dll.embed.manifest" 
    /notify_update
도움이 되었습니까?

해결책

When compiling the DLL, are you linking to any static library dependencies? Those can bring in CRT references in the manifest; I've had problems before when linking in boost libraries that were compiled with a different version of VC.

EDIT: The manifest dependencies are basically emitted by some #pragmas that are included at compile time. Even though the code links, those #pragmas will add stuff to your manifest. The Microsoft documentation for native side-by-side assemblies (and how the manifest affects the loader) is here.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top