[openssl-users] Windows Compile Fails

Michael Wojcik Michael.Wojcik at microfocus.com
Fri Jun 19 14:32:50 UTC 2015

> From: openssl-users [mailto:openssl-users-bounces at openssl.org] On Behalf
> Of Thomas J. Hruska
> Sent: Thursday, June 18, 2015 22:56
> On 6/18/2015 4:46 PM, Jay Foster wrote:
> > I'm new to building OpenSSL with Windows.  I'm trying to build OpenSSL
> > 1.0.2c for Windows, but get a linking error
> What Command Prompt are you running?  You have to use the correct
> "Native Tools" for the target hardware type.  If you are building
> VC-WIN32, then you are targeting 32-bit hardware and need to run the x86
> Native Tools Command Prompt (not the x64 version).  You can't mix and
> match targets.

More generally, the compiler bitness has to match the bitness you configure the OpenSSL build for. The Visual Studio "command prompt" shortcuts set up the appropriate environment, but you can also do it using the various batch files supplied with VS (vcvars32.bat, etc), or by setting the appropriate paths and other environment variables manually. (I build OpenSSL for Windows from a Cygwin bash shell, using Visual Studio, and I have bash functions that set up the appropriate build environments.)

The bitness of the OS doesn't matter. You can cross-compile x64 binaries on 32-bit Windows and vice versa. When we build OpenSSL for Windows as part of our integration / automated build process, we have our own wrapper scripts that build both bitnesses in separate build directories, using the same build machine.

A quick check is to run "cl" with no parameters from the command line you're using for OpenSSL. It will say something like "Microsoft (R) C/C++ Optimizing Compiler Version 17.00.61030 for x86" or "... for x64".

Michael Wojcik
Technology Specialist, Micro Focus

More information about the openssl-users mailing list