build openssl on win64 fail

断了今生、忘了曾经 提交于 2019-12-11 08:26:30

问题


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


回答1:


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 (...).




回答2:


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.



来源:https://stackoverflow.com/questions/43656019/build-openssl-on-win64-fail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!