多个 CRT:Visual Studio 2008 创建的 DLL 具有对 VC80 和 VC80 的明显依赖性。 VC90 CRT

发布于 2024-10-01 21:41:16 字数 2362 浏览 1 评论 0原文

我一直在研究为什么我们的 开放场景图 插件的调试版本无法正确加载(错误代码 14001, ERROR_SXS_CANT_GEN_ACTCTX)。经过多次谷歌搜索后,我发现问题在于,例如 freetype 调试 dll 有一个依赖于 VC90 和 VC80 调试 crt 的清单。

由于我使用 Visual Studio 2008(使用 cmake 生成)从头开始构建 DLL,因此我想不出对 VC80 调试 crt 的依赖性存在的任何原因。由于未安装 VS 2005,我没有任何调试 CRT,而且重新发布是非法的,所以我需要解决这个问题。

使用 dll 上的依赖项步行器,我找到的唯一 crt dll 是

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

此处没有引用任何 vc80 crt。那么它从何而来呢?

这是 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>

附加信息:

链接器命令行:

/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  

清单命令行:

    /nologo 
    /out:".\osgdb_freetype.dir\Debug\osgdb_freetyped.dll.embed.manifest" 
    /notify_update

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我恋#小黄人 2024-10-08 21:41:18

编译 DLL 时,是否链接到任何静态库依赖项?这些可以在清单中引入 CRT 引用;我以前在链接使用不同版本的 VC 编译的 boost 库时遇到过问题。

编辑:清单依赖项基本上是由编译时包含的一些#pragma 发出的。即使代码链接,这些 #pragma 也会向您的清单添加内容。有关本机并行程序集(以及清单如何影响加载程序)的 Microsoft 文档为 此处

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文