并行疯狂 - 在同一台计算机上运行二进制文件

发布于 2024-10-10 04:21:33 字数 1103 浏览 3 评论 0原文

这是我的配置:

  • 计算机 A - Windows 7,修补了 Win7 兼容性的 MS Visual Studio 2005 (8.0.50727.867)
  • 计算机 B - Windows XP SP2,安装了 MS Visual Studio 2005 (8.0.50727.42)

我的项目有一些外部依赖项(预构建的 DLL -要么构建在 A 上,要么从 Internet 下载),由源代码构建的几个 DLL 和一个可执行文件。我主要在A上进行开发,那里一切都很好。有时,我尝试在计算机 B 上构建我的项目,将预构建的 DLL 复制到输出文件夹。一切都构建得很好,但是尝试启动我的应用程序时我得到了

应用程序无法正确初始化(0xc0150002)....

事件日志包含其中两个:

无法找到依赖的程序集 Microsoft.VC80.CRT,最后一个错误是 引用的程序集未安装在您的系统上。

再加上稍微有趣一点的

生成激活上下文失败 一些.dll。参考错误信息: 操作成功完成。

此时,我正在尝试 Google-Fu,但徒劳无功 - 几乎所有点击都是关于在没有安装 Visual Studio 的计算机上运行二进制文件的。然而,就我而言,可执行文件无法在它们构建的计算机上运行。

下一步是尝试 d​​ependency walker,它让我更加困惑 - 我从同一个盒子上的源代码构建的 DLL 找不到 MSVCR80.DLLMSVCP80.DLL,但是可执行文件就这两个 DLL 而言,似乎没问题,即当我使用 dependency walker 打开可执行文件时,它显示可以找到 MSVC?80.DLL,但是当我打开其中一个 DLL 时,它会显示他们不能。这就是我完全不知道该怎么做的地方,所以我问你,亲爱的 stackoverflow :)

我承认我对整个并排的事情有点模糊,所以对这个主题的一般阅读也将受到赞赏。

Here's my configuration:

  • Computer A - Windows 7, MS Visual Studio 2005 patched for Win7 compatibility (8.0.50727.867)
  • Computer B - Windows XP SP2, MS Visual Studio 2005 installed (8.0.50727.42)

My project has some external dependencies (prebuilt DLLs - either build on A or downloaded from the Internet), a couple of DLLs built from sources and one executable. I am mostly developing on A and all is fine there. At some point I try to build my project on computer B, copying the prebuilt DLLs to the output folder. Everything builds fine, but trying to start my application I get

The application failed to initialize properly (0xc0150002)....

The event log contains two of those:

Dependent Assembly Microsoft.VC80.CRT could not be found and Last Error was The referenced assembly is not installed on your system.

plus the slightly more amusing

Generate Activation Context failed for
some.dll. Reference error message: The
operation completed successfully.

At this point I'm trying my Google-Fu, but in vain - virtually all hits are about running binaries on machines without Visual Studio installed. In my case, however, the executables fail to run on the computer they are built.

Next step was to try dependency walker and it baffled me even more - my DLLs built from sources on the same box cannot find MSVCR80.DLL and MSVCP80.DLL, however the executable seems to be alright in respect to those two DLLs i.e. when I open the executable with dependency walker it shows that the MSVC?80.DLLs can be found, but when I open one of my DLLs it says they cannot. That's where I am completely out of ideas what to do so I'm asking you, dear stackoverflow :)

I admit I'm a bit blurry on the whole side-by-side thing, so general reading on the topic will also be appreciated.

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

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

发布评论

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

评论(4

三月梨花 2024-10-17 04:21:33

您的问题已经回答了您的问题:计算机 A 的 VC 运行时版本为 8.0.50727.867,而计算机 B 仅具有版本 8.0.50727.42

您在计算机 A 上构建了库,它们依赖于 VC 运行时版本 867。 (这可以在库中嵌入的清单中找到。)当您将它们复制到计算机 B 时,这些库仍然需要版本 867 的运行时,但您只有版本 42。

要解决 VC 运行时程序集依赖性,您必须安装 VC计算机 B 上的版本 867 的运行时可再发行组件。但是,我建议您更新计算机 B 上的 Visual Studio,以便两台计算机上拥有相同的版本。更好的是,在两台计算机上安装 Visual Studio 2005 SP1,然后安装 此 SP1 安全更新。安装后者后,您的库将依赖于版本 8.0.50727.4053

Your question has the answer to your problem: Computer A has VC runtime of version 8.0.50727.867, and Computer B has only version 8.0.50727.42.

You built your libraries on Computer A, and they depend on version 867 of VC runtime. (This can be found in manifest embedded in the libraries.) When you copy them to Computer B, these libraries still require version 867 of the runtime but you have only version 42.

To resolve the VC runtime assembly dependencies, you have to install VC runtime redistributables of version 867 on Computer B. However, I'd advise you to update Visual Studio on Computer B so that you have the same version on both computers. And even better, install Visual Studio 2005 SP1 on both computers and then install this security update to SP1. After installing the latter, your libraries will depend on version 8.0.50727.4053.

逆蝶 2024-10-17 04:21:33

该问题可能与两台计算机上安装的不同版本的 CRT 运行时有关。是否可以构建所有模块以使用静态链接的 CRT 运行时来验证这一点?

it's possible the problem is related with different versions of CRT runtime installed on both machines. is it possible to build all your modules to use statically linked CRT runtime to verify this?

待"谢繁草 2024-10-17 04:21:33

首先我会通过准备虚拟项目来加载它们来检查预构建的 dll

first I'd check that prebuilt dlls by preparing dummy project to load them

自在安然 2024-10-17 04:21:33

我最近在一台机器上构建项目然后将它们移动到另一台机器时遇到了同样类型的错误。这里最大的罪魁祸首可能是二进制组件之一的调试配置。也就是说,MSVC 有相当严格的要求,即所有 DLL/EXE 都使用相同的运行时库构建、调试或发布,否则它们将无法一起工作。

当我发生这种情况时,它们也往往可以很好地编译,但是当您尝试运行它们时,您会收到极其神秘的错误消息。

您需要确保一起构建的每个模块都使用相同的配置,从而通过整个构建链进行调试或发布。此错误也可能因其他库中的不匹配而出现,因此请确保您的 MSVC 与您正在构建的计算机上的版本完全相同。

I recently had the same type of error when building projects on one machine and then moving them to another machine. The biggest culprit here is likely a debug configuration for one of the binary components. That is, MSVC has the fairly rigid requirement of all DLLs/EXEs being built with the same runtime library, debug or release, otherwise they will not work together.

When I had this happen they also tend to compile just fine, but when you attempt to run them you get that extremely cryptic error message.

You need to ensure that every module you build together uses the same configuration, thus debug or release through the entire build chain. This error also likely comes up with mismatches in other libraries, so make sure your MSVC is the exact same version on the machines where you are building.

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