build openssl on win64 fail - c++

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.

Related

How do I compile fips capable openssl on Windows x64?

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

Setting CUDA_NVCC_FLAGS using CMake

I am trying to compile a CUDA project using CMake on Windows. I am not familiar with make or CMake and I have done some reading over the past few days, but I am still not able to figure this out. I get the following error message:
Chri#Riemann-PC /cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/build64
$ make
[ 1%] Built target lapacktest
[ 1%] Building NVCC (Device) object CMakeFiles/magma.dir/magmablas/magma_generated_zherk_batched_core.cu.o
nvcc fatal : nvcc cannot find a supported version of Microsoft Visual Studio. Only the versions 2010, 2012, and 2013 are supported
CMake Error at magma_generated_zherk_batched_core.cu.o.cmake:207 (message):
Error generating
/cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/build64/CMakeFiles/magma.dir/magmablas/./magma_generated_zherk_batched_core.cu.o
CMakeFiles/magma.dir/build.make:2058: recipe for target 'CMakeFiles/magma.dir/magmablas/magma_generated_zherk_batched_core.cu.o' failed
make[2]: *** [CMakeFiles/magma.dir/magmablas/magma_generated_zherk_batched_core.cu.o] Error 1
CMakeFiles/Makefile2:105: recipe for target 'CMakeFiles/magma.dir/all' failed
make[1]: *** [CMakeFiles/magma.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Using the make VERBOSE=1 command, I get the following error:
cd /cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/build64/CMakeFiles/magma.dir/magmablas && /usr/bin/cmake.exe -D verbose:BOOL=1 -D build_configuration:STRING= -D generated_file:STRING=/cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/build64/CMakeFiles/magma.dir/magmablas/./magma_generated_zherk_batched_core.cu.o -D generated_cubin_file:STRING=/cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/build64/CMakeFiles/magma.dir/magmablas/./magma_generated_zherk_batched_core.cu.o.cubin.txt -P /cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/build64/CMakeFiles/magma.dir/magmablas/magma_generated_zherk_batched_core.cu.o.cmake
-- Removing /cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/build64/CMakeFiles/magma.dir/magmablas/./magma_generated_zherk_batched_core.cu.o
/usr/bin/cmake.exe -E remove /cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/build64/CMakeFiles/magma.dir/magmablas/./magma_generated_zherk_batched_core.cu.o
-- Generating dependency file: /cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/build64/CMakeFiles/magma.dir/magmablas/magma_generated_zherk_batched_core.cu.o.NVCC-depend
"/cygdrive/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/bin/nvcc.exe" -M -D__CUDACC__ /cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/magmablas/zherk_batched_core.cu -o /cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/build64/CMakeFiles/magma.dir/magmablas/magma_generated_zherk_batched_core.cu.o.NVCC-depend -ccbin /usr/bin/gcc.exe -m64 -Xcompiler ,\"-fopenmp\",\"-Wall\",\"-Wno-unused-function\",\"-g\" -DHAVE_CUBLAS -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_35,code=compute_35 -DNVCC "-I/cygdrive/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/include" "-I/cygdrive/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/include" -I/cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/include -I/cygdrive/c/Apps/ThirdParty/MAGMA/magma-2.0.1/control
nvcc fatal : nvcc cannot find a supported version of Microsoft Visual Studio. Only the versions 2010, 2012, and 2013 are supported
It is still using the gcc compiler (-ccbin /usr/bin/gcc.exe).
I went into the file: C:\Apps\ThirdParty\cygwin64\usr\share\cmake-3.3.2\Modules\FindCUDA.cmake and added the following lines:
set(VS_DIR "C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\bin")
message(${VS_DIR})
set(CUDA_NVCC_FLAGS "-ccbin ${VS_DIR}" CACHE STRING "Semi-colon delimit multiple arguments.")
I also added the following line to the nvcc.profile file:
CUDA_NVCC_FLAGS += -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin";
Still no luck. I have spent a few days trying to fix this. I am grateful for any help in this matter.
The option to set the host compiler in FindCUDA is CUDA_HOST_COMPILER, see the FindCUDA documentation.
Try
set(CUDA_HOST_COMPILER "<path to compiler executable>")
or alternatively set it when invoking the cmake command
cmake .. -DCUDA_HOST_COMPILER=<path to compiler executable>
I guess the CUDA_HOST_COMPILER option overrides the ccbin settings of CUDA_NVCC_FLAGS. For other options you can use CUDA_NVCC_FLAGS in the way you tried. (Thus, the title is misleading. It is not a problem of how to set CUDA_NVCC_FLAGS.)
I use this often on Linux, however I don't have a Windows environment to test it there.

VS2013 compiling and linking tcl/tk 8.6.4 as a shared library

This question is kind of related to my earlier question of compiling and linking ngspice.
ngspice depends on tcl/tk so I have to build it.
I managed to build tcl in release configuration but everything else is failing.
I created a batch based on the information given on this website.
#ECHO OFF
set "vcvars32_bat=C:\LegacyApp\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
REM SET VARIABLES
call "%vcvars32_bat%"
set "TCLDIR=..\..\tcl8.6.4"
echo Building tcl Release 32
cd tcl8.6.4\win\
nmake -f makefile.vc > ..\..\tcl_Release32.log 2>&1
cd ..\..\
echo Building tk Release 32
cd tk8.6.4\win\
nmake -f makefile.vc > ..\..\tk_Release32.log 2>&1
cd ..\..\
echo Building tcl Debug 32
cd tcl8.6.4\win\
nmake -f makefile.vc OPTS=symbols > ..\..\tcl_Debug32.log 2>&1
cd ..\..\
echo Building tk Debug 32
cd tk8.6.4\win\
nmake -f makefile.vc OPTS=symbols > ..\..\tk_Debug32.log 2>&1
cd ..\..\
pause
exit 0
I added a bunch of messages to the makefiles so I can see whats going on.
makefile.vc depends on rules.vc. Somehow a custom "make helper" is also involved.
Here is some partial output:
Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
makefile.vc
rules.vc
vercl.x
===============================================================================
*** Compiler has 'Optimizations'
*** Compiler does not have 'Pentium 0x0f fix'
*** Linker does not have 'Win98 alignment problem'
*** Doing symbols
*** Intermediate directory will be '.\Debug_VC12\tcl_ThreadedDynamic'
*** Output directory will be '.\Debug_VC12'
*** Suffix for binaries will be 'tg'
*** Optional defines are '-DTCL_CFGVAL_ENCODING=\"cp1252\" -DSTDC_HEADERS -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1'
*** Compiler version 12. Target machine is IX86
*** Host architecture is AMD64
*** Compiler options '-W3 -DUNICODE -D_UNICODE -Ot -Oi -fp:strict -Gs -GS -GL -RTC1 -W3'
*** Link options '-ltcg'
cdebug = -Zi -WX -RTC1
ldebug = -debug -debugtype:cv
lflags = -nologo -machine:IX86 -ltcg -debug -debugtype:cv
dlllflags = -nologo -machine:IX86 -ltcg -debug -debugtype:cv -dll
conlflags = -nologo -machine:IX86 -ltcg -debug -debugtype:cv -subsystem:console
guilflags = -nologo -machine:IX86 -ltcg -debug -debugtype:cv -subsystem:windows
*** Dependency rules are not being used.
Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
===============================================================================
*** Compiler has 'Optimizations'
*** Compiler does not have 'Pentium 0x0f fix'
*** Linker does not have 'Win98 alignment problem'
*** Doing symbols
*** Intermediate directory will be '.\Debug_VC12\itcl_ThreadedDynamic'
*** Output directory will be '.\Debug_VC12'
*** Suffix for binaries will be 'tg'
*** Optional defines are '-DTCL_CFGVAL_ENCODING=\"cp1252\" -DSTDC_HEADERS -DTCL_THREADS=1'
*** Compiler version 12. Target machine is IX86
*** Host architecture is AMD64
*** Compiler options ' -Ot -Oi -fp:strict -Gs -GS -GL -RTC1 -W3'
*** Link options '-ltcg'
link -nologo -machine:IX86 -ltcg -debug:full -debugtype:cv -subsystem:windows -dll -base:#D:\Include\CPP\TCLTK\tcl8.6.4\win\..\win\coffbase.txt,itcl -out:".\Debug_VC12\itcl40tg.dll" "D:\Include\CPP\TCLTK\tcl8.6.4\win\..\win\Debug_VC12\tclstub86.lib" #C:\Users\HIRSCH~1\AppData\Local\Temp\nm8789.tmp
LINK : fatal error LNK1117: syntax error in option 'debug:full'
NMAKE : fatal error U1077: '"C:\LegacyApp\Microsoft Visual Studio 12.0\VC\BIN\link.EXE"' : return code '0x45d'
Stop.
Note that nmake is called a second time with different options and I don't know why or from where.
Is there a known solution to the issues that I am experiencing?
EDIT:
I am still on it. 'nmakehlp.exe' seems harmless. I edited a tracelog into it and the tool uses system calls to identify if compiler or linker options are valid. If I use it to see if the linker option '-debug:full' is valid it correctly identifies the error. I still am clueless when it comes to the additional calls to nmake. a textsearch on all files did not reveal where '-debug:full' or its fragments come from.
Version 8.5.18 does not have that issue so I just build that now instead of 8.6.4.
I use this batch to help with building.
#echo off
set "vcvars32_bat=D:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
set "VERSION=8.5.18"
set "TCL=tcl%VERSION%"
set "TK=tk%VERSION%"
set "TCLDIR=..\..\%TCL%"
echo %time% > Build.log
echo "%vcvars32_bat%" >> Build.log
call "%vcvars32_bat%" >> Build.log 2>&1
echo %time% >> Build.log
call:JMP_Build32 %TCL% symbols TCLDebug32.log
call:JMP_Build32 %TCL% "" TCLRelease32.log
call:JMP_Build32 %TK% symbols TKDebug32.log
call:JMP_Build32 %TK% "" TKRelease32.log
exit 0
:JMP_Build32
echo Building '%1' '%2' '%3'
cd %1\win\
echo %time%> ..\..\%3
del nmakehlp.exe >> ..\..\%3 2>&1
nmake -f makefile.vc OPTS=%2 >> ..\..\%3 2>&1
echo %time%>> ..\..\%3
cd ..\..\
goto:eof
The call to nmake -f makefile.vc results in subsequent calls to other makefile.vc files in sister directories. If you face similar issues you should include those in your search.

How to build mysql driver for qt?

I read a lot of instructions and tutorials how to do that, and I tried many of that, but 6 hours have gone and it's all the same. Please help...
I know, there are some similar questions on stackoverflow but answers on them doesn't help.
Problem:
I want to build Mysql driver for my qt program. According to instructions I did:
1) set mysql=C:\PROGRA~1\MySQL\MYSQLS~1.6 (full path is C:\Program Files\MySQL\MySQL Server 5.6)
2)
cd C:\Qt_Sources\5.2.1\Src\qtbase\src\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmysql.lib" mysql.pro
mingw32-make
mingw32-make from (C:\MinGW\bin)
After this I got:
mingw32-make -f Makefile.Release all
mingw32-make[1]: Entering directory 'C:/Qt_Sources/5.2.1/Src/qtbase/src/plugins/
sqldrivers/mysql'
Makefile.Release:65: *** missing separator. Stop.
mingw32-make[1]: Leaving directory 'C:/Qt_Sources/5.2.1/Src/qtbase/src/plugins/s
qldrivers/mysql'
Makefile:40: recipe for target 'release-all' failed
mingw32-make: *** [release-all] Error 2
Also I tried nmake from (C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin) and result is:
Microsoft (R) Program Maintenance Utility Version 11.00.50727.1
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\nmake.exe" -
f Makefile.Release all
Microsoft (R) Program Maintenance Utility Version 11.00.50727.1
Copyright (C) Microsoft Corporation. All rights reserved.
cl -c -nologo -Zm200 -Zc:wchar_t -O2 -MD -GR -W3 -w34100 -w34189 -DUNICO
DE -DWIN32 -DQT_EDITION=QT_EDITION_DESKTOP -DQT_EVAL -DQT_NO_CAST_TO_ASCII -DQT_
NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQ
T_CORE_LIB -DNDEBUG -I"%mysql%\include" -I"C:\Qt\5.2.1\msvc2012\include\QtSql\5.
2.1" -I"C:\Qt\5.2.1\msvc2012\include\QtSql\5.2.1\QtSql" -I"C:\Qt\5.2.1\msvc2012\
include" -I"C:\Qt\5.2.1\msvc2012\include\QtSql" -I"C:\Qt\5.2.1\msvc2012\include\
QtCore\5.2.1" -I"C:\Qt\5.2.1\msvc2012\include\QtCore\5.2.1\QtCore" -I"C:\Qt\5.2.
1\msvc2012\include\QtCore" -I".moc\release" -I"..\..\..\..\mkspecs\win32-msvc201
2" -Fo.obj\release\ #C:\Users\GOODSP~1\AppData\Local\Temp\nmD5C6.tmp
NMAKE : fatal error U1077: 'cl' : return code '0xc0000135'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
\VC\bin\nmake.exe"' : return code '0x2'
Stop.
Please explain what I did wrong...
Yes, I finally resolve this issue...
I used qmake for another qt version, for me I think I used qmake from msvc2012, and tried to make it by mingw32-make and nmake (but nmake from visual studio 2011.. maybe this is the problem).
And solution is:
Use qmake from mingw48_32 directory (for me it's: C:\Qt\5.2.1\mingw48_32. Install qt sources with mingw, if you don't have it). After that all works fine with mingw32-make.

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!