Need help with OpenSSL static library

Matt Caswell matt at openssl.org
Mon Mar 13 12:56:07 UTC 2023



On 13/03/2023 12:16, Jonathan Day wrote:
> 
> If I have to rebuild the libraries, then I run into a second problem - 
> it's not detecting that I have a 64-bit Visual Studio and is trying to 
> compile everything as 32-bit and errors out on the 64-bit build. I can 
> compile my code as 64-bit, so it's not a problem with Visual Studio - 
> I've seen something on the Internet about NASM being 32-bit only, but 
> that's old and I don't know if it's still valid.
> 
> Is NASM a problem with 64-bit builds and should I de-install it to get 
> the code to build correctly in 64-bits?

NASM should not be a problem.

32-bit vs 64-bit confusion normally occurs when using the VisualStudio 
toolchain intended for 32-bit when using the "VC-WIN64A" OpenSSL target, 
or the other way around (i.e. the 64-bit toolchain and "VC-WIN32" 
OpenSSL target). Make sure you are using the correct toolchain. From 
NOTES-WINDOWS.md:

  4. Use Visual Studio Developer Command Prompt with administrative 
privileges,
     choosing one of its variants depending on the intended architecture.
     Or run `cmd` and execute `vcvarsall.bat` with one of the options `x86`,
     `x86_amd64`, `x86_arm`, `x86_arm64`, `amd64`, `amd64_x86`, `amd64_arm`,
     or `amd64_arm64`.
     This sets up the environment variables needed for `nmake.exe`, 
`cl.exe`,
     etc.
     See also
     <https://docs.microsoft.com/cpp/build/building-on-the-command-line>


If you run "cl.exe" on its own from your command prompt it will tell you 
what architecture you are targetting. This is what mine looks like for 
64-bit:

 >cl.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.30.30709 for x64

And for 32-bit:


 >cl.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.30.30709 for x86


If you do swap toolchain be sure to get a completely clean OpenSSL build 
directory and re-build. Problems can occur if you try to "rebuild" in an 
existing directory when swapping toolchain.


Matt



More information about the openssl-users mailing list