Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OpenSSL 1.0.1k fails to compile on Windows x86 with Visual Studio 2013

118 views
Skip to first unread message

Martin Knafve

unread,
Jan 8, 2015, 12:19:07 PM1/8/15
to
I am unable to compile OpenSSL 1.0.1k on Windows. I posted this to openssl-users, but I'm not sure if that mailing list is being monitored by OpenSSL devs and this is an urgent issue to me. I'm sorry if I'm not following the mailing list guide lines.

The original post:

I've been using the following script to compile OpenSSL previously:

Perl Configure no-asm VC-WIN32
ms\do_ms
nmake -f ms\ntdll.mak

This script has been working fine with previous version of OpenSSL. I just confirmed it compiles with 1.0.1i and 1.0.1j without errors.

When using the same script to compile 1.0.1k, I get the following compilation error when I run nmake -f ms\ntdll.mak:

cl /Fotmp32dll\cversion.obj -Iinc32 -Itmp32dll /MD /Ox /O2 /Ob2 -DOPENSSL_THREADS -DDSO_WIN32 -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_
NO_DEPRECATE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGINE /Zi /Fdtmp32dll/lib -D_WINDLL -DOPENSSL_BUILD_SHLIBCRYPTO -DMK
1MF_BUILD -DMK1MF_PLATFORM_VC_WIN32 -c .\crypto\cversion.c
cversion.c
.\crypto\cversion.c(80) : error C2065: 'cflags' : undeclared identifier
.\crypto\cversion.c(80) : warning C4047: 'return' : 'const char *' differs in levels of indirection from 'int'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\cl.EXE"' : return code '0x2'

I have reproduced the same compilation error on two separate machines (one with Windows 8.1 and one with Windows Server 2012 R2).

The Perl Configure command gives me the following output:

Configuring for VC-WIN32
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-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-store [experimental] OPENSSL_NO_STORE (skip dir)
no-unit-test [default] OPENSSL_NO_UNIT_TEST (skip dir)
no-zlib [default]
no-zlib-dynamic [default]
IsMK1MF=1
CC =cl
CFLAG =-DOPENSSL_THREADS -DDSO_WIN32 -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE
EX_LIBS =
CPUID_OBJ =mem_clr.o
BN_ASM =bn_asm.o
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
THIRTY_TWO_BIT mode
BN_LLONG mode
RC4_INDEX mode
RC4_CHUNK is undefined

I'm using Visual Studio 2013 Premium Edition Update 4.

In cversion.c line 80, I replaced "cflags" with CFLAGS and now it compiles. This seems consistent with the other code in this file, but I have no clue whether its a proper fix and I don't dare actually patching my version of OpenSSL without knowing what I'm doing.

This line was changed just 20 days ago by Matt Caswell. Prior to that, it was:

static char buf[sizeof(CFLAGS)+11];
BIO_snprintf(buf,sizeof buf,"compiler: %s",CFLAGS);
return(buf);

It would seem like this is a general issue though and I doubt I'm the only one affected by this.

Regards,
Martin Knafve

mpie...@gmail.com

unread,
Jan 8, 2015, 12:29:40 PM1/8/15
to
I just ran into this as well... I made the same edit as you did and succeeded as well.

Martin Knafve

unread,
Jan 8, 2015, 2:05:44 PM1/8/15
to
Den torsdagen den 8:e januari 2015 kl. 18:29:40 UTC+1 skrev mpie...@gmail.com:
> On Thursday, January 8, 2015 12:19:07 PM UTC-5, Martin Knafve wrote:
> > I am unable to compile OpenSSL 1.0.1k on Windows. I posted this to openssl-users, but I'm not sure if that mailing list is being monitored by OpenSSL devs and this is an urgent issue to me. I'm sorry if I'm not following the mailing list guide lines.
> >
> > The original post:
> >
> > I've been using the following script to compile OpenSSL previously:
> >
> > Perl Configure no-asm VC-WIN32
> > ms\do_ms
> > nmake -f ms\ntdll.mak
> >
> > This script has been working fine with previous version of OpenSSL. I just confirmed it compiles with 1.0.1i and 1.0.1j without errors.
> >
> > When using the same script to compile 1.0.1k, I get the following compilation error when I run nmake -f ms\ntdll.mak:
> >
> > cl /Fotmp32dll\cversion.obj -Iinc32 -Itmp32dll /MD /Ox /O2 /Ob2 -DOPENSSL_THREADS -DDSO_WIN32 -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_
> > NO_DEPRECATE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGINE /Zi /Fdtmp32dll/lib -D_WINDLL -DOPENSSL_BUILD_SHLIBCRYPTO -DMK
> > 1MF_BUILD -DMK1MF_PLATFORM_VC_WIN32 -c .\crypto\cversion.c
> > cversion.c
> > .\crypto\cversion.c(80) : error C2065: 'cflags' : undeclared identifier
> > .\crypto\cversion.c(80) : warning C4047: 'return' : 'const char *' differs in levels of indirection from 'int'
> > NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\cl.EXE"' : return code '0x2'
> >
> >
>
> I just ran into this as well... I made the same edit as you did and succeeded as well.

The fix is actually incorrect. The function should return something like "compiler: CFLAGS".

Martin

mpie...@gmail.com

unread,
Jan 8, 2015, 4:33:24 PM1/8/15
to
It's not clear to me what the intention is... if you look in buildinf.h you'll see PLATFORM and DATE are not prepended with "platform: " or "built on: " either, but OPENSSLDIR is... so... return "compiler: " CFLAGS; could take advantage of the pre-processor and concatenate the strings if that's the desire, but then presumably the others should be done as well.
0 new messages