How do I compile fips capable openssl on Windows x64? - c++

I'm currently using the following steps but I'm having trouble compiling:
Add 64bit/32bit NASM to path: C:\Program Files\NASM for 64 bit
//On 32 bit simply switch to x86 native tool
Open native command prompt for VS2015 x64
or run "C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\bin\amd64\vcvars64.bat"
== Environment variables that need to be set ==
Set FPSDIR=C:\Dev\OpenSSL\x64\openssl-fips-ecp-2.0.16
Set PROCESSOR_ARCHITECTURE=AMD64
== Building Fips compliant module ==
cd openssl-fips-ecp-2.0.16
xcopy inc32\* include\* /O /X /E /H /K
=========
Open ms\do_fips.bat and remove "dll"
[Optional] add "debug" to same line
Open util\mk1mf.pl and add "libcmt.lib LIBCPMT.LIB libcmtd.lib LIBCPMTD.LIB" to EX_LIBS (Line 650 typically)
=========
ms\do_fips
mkdir lib
copy out32.dbg\* lib\*
mkdir bin
copy util\* bin\*
copy out32.dbg\fips_standalone_sha1.exe bin
== Building ==
cd openssl-1.0.2l
======
Open util\pl\VC-32.pl
remove "|| $fips " from line 48 and 133
[Optional]Open ms\do_win64a.bat and add "debug" to line 15 right before VC-WIN64A
======
perl Configure VC-WIN64A fips no-ec2m no-shared -DUNICODE -DOPENSSL_THREADS --with-fipsdir=C:\Dev\OpenSSL\x64\openssl-fips-ecp-2.0.16
ms\do_win64a
nmake -f ms\nt.mak clean
nmake -f ms\ntdll.mak clean
nmake -f ms\nt.mak
//On 32 bit be sure to do 32bit dir and
//Configure VC-WIN32
//ms\do_nasm (add debug here too)
Compiler is failing:
DOPENSSL_THREADS -DDSO_WIN32 -DOPENSSL_FIPS -DOPENSSL_NO_ERR -DUNICODE -DOPENSSL_THREADS -W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -IC:\Dev\OpenSSL\x64\openssl-fips-ecp-2.0.16/include -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_KRB5 -DOPENSSL_FIPS -DOPENSSL_NO_JPAKE -DOPENSSL_NO_WEAK_SSL_CIPHERS -DOPENSSL_NO_DYNAMIC_ENGINE /Zl /Zi /Fdtmp32/lib -c .\crypto\rand\rand_lib.c
rand_lib.c
.\crypto\rand\rand_lib.c(191): error C2143: syntax error: missing ')' before '*'
.\crypto\rand\rand_lib.c(191): error C2143: syntax error: missing '{' before '*'
.\crypto\rand\rand_lib.c(191): error C2059: syntax error: 'type'
.\crypto\rand\rand_lib.c(192): error C2059: syntax error: ')'
I looked at the code and it seems that it doesn't know what
DRBG_CTX
I searched and it should be included from FIPS directory, but it isn't, what is wrong with my build steps?

Found it, it seems by default the "include" directory is filled with 0kb files for some reason, I overwrited with the 32 bit include (inc32) directory's contents in the FIPS folder to the "include" one, and it seems to have solved the issue.

In case someone is wondering how to build it and pass the fips self-test.
Add 64bit/32bit NASM to path: C:\Program Files\NASM for 64 bit
//On 32 bit simply switch to x86 native tool and Set PROCESSOR_ARCHITECTURE=x86
Open native command prompt for VS2015 x64
or run "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
== Environment variables that need to be set ==
Set FPSDIR=C:\Dev\OpenSSL\x64\openssl-fips-ecp-2.0.16
Set PROCESSOR_ARCHITECTURE=AMD64
== Building Fips compliant module ==
cd openssl-fips-ecp-2.0.16
Open util\mk1mf.pl and add
$cflags.= " -DOPENSSL_FIPS_DEBUGGER";
after line 311
This will disable the fingerprint check for the module, whose purpose is to ensure that the source code hasn't been modified(but leave all other tests intact).
This is done because the fingerprint check appears to be broken for static libraries.
ms\do_fips
mkdir lib
copy out32dll\* lib\*
mkdir bin
copy util\* bin\*
copy out32dll\fips_standalone_sha1.exe bin
xcopy inc32\* include\* /O /X /E /H /K
== Building ==
cd openssl-1.0.2l
perl Configure VC-WIN64A fips no-ec2m no-shared -DUNICODE -DOPENSSL_FIPS_DEBUGGER -DOPENSSL_THREADS --with-fipsdir=C:\Dev\OpenSSL\openssl-fips-ecp-2.0.16
ms\do_win64a
nmake -f ms\nt.mak clean
nmake -f ms\ntdll.mak clean
nmake -f ms\nt.mak
//On 32 bit be sure to do 32bit dir and
//Configure VC-WIN32 ms\do_nasm

