1

Basically this should be quite simple, but for some magic reason result library is Win32 not x64.

During investigation I've found that first step Configure is failing:

perl Configure VC-WIN64A no-asm enable-static-engine --prefix=x64\Release

This prints (full copy paste):

Configuring for VC-WIN64A
    no-asm          [option]   OPENSSL_NO_ASM
    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=1
CC            =cl
CFLAG         =-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
EX_LIBS       =
CPUID_OBJ     =mem_clr.o
BN_ASM        =bn_asm.o
EC_ASM        =
DES_ENC       =des_enc.o fcrypt_b.o
AES_ENC       =aes_core.o aes_cbc.o
BF_ENC        =bf_enc.o
CAST_ENC      =c_enc.o
RC4_ENC       =rc4_enc.o rc4_skey.o
RC5_ENC       =rc5_enc.o
MD5_OBJ_ASM   =
SHA1_OBJ_ASM  =
RMD160_OBJ_ASM=
CMLL_ENC      =camellia.o cmll_misc.o cmll_cbc.o
MODES_OBJ     =
ENGINES_OBJ   =
PROCESSOR     =
RANLIB        =true
ARFLAGS       =
PERL          =perl
SIXTY_FOUR_BIT mode
DES_INT used
RC4_CHUNK is unsigned long long

Configured for VC-WIN64A.

Note that CFLAG contains options for Win32. This is quite unusual and I have no idea what is wrong and how do I approach this problem.

My build script more or less looks like this (initially it was building for Win32 I do modification to support x64):

REM setup some variables
call commonSetup.cmd

set PREFIX=x64\Release
set PLATFORM=VC-WIN64A
set MS_CONF=do_win64a
set EXT=

pushd %THIRD_PARTY_DIR_BASE%\openssl

echo PREFIX=%PREFIX% PLATFORM=%PLATFORM% MS_CONF=%MS_CONF% EXT=%EXT%

perl Configure %PLATFORM% no-asm enable-static-engine --prefix=%PREFIX%

call ms\%MS_CONF%

perl -i.bak -pe "s/([-\/])Zi /\1Z7 /g" ms/nt.mak

mkdir inc32\openssl
nmake -f ms\nt.mak

REM jom -f ms\nt.mak AS=ml64 -j %PROCN%
nmake -f ms\nt.mak install

rmdir /s/q inc32
rmdir /s/q out32%EXT%
rmdir /s/q tmp32%EXT%

Any help will be appreciated.

OpenSSL version: 1.0.2p 14 Aug 2018

I do not have this problem when building other dependencies of my project to x64 platform.

I've found this question with exactly same issue, but answers there do not match my problem. My VS tools are configured properly (VS2017). I have to use VS and I have no problems to use it (nmake works).

Marek R
  • 32,568
  • 6
  • 55
  • 140
  • 1
    Do you actually get a 32-bit library if you go forward with the build? Although I see "WIN32" in the names of some of the defined symbols in the C flags, I don't think any of those control the target architecture for which the library will be built. – John Bollinger Feb 14 '19 at 17:11
  • yes. I'm checking what is the outcome with `dumpbin /headers %LIB_TO_CHECK% | find machine` – Marek R Feb 14 '19 at 17:20
  • @JohnBollinger thanks for the help. This given me a hint I can try search problem in other step. – Marek R Feb 14 '19 at 17:47

1 Answers1

0

Ok finally I've got the solution.
I've found in other SO ansear.

Basicly nmake must be reconfigured to build for x64 (openSSL Configure was not the problem) using this:

VsDevCmd.bat -host_arch=amd64 -arch=amd64

After earlier attempts nmake -f ms\nt.mak clean had to be invoked so above could take effect.

Marek R
  • 32,568
  • 6
  • 55
  • 140