本文介绍了如何构建OpenSSL的对Windows运行时静态链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Windows的C ++应用程序,使用OpenSSL的1.0.1e库。我在Visual Studio 2008中。

I'm working on a C++ application for Windows that uses OpenSSL 1.0.1e library. I'm on Visual Studio 2008.

有关移植原因我的应用程序对运行时库静态链接( / MT / MTD 选项)。我不船舶运行时库与我的应用程序。

For portability reasons my application is statically linked against runtime libraries (/MT and /MTd options). And I don't ship runtime libs with my application.

按照,该库是默认链接的是多线程的DLL运行时( / MDD ),这是我的情况明显不符。因此,为了使我增加了 applink.c 来我的项目,我的工作方案。在我的开发计算机和大多数测试计算机程序工作正常。

Per the OpenSSL FAQ, the library is by default linked against multithreaded DLL runtime (/MDd) which is obviously incompatible with my scenario. So to make my program work I've added applink.c to my project. On my dev machine and on most test computers the program works fine.

但不幸的是,我所在的地方的计算机应用程序无法启动。 Windows会显示错误:

But unfortunately I've located computers where the app doesn't start. Windows displays error:

The application failed to initialize properly (0xc0150002). Click on OK to
terminate the application.

我已经打开的libeay32.dll 在Dependency Walker中,我看到 MSVCR90.DLL 是找不到的。因此,与 applink.c 的伎俩并没有真正为我工作。

I've opened libeay32.dll in Dependency Walker and I see that MSVCR90.dll is not found. So the trick with applink.c doesn't really work for me.

如何构建OpenSSL的与 / MT / MTD 选项?

How do I build OpenSSL with /MT or /MTd option?

推荐答案

使用 nt.mak makefile文件,而不是 ntdll.mak 生成文件。

Use the nt.mak makefile rather than the ntdll.mak makefile.

顺便说一句,我写了各地的标准OpenSSL的一些脚本生成脚本,这使得它容易(至少对我来说)在Windows与x86和x64的混合使用OpenSSL,你可以从他们的here.

As an aside, I have written some scripts around the standard OpenSSL build scripts which make it 'easier' (for me at least) to use OpenSSL on Windows with a mix of both x86 and x64, you can get them from here.

这篇关于如何构建OpenSSL的对Windows运行时静态链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 12:24
查看更多