Related

How to set a debugger flag on C build?

I'am following a tutorial on making a game in C/C++. The building part takes place with just a .bat file. I'll show it.
#echo off
mkdir ..\build
pushd ..\build
cl -zi s:\games\game1\code\win32_game1.cpp user32.lib
popd
The flag -zi is used for getting the debugger output/information. The only problem is that when I run this script in the command line I get the following error:
Ignoring unknown option "-zi"
Can somebody tells me why -zi isn't working or what I can use instead? I'm using Visual Studio 2017.

build openssl on win64 fail

when run this command with msys in openssl source code directory.
$ ./config
Operating system: x86_64-whatever-mingw
Configuring for mingw
Configuring for mingw
no-ec_nistp_64_gcc_128 [default] OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
no-gmp [default] OPENSSL_NO_GMP (skip dir)
no-jpake [experimental] OPENSSL_NO_JPAKE (skip dir)
no-krb5 [krb5-flavor not specified] OPENSSL_NO_KRB5
no-libunbound [experimental] OPENSSL_NO_LIBUNBOUND (skip dir)
no-md2 [default] OPENSSL_NO_MD2 (skip dir)
no-rc5 [default] OPENSSL_NO_RC5 (skip dir)
no-rfc3779 [default] OPENSSL_NO_RFC3779 (skip dir)
no-sctp [default] OPENSSL_NO_SCTP (skip dir)
no-shared [default]
no-ssl-trace [default] OPENSSL_NO_SSL_TRACE (skip dir)
no-ssl2 [default] OPENSSL_NO_SSL2 (skip dir)
no-store [experimental] OPENSSL_NO_STORE (skip dir)
no-unit-test [default] OPENSSL_NO_UNIT_TEST (skip dir)
no-weak-ssl-ciphers [default] OPENSSL_NO_WEAK_SSL_CIPHERS (skip dir)
no-zlib [default]
no-zlib-dynamic [default]
IsMK1MF=0
CC =gcc
CFLAG =-DOPENSSL_THREADS -D_MT -DDSO_WIN32 -DL_ENDIAN -DWIN32_LEAN_AND_M EAN -fomit-frame-pointer -O3 -march=i486 -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPE NSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPO OL_ASM -DGHASH_ASM
EX_LIBS =-lws2_32 -lgdi32 -lcrypt32
CPUID_OBJ =x86cpuid.o
BN_ASM =bn-586.o co-586.o x86-mont.o x86-gf2m.o
EC_ASM =
DES_ENC =des-586.o crypt586.o
AES_ENC =aes-586.o vpaes-x86.o aesni-x86.o
BF_ENC =bf-586.o
CAST_ENC =cast-586.o
RC4_ENC =rc4-586.o
RC5_ENC =rc5-586.o
MD5_OBJ_ASM =md5-586.o
SHA1_OBJ_ASM =sha1-586.o sha256-586.o sha512-586.o
RMD160_OBJ_ASM=rmd-586.o
CMLL_ENC =cmll-x86.o
MODES_OBJ =ghash-x86.o
ENGINES_OBJ =
PROCESSOR =
RANLIB =/c/Program Files (x86)/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev 1/mingw32/bin/ranlib.exe
ARFLAGS =
PERL =/usr/bin/perl.exe
THIRTY_TWO_BIT mode
DES_PTR used
DES_RISC1 used
DES_UNROLL used
BN_LLONG mode
RC4_INDEX mode
RC4_CHUNK is undefined
e_os2.h => include/openssl/e_os2.h
/usr/bin/sh: -c: line 0: syntax error near unexpected token `('
/usr/bin/sh: -c: line 0: `set -e; target=links; for dir in crypto ssl engines ap ps test tools; do if [ -d "$dir" ]; then ( cd $dir && echo "making $target in $dir..." && TOP= && unset TOP ${LIB+LIB} ${LIBS+LIBS} ${INCLUDE+INCLUDE} ${IN CLUDES+INCLUDES} ${DIR+DIR} ${DIRS+DIRS} ${SRC+SRC} ${LIBSRC+LIBSRC} ${LIBOBJ+LI BOBJ} ${ALL+ALL} ${EXHEADER+EXHEADER} ${HEADER+HEADER} ${GENERAL+GENERAL} ${CFLA GS+CFLAGS} ${ASFLAGS+ASFLAGS} ${AFLAGS+AFLAGS} ${LDCMD+LDCMD} ${LDFLAGS+LDFLAGS} ${SCRIPTS+SCRIPTS} ${SHAREDCMD+SHAREDCMD} ${SHAREDFLAGS+SHAREDFLAGS} ${SHARED_L IB+SHARED_LIB} ${LIBEXTRAS+LIBEXTRAS} ${APPS+APPS} && C:/Program Files (x86)/min gw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/make -e LC_ALL=C PLATFORM=' mingw' PROCESSOR='' CC='gcc' CFLAG='-DOPENSSL_THREADS -D_MT -DDSO_WIN32 -DL_ENDI AN -DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -march=i486 -Wall -DOPENSSL_BN _ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM' AS='gcc' ASFLAG='-DOPENSSL_THREADS -D_M T -DDSO_WIN32 -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -march=i 486 -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM - DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -c' AR='ar r' NM= 'nm' RANLIB='/c/Program Files (x86)/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/ mingw32/bin/ranlib.exe' RC='windres' CROSS_COMPILE='' PERL='C:/Program Files/Git /usr/bin/perl.exe' ENGDIRS='ccgost' SDIRS='objects md4 md5 sha mdc2 hmac ripemd whrlpool des aes rc2 rc4 idea bf cast camellia seed modes bn ec rsa dsa ecdsa dh ecdh dso engine buffer bio stack lhash rand err evp asn1 pem x509 x509v3 conf t xt_db pkcs7 pkcs12 comp ocsp ui krb5 cms pqueue ts srp cmac' LIBRPATH='/usr/loca l/ssl/lib' INSTALL_PREFIX='' INSTALLTOP='/usr/local/ssl' OPENSSLDIR='/usr/local/ ssl' LIBDIR='lib' MAKEDEPEND='$${TOP}/util/domd $${TOP} -MD gcc' DEPFLAG='-DOPEN SSL_NO_DEPRECATED -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO _JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RF C3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_SSL2 -DOPENSSL_NO_ST ORE -DOPENSSL_NO_UNIT_TEST -DOPENSSL_NO_WEAK_SSL_CIPHERS' MAKEDEPPROG='gcc' SHAR ED_LDFLAGS='' KRB5_INCLUDES='' LIBKRB5='' ZLIB_INCLUDE='' LIBZLIB='' EXE_EXT='.e xe' SHARED_LIBS='' SHLIB_EXT='.dll.a' SHLIB_TARGET='cygwin-shared' PEX_LIBS='' E X_LIBS='-lws2_32 -lgdi32 -lcrypt32' CPUID_OBJ='x86cpuid.o' BN_ASM='bn-586.o co-5 86.o x86-mont.o x86-gf2m.o' EC_ASM='' DES_ENC='des-586.o crypt586.o' AES_ENC='ae s-586.o vpaes-x86.o aesni-x86.o' CMLL_ENC='cmll-x86.o' BF_ENC='bf-586.o' CAST_EN C='cast-586.o' RC4_ENC='rc4-586.o' RC5_ENC='rc5-586.o' SHA1_ASM_OBJ='sha1-586.o sha256-586.o sha512-586.o' MD5_ASM_OBJ='md5-586.o' RMD160_ASM_OBJ='rmd-586.o' WP _ASM_OBJ='wp_block.o wp-mmx.o' MODES_ASM_OBJ='ghash-x86.o' ENGINES_ASM_OBJ='' PE RLASM_SCHEME='coff' FIPSLIBDIR='' FIPSDIR='/usr/local/ssl/fips-2.0' FIPSCANLIB=" ${FIPSCANLIB:-}" THIS=${THIS:-links} MAKEFILE=Makefile MAKEOVERRIDES= TOP=.. DIR =$dir $target ) || exit 1; fi; done'
Makefile:438: recipe for target 'links' failed
make: *** [links] Error 1
I'm using win64 work station,and I tried the guide in INSTALL.WIN64
You will need Microsoft Platform SDK, available for download at
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/. As per
April 2005 Platform SDK is equipped with Win64 compilers, as well
as assemblers, but it might change in the future.
However I don't have Microsoft Platform SDK,and I don't know which file should I download since the link is now redirected .So I tried the guide in INSTALL.WIN32 then I am stuck here.
UPDATE:
After I move the mingw to a no ( path it fail in another place.
DES_INT used
RC4_CHUNK is unsigned long long
e_os2.h => include/openssl/e_os2.h
making links in crypto...
make[1]: Entering directory 'D:/Downloads/openssl-1.0.2k/crypto'
make[1]: *** No rule to make target 'links'. Stop.
make[1]: Leaving directory 'D:/Downloads/openssl-1.0.2k/crypto'
Makefile:438: recipe for target 'links' failed
make: *** [links] Error 1
the other part is most similar with upper block.
UPDATE :after use Microsoft VisualStudio build tool
After I use the windows native ms build tool.when I met
nmake -f ms\ntdll.mak
'nmake' is not recognized as an internal or external command
I find the solution here.Again I run the same command.It fails on another error.
nmake -f ms\ntdll.mak
ms\uplink.c(11) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory NMAKE : fatal error U1077: 'cl' : return code '0x2'
In my situation this answer almost fix it.However I'm using a different version of the .net framework,then I found the detail version number with help of this post.And now I stuck here.
d:\Downloads\openssl-1.0.2k>nmake -f ms\ntdll.mak
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
Building OpenSSL
cl /Fotmp32dll\md4_dgst.obj -Iinc32 -Itmp32dll /MD /Ox -DOPENSSL_THREADS -DDSO_WIN32 -W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_WEAK_SSL_CIPHERS -DOPENSSL_NO_STATIC_ENGINE /Zi /Fdtmp32dll/lib -D_WINDLL -DOPENSSL_BUILD_SHLIBCRYPTO -c .\crypto\md4\md4_dgst.c
md4_dgst.c
.\crypto\md4\md4_dgst.c(59): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.EXE"' : return code '0x2'
Stop.
I find in a variable in the Makefile which makes me feel wired.But not sure it's the right place to change.
OPENSSLDIR=/usr/local/ssl
In a Bourne shell (/usr/bin/sh), parentheses are used to create a subprocess, see e.g. Bash - Grouping Commands
Placing a list of commands between parentheses causes a subshell environment to be created (see Command Execution Environment), and each of the commands in list to be executed in that subshell.
In the error message, there's a sub-Make called
C:/Program Files (x86)/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/make -e LC_ALL=C PLATFORM=...
containing parentheses. This might be fixed by quoting the command, e.g.
"C:/Program Files (x86)/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/make" -e LC_ALL=C PLATFORM=...
This should prevent the shell from interpreting the parentheses as a command to create a subshell.
There may be other places containing some (x86) or (...).
To build openssl on win64 it's easier to use their native Visual C++ 2015 Build Tools.Use VS native tools command is recommended,found detail in this answer.If the vcvar32.bat doesn't work,refer this answer to modify it.The .Net version reference is here.After all these I built openssl-1.0.2k on Win64/x64 finally.

libffi with Visual Studio 2013

I need to compile the libffi library to use it in a Visual Studio 2013 project.
I am using libffi 3.0.13, downloaded from their original page
I have been struggling to make it work, following the instructions given in README, or trying to come up with something myself, but ended up failing pretty fast.
I tried:
using the Mingw environment to configure the libffi. But that is done for 'gcc' and 'make'. If I compile with gcc, it probably won't link with VS project correctly (right?). Besides, I don't have make (I would install it gladly, if gcc compilation would suffice)
using the ../configure CC="../msvcc.sh -m64" command as suggested in README, but my mingw does not know what cl is.
Tried providing the full path to cl.exe, but the compiler failed the configure tests. The log shows:
configure:3673: ../msvcc.sh conftest.c >&5
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe -MD -nologo -W3 conftest.c
conftest.c
LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'
Tried using the Visual Studio shell, but then the configure program is unknown
first, forgive my poor english! I solved this problem just now!
find your msvcc.sh
modify it, find this postion:
else
args="$md $args"
echo "$cl $args"
eval "\"$cl\" $args"
result=$?
fi
I add some flags:
else
args="$md $args"
echo "********"
args=" $args -ID:/soft/Microsoft\ Visual\ Studio\ 12.0/VC/include/ -link -LIBPATH:D:/soft/Microsoft\ Visual\ Studio\ 12.0/VC/lib/ -LIBPATH:C:/Program\ Files\ \(x86\)/Microsoft\ SDKs/Windows/v7.1A/Lib/"
echo "********"
echo "$cl $args"
eval "\"$cl\" $args"
result=$?
fi
change "D:/soft/Microsoft\ Visual\ Studio\ 12.0" these things to your path!
in cygwin: ./configure CC=E:/project/3rd_parth/libffi/libffi-3.0.13/msvcc.sh(also change the path)
done!
Hope it is not too late!

Error while building project when executing build step 'Make'

I've just installed Qt SDK 1.2.1 on my PC. I created a new project as a test:
File > New File or Project... > Other Project > Plain C++ Project
I chose these build settings:
Qt Creator generated this .pro file:
TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += main.cpp
and this main.cpp file:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
The build fails:
13:39:35: Running build steps for project test...
13:39:35: Starting: "C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe" clean
Could Not Find C:\Dev\Projects\Qt\test\debug\main.obj
del debug\main.obj
del debug\test.intermediate.manifest debug\test.exp debug\test.ilk vc*.pdb vc*.idb
Could Not Find C:\Dev\Projects\Qt\test\debug\test.intermediate.manifest
Could Not Find C:\Dev\Projects\Qt\test\vc*.pdb
Could Not Find C:\Dev\Projects\Qt\test\test.intermediate.manifest
Could Not Find C:\Dev\Projects\Qt\test\test.exp
Could Not Find C:\Dev\Projects\Qt\test\test.ilk
Could Not Find C:\Dev\Projects\Qt\test\vc*.pdb
c:\dev\qt\qtsdk\desktop\qt\4.8.1\msvc2008\bin\qmake.exe -spec ..\..\..\Qt\QtSDK\Desktop\Qt\4.8.1\msvc2008\mkspecs\win32-msvc2008 CONFIG+=declarative_debug -o Makefile test.pro
C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe -f Makefile.Debug clean
C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe -f Makefile.Release clean
Could Not Find C:\Dev\Projects\Qt\test\release\main.obj
Could Not Find C:\Dev\Projects\Qt\test\release\test.intermediate.manifest
del release\main.obj
del release\test.intermediate.manifest release\test.exp
del ".\test.intermediate.manifest"
del test.exp
del test.ilk
del vc*.pdb
del vc*.idb
Could Not Find C:\Dev\Projects\Qt\test\vc*.idb
jom 1.0.8 - empower your cores
13:39:36: The process "C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe" exited normally.
13:39:36: Configuration unchanged, skipping qmake step.
13:39:36: Starting: "C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe"
cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -I"..\..\..\Qt\QtSDK\Desktop\Qt\4.8.1\msvc2008\mkspecs\win32-msvc2008" -Fodebug\ #C:\DOCUME~1\Mitch!\LOCALS~1\Temp\main.obj.5936.16.jom
C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe -f Makefile.Debug
'cl' is not recognized as an internal or external command,
operable program or batch file.
jom: C:\Dev\Projects\Qt\test\Makefile.Debug [debug\main.obj] Error 1
jom 1.0.8 - empower your cores
jom: C:\Dev\Projects\Qt\test\Makefile [debug] Error 2
13:39:36: The process "C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe" exited with code 2.
Error while building project test (target: Desktop)
When executing build step 'Make'
I've tried running the Qt 4.8.1 for Desktop (MSVC 2008) batch script before starting Qt Creator and checking the Projects > Build Settings > Build Environment > Using System Environment > Clear System Environment without success.
My PATH variable after installing Qt SDK 1.2.1:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\jEdit;C:\Program Files\TortoiseSVN\bin;C:\Program Files\doxygen\bin;C:\Program Files\NVIDIA Corporation\Cg\bin;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\WINDOWS\system32\WindowsPowerShell\v1.0
My computer is running Windows XP Professional (Service Pack 2). The version of Qt Creator that ships with Qt SDK 1.2.1 is 2.4.1.
Looks like cl is either not installed on your system, or needs to be added to the PATH environment variable. Try to find the cl.exe binary somewhere in C:\Program Files\Microsoft Visual Studio [version]\ and add the directory that contains that binary to your PATH.

How do you compile OpenSSL for 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.
To compile the static libraries (both release and debug), this is what you need to do:
Install Perl - www.activestate.com
Run the "Visual Studio 2008 x64 Cross Tools Command Prompt" (Note: The regular command prompt WILL NOT WORK.)
Configure with
perl Configure VC-WIN64A no-shared no-idea
Run: ms\do_win64a
EDIT ms\nt.mak and change "32" to "64" in the output dirs:
# The output directory for everything intersting
OUT_D=out64.dbg
# The output directory for all the temporary muck
TMP_D=tmp64.dbg
# The output directory for the header files
INC_D=inc64
INCO_D=inc64\openssl
EDIT ms\nt.mak and remove bufferoverflowu.lib from EX_LIBS if you get an error about it.
Run: nmake -f ms\nt.mak
EDIT the ms\do_win64a file and ADD "debug" to all lines, except the "ml64" and the last two lines
Run: ms\do_win64a
Repeat steps 4 and 5
EDIT the ms\nt.mak file and ADD /Zi to the CFLAG list!
Run: nmake -f ms\nt.mak
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.
if ($debug)
{
$ssl .= 'd';
$crypto .= 'd';
}
Add this block to util/pl/VC-32.pl, just before the if ($debug) line.
if ($FLAVOR =~ /WIN64/)
{
$out_def =~ s/32/64/;
$tmp_def =~ s/32/64/;
$inc_def =~ s/32/64/;
}
Then build all varieties:
setenv /x86 /release
perl Configure VC-WIN32 --prefix=build -DUNICODE -D_UNICODE
ms\do_ms
nmake -f ms\ntdll.mak
setenv /x64 /release
perl Configure VC-WIN64A --prefix=build
ms\do_win64a.bat
nmake -f ms\ntdll.mak
setenv /x86 /debug
perl Configure debug-VC-WIN32 --prefix=build -DUNICODE -D_UNICODE
ms\do_ms
move /y ms\libeay32.def ms\libeay32d.def
move /y ms\ssleay32.def ms\ssleay32d.def
nmake -f ms\ntdll.mak
setenv /x64 /debug
perl Configure debug-VC-WIN64A --prefix=build
ms\do_win64a.bat
move /y ms\libeay32.def ms\libeay32d.def
move /y ms\ssleay32.def ms\ssleay32d.def
nmake -f ms\ntdll.mak
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" ...
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
At the time of writing this how-to the most recent version of OpenSSL is 1.1.1a.
Environment:
Windows 10
MS Visual Studio 2017
Prerequisites:
Install ActivePerl - Community edition is fine
Install NASM
Make sure both Perl and NASM are in PATH environment variable.
Compiling x64:
Open x64 Native Tools Command Prompt
perl Configure VC-WIN64A --prefix=e:\projects\bin\OpenSSL\vc-win64a --openssldir=e:\projects\bin\OpenSSL\SSL
nmake
nmake test
nmake install
Step 4 is optional.
Compiling x86:
Open x86 Native Tools Command Prompt
perl Configure VC-WIN32 --prefix=e:\projects\bin\OpenSSL\vc-win32 --openssldir=e:\projects\bin\OpenSSL\SSL
nmake
nmake test
nmake install
Step 4 is optional.
If you're building in cygwin, you can use the following script, assume MSDEVPATH has already been set to your Visual Studio dir
echo "Building x64 OpenSSL"
# save the path of the x86 msdev
MSDEVPATH_x86=$MSDEVPATH
# and set a new var with x64 one
MSDEVPATH_x64=`cygpath -u $MSDEVPATH/bin/x86_amd64`
# now set vars with the several lib path for x64 in windows mode
LIBPATH_AMD64=`cygpath -w $MSDEVPATH_x86/lib/amd64`
LIBPATH_PLATFORM_x64=`cygpath -w $MSDEVPATH_x86/PlatformSDK/lib/x64`
# and set the LIB env var that link looks at
export LIB="$LIBPATH_AMD64;$LIBPATH_PLATFORM_x64"
# the new path for nmake to look for cl, x64 at the start to override any other msdev that was set previously
export PATH=$MSDEVPATH_x64:$PATH
./Configure VC-WIN64A zlib-dynamic --prefix=$OUT --with-zlib-include=zlib-$ZLIB_VERSION/include --with-zlib-lib=zlib-$ZLIB_VERSION/x64_lib
# do the deed
ms/do_win64a.bat
$MSDEVPATH_x86/bin/nmake -f ms/ntdll.mak ${1:-install}
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.
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/