Openssl: 1.1.0g-stable VC-WIN64A X86 conflicts with target x64

Created on 9 Oct 2017  路  2Comments  路  Source: openssl/openssl

Seeing a lot about this issue via google searches but none of the solutions I've found fix the issue. Everything I've seen pretty much just focuses on making sure you do the configure and the build in a 64-bit VS command prompt - which I am doing. The other solutions I've found appear to be for older versions of openssl.

I'm attempting to build the 1.1.0g-stable branch with VS2015 on a _Windows 10 Enterprise_ machine. Doesn't matter whether I use a _Developer Command Prompt_ or the _x64 x86 Cross Tools Command Prompt_, result is the same either way.

New Clone:

C:\Program Files (x86)\Microsoft Visual Studio 14.0>cd C:\development\git

C:\development\git>git clone https://github.com/openssl/openssl.git
Cloning into 'openssl'...
remote: Counting objects: 280856, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 280856 (delta 5), reused 7 (delta 2), pack-reused 280838
Receiving objects: 100% (280856/280856), 128.67 MiB | 26.55 MiB/s, done.
Resolving deltas: 100% (197365/197365), done.
Checking connectivity... done.
Checking out files: 100% (19174/19174), done.

C:\development\git>cd openssl

C:\development\git\openssl>git checkout OpenSSL_1_1_0-stable
Checking out files: 100% (22621/22621), done.
Branch OpenSSL_1_1_0-stable set up to track remote branch OpenSSL_1_1_0-stable from origin.
Switched to a new branch 'OpenSSL_1_1_0-stable'

Configure:

C:\development\git\openssl>perl Configure VC-WIN64A --prefix=C:\development\git\openssl\build --openssldir=C:\development\git\openssl\build\SSL
Configuring OpenSSL version 1.1.0g-dev (0x10100070L)
    no-asan         [default]  OPENSSL_NO_ASAN
    no-crypto-mdebug [default]  OPENSSL_NO_CRYPTO_MDEBUG
    no-crypto-mdebug-backtrace [default]  OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128
    no-egd          [default]  OPENSSL_NO_EGD
    no-fuzz-afl     [default]  OPENSSL_NO_FUZZ_AFL
    no-fuzz-libfuzzer [default]  OPENSSL_NO_FUZZ_LIBFUZZER
    no-heartbeats   [default]  OPENSSL_NO_HEARTBEATS
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)
    no-msan         [default]  OPENSSL_NO_MSAN
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)
    no-sctp         [default]  OPENSSL_NO_SCTP
    no-ssl-trace    [default]  OPENSSL_NO_SSL_TRACE
    no-ssl3         [default]  OPENSSL_NO_SSL3
    no-ssl3-method  [default]  OPENSSL_NO_SSL3_METHOD
    no-ubsan        [default]  OPENSSL_NO_UBSAN
    no-unit-test    [default]  OPENSSL_NO_UNIT_TEST
    no-weak-ssl-ciphers [default]  OPENSSL_NO_WEAK_SSL_CIPHERS
    no-zlib         [default]
    no-zlib-dynamic [default]
Configuring for VC-WIN64A
CC            =cl
CFLAG         =-W3 -wd4090 -Gs0 -GF -Gy -nologo -DOPENSSL_SYS_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DUNICODE -D_UNICODE /MD /O2
SHARED_CFLAG  =
DEFINES       =OPENSSL_USE_APPLINK DSO_WIN32 NDEBUG OPENSSL_THREADS OPENSSL_NO_STATIC_ENGINE OPENSSL_PIC OPENSSL_IA32_SSE2 OPENSSL_BN_ASM_MONT OPENSSL_BN_ASM_MONT5 OPENSSL_BN_ASM_GF2m SHA1_ASM SHA256_ASM SHA512_ASM RC4_ASM MD5_ASM AES_ASM VPAES_ASM BSAES_ASM GHASH_ASM ECP_NISTZ256_ASM PADLOCK_ASM POLY1305_ASM
LFLAG         =/nologo /debug
PLIB_LFLAG    =
EX_LIBS       =ws2_32.lib gdi32.lib advapi32.lib crypt32.lib user32.lib
APPS_OBJ      =win32_init.o ../ms/applink.o
CPUID_OBJ     =x86_64cpuid.o
UPLINK_OBJ    =../ms/uplink.o uplink-x86_64.o
BN_ASM        =bn_asm.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o
EC_ASM        =ecp_nistz256.o ecp_nistz256-x86_64.o
DES_ENC       =des_enc.o fcrypt_b.o
AES_ENC       =aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o
BF_ENC        =bf_enc.o
CAST_ENC      =c_enc.o
RC4_ENC       =rc4-x86_64.o rc4-md5-x86_64.o
RC5_ENC       =rc5_enc.o
MD5_OBJ_ASM   =md5-x86_64.o
SHA1_OBJ_ASM  =sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o
RMD160_OBJ_ASM=
CMLL_ENC      =cmll-x86_64.o cmll_misc.o
MODES_OBJ     =ghash-x86_64.o aesni-gcm-x86_64.o
PADLOCK_OBJ   =e_padlock-x86_64.o
CHACHA_ENC    =chacha-x86_64.o
POLY1305_OBJ  =poly1305-x86_64.o
BLAKE2_OBJ    =
PROCESSOR     =
RANLIB        =true
ARFLAGS       =/nologo
PERL          =C:\Strawberry\perl\bin\perl.exe

