如何编译 x64 的 OpenSSL?
按照 INSTALL.W64 中的说明进行操作后,我遇到两个问题:
- 代码仍然写入“out32”文件夹。 我需要能够链接到我的工作站上的 32 位和 64 位版本的库,因此我不希望 64 位版本破坏 32 位库。
- 输出仍然是32位! 这意味着我在尝试从 x64 应用程序链接到库时收到“无法解析的外部符号”错误。
After following the instructions in INSTALL.W64 I have two problems:
- The code is still written to the "out32" folder. I need to be able to link to both 32-bit and 64-bit versions of the library on my workstation, so I don't want the 64-bit versions to clobber the 32-bit libs.
- The output is still 32-bit! This means that I get "unresolved external symbol" errors when trying to link to the libraries from an x64 app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
要编译静态库(发布和调试),您需要执行以下操作:
perl 配置 VC-WIN64A no-shared no-idea
To compile the static libraries (both release and debug), this is what you need to do:
perl Configure VC-WIN64A no-shared no-idea
我使用 1.0.1c 源代码以这种方式解决了问题:
将此块添加到
util/pl/VC-32.pl
中,就在$o='\\';< 之前/代码>行。
将此块添加到
util/pl/VC-32.pl
中,位于if ($debug)
行之前。然后构建所有品种:
I solved the problem this way, using the 1.0.1c source:
Add this block to
util/pl/VC-32.pl
, just before the$o='\\';
line.Add this block to
util/pl/VC-32.pl
, just before theif ($debug)
line.Then build all varieties:
使用柯南。 安装和使用非常简单。
您可以请求准备好使用的文件。 例如,对于 Linux x64 或与 Visual Studio 2012 一起使用。以下是示例指令:
conan install OpenSSL/1.0.2g@lasote/stable -s arch="x86_64" -s build_type="Debug" -s compiler=" gcc" -s compiler.version="5.3" -s os="Linux" -o 386="False" -o no_asm="False" -o no_rsa="False" -o no_cast="False" -o no_hmac= “假” -o no_sse2 =“假” -o no_zlib =“假”...
Use Conan. It is very simple to install and use.
You can request the files ready for use. For example for Linux x64 or usage with Visual Studio 2012. Here a sample instruction:
conan install OpenSSL/1.0.2g@lasote/stable -s arch="x86_64" -s build_type="Debug" -s compiler="gcc" -s compiler.version="5.3" -s os="Linux" -o 386="False" -o no_asm="False" -o no_rsa="False" -o no_cast="False" -o no_hmac="False" -o no_sse2="False" -o no_zlib="False" ...
在撰写本操作指南时,OpenSSL 的最新版本是 1.1.1a。
环境:
先决条件:
编译 x64:
编译 x86:
At the time of writing this how-to the most recent version of OpenSSL is 1.1.1a.
Environment:
Prerequisites:
Compiling x64:
Compiling x86:
根据官方文档:
“您可能会感到惊讶:64 位工件确实输出在 out32* 子目录中,并且名称以 *32.dll 结尾。事实上,到目前为止,64 位编译目标是对旧版本的增量更改许多编译标志仍然标记为“32”,尽管它们确实适用于 32 位和 64 位目标。
所以第一个答案已经没有必要了。
说明可以在这里找到:
https://wiki.openssl.org/index.php/Compilation_and_Installation #W64
According to the official documentation:
"You may be surprised: the 64bit artefacts are indeed output in the out32* sub-directories and bear names ending *32.dll. Fact is the 64 bit compile target is so far an incremental change over the legacy 32bit windows target. Numerous compile flags are still labelled "32" although those do apply to both 32 and 64bit targets."
So the first answer is no longer necessary.
Instructions can be found here:
https://wiki.openssl.org/index.php/Compilation_and_Installation#W64
如果您在 cygwin 中构建,则可以使用以下脚本,假设 MSDEVPATH 已设置为您的 Visual Studio 目录
If you're building in cygwin, you can use the following script, assume MSDEVPATH has already been set to your Visual Studio dir
自最初提出此问题以来,构建说明已发生变化。 您可以在此处找到新说明。 请注意,您需要安装 perl 和 NASM,并且需要使用开发人员命令提示符。
The build instructions have changed since this question was originally asked. The new instructions can be found here. Note that you will need to have perl and NASM installed, and you will need to use the developer command prompt.
您也可以使用MSYS+mingw-w64:
1) 下载msys并解压到C:\msys
2) 下载并解压mingw-w64到c:\mingw64
3) 运行 msys 安装后脚本。 当它要求您安装 mingw 时,请将其指向 C:\mingw64\bin
4) 提取 openssl 每日快照(1.0.0 版本有一个 bug)。 在源目录中运行
配置mingw64
制作
进行检查
进行安装
5) openssl安装到/local/
You can also use MSYS+mingw-w64:
1) download and extract msys to C:\msys
2) download and extract mingw-w64 to c:\mingw64
3) run msys postinstall script. When it asks for your mingw installation, point it to C:\mingw64\bin
4) Extract an openssl daily snapshot (1.0.0 release has a bug). In the source dir run
configure mingw64
make
make check
make install
5) openssl is installed to /local/