SIXTY_FOUR_BIT mode

Configured for VC-WIN64A.

Says it's configured for 64-bit

Compile:

C:\development\git\openssl>nmake

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        "C:\Strawberry\perl\bin\perl.exe" "-I." -Mconfigdata "util\dofile.pl"  "-omakefile" "crypto\include\internal\bn_conf.h.in" > crypto\include\internal\bn_conf.h
        "C:\Strawberry\perl\bin\perl.exe" "-I." -Mconfigdata "util\dofile.pl"  "-omakefile" "crypto\include\internal\dso_conf.h.in" > crypto\include\internal\dso_conf.h
        "C:\Strawberry\perl\bin\perl.exe" "-I." -Mconfigdata "util\dofile.pl"  "-omakefile" "include\openssl\opensslconf.h.in" > include\openssl\opensslconf.h
        "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" depend && "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" _all

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        set ASM=nasm
        "C:\Strawberry\perl\bin\perl.exe" "crypto\aes\asm\aes-x86_64.pl" "auto" crypto\aes\aes-x86_64.asm
        nasm -f win64 -DNEAR -Ox -g -ocrypto\aes\aes-x86_64.obj "crypto\aes\aes-x86_64.asm"
        cl  /I "." /I "crypto\include" /I "include" -DOPENSSL_USE_APPLINK -DDSO_WIN32 -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPADLOCK_ASM -DPOLY1305_ASM "-DENGINESDIR=\"C:\\development\\git\\openssl\\build\\lib\\engines-1_1\"" "-DOPENSSLDIR=\"C:\\development\\git\\openssl\\build\\SSL\"" -W3 -wd4090 -Gs0 -GF -Gy -nologo -DOPENSSL_SYS_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DUNICODE -D_UNICODE /MD /O2 /Zi /Fdossl_static -c /Focrypto\aes\aes_cfb.obj "crypto\aes\aes_cfb.c"
aes_cfb.c

...

        cl  /I "." /I "crypto\include" /I "include" -DOPENSSL_USE_APPLINK -DDSO_WIN32 -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPADLOCK_ASM -DPOLY1305_ASM "-DENGINESDIR=\"C:\\development\\git\\openssl\\build\\lib\\engines-1_1\"" "-DOPENSSLDIR=\"C:\\development\\git\\openssl\\build\\SSL\"" -W3 -wd4090 -Gs0 -GF -Gy -nologo -DOPENSSL_SYS_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DUNICODE -D_UNICODE /MD /O2 /Zi /Fdossl_static -c /Focrypto\dllmain.obj "crypto\dllmain.c"
dllmain.c
        "C:\Strawberry\perl\bin\perl.exe" "util\mkdef.pl" "crypto" 32 > libcrypto-1_1-x64.def
        "C:\Strawberry\perl\bin\perl.exe" -i.tmp -pe "s|^LIBRARY\s+crypto32|LIBRARY libcrypto-1_1-x64|;" libcrypto-1_1-x64.def
        DEL libcrypto-1_1-x64.def.tmp
        "C:\Strawberry\perl\bin\perl.exe" "util\mkrc.pl" libcrypto-1_1-x64.dll > libcrypto-1_1-x64.rc
        rc /folibcrypto-1_1-x64.res libcrypto-1_1-x64.rc
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation.  All rights reserved.

        IF EXIST libcrypto-1_1-x64.dll.manifest DEL /F /Q libcrypto-1_1-x64.dll.manifest
        link /nologo /debug /dll  /implib:libcrypto.lib /out:libcrypto-1_1-x64.dll /def:libcrypto-1_1-x64.def @C:\Users\SHAWN~1.CHI\AppData\Local\Temp\nmA18B.tmp || (DEL /Q libcrypto.* libcrypto-1_1-x64.* && EXIT 1)
crypto\aes\aes_cfb.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
NMAKE : fatal error U1077: 'link' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.

The wiki appears to be out of date, or at least not the correct wiki for 1.1.0g. Because is says you should run ms/do_win64a after the configure step, but there isn't a do_win64a script in the ms directory in the 1.1.0g branch.

Most helpful comment

Thanks for the info @dot-asm

cl.exe was indeed x86. So I did a search for another VS command prompt option and there is one named _x64 Native Tools Command Prompt_ and that one works. So, of the 3 command prompt options VS sets up I had tried the 2 incorrect ones. Go me!

All 2 comments

It's pretty straightforward. Run cl [with no arguments] and look at version line. It ends with either "for x86" or "for x64". If you want to build VC-WIN64A, it has to read "for x64". It's very natural requirement. If you want to generate 64-bit code you have to use compiler that generates 64-bit code. Note that compiler itself doesn't have to be 64-bit binary, but it has to generate 64-bit code. How exactly do you get prompt with cl generating code for x64 is between you and Microsoft. They seem to change it all the time and appear to be doing pretty good job confusing users with all those cross and native options, one can't keep up...

Thanks for the info @dot-asm

cl.exe was indeed x86. So I did a search for another VS command prompt option and there is one named _x64 Native Tools Command Prompt_ and that one works. So, of the 3 command prompt options VS sets up I had tried the 2 incorrect ones. Go me!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hymie0 picture hymie0  路  4Comments

372979131 picture 372979131  路  3Comments

enriquejcobo picture enriquejcobo  路  3Comments

shrimpwagon picture shrimpwagon  路  3Comments

vishal307 picture vishal307  路  3Comments