New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.1k crypto/cversion.c doesn't compile if CFLAGS is defined #209

Closed
mpdaly opened this Issue Jan 8, 2015 · 7 comments

Comments

Projects
None yet
4 participants
@mpdaly

mpdaly commented Jan 8, 2015

cl /Fotmp32\cversion.obj  -Iinc32 -Itmp32 /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_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SSL3 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_DYNAMIC_ENGINE /Zl /Zi /Fdtmp32/lib -DMK1MF_BUILD -DMK1MF_PLATFORM_VC_WIN64A -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'

Changing line 80 to ...

return(CFLAGS);

... fixes it.

@mattcaswell

This comment has been minimized.

Show comment
Hide comment
@mattcaswell

mattcaswell Jan 8, 2015

Member

What platform are you on?
Is this a fresh copy of 1.0.1k or are you using an existing git repo?
The identifier cflags that it is failing with is defined in the file crypto/buildinf.h - which is a generated file. Does that file exist for you and what does it contain?

Member

mattcaswell commented Jan 8, 2015

What platform are you on?
Is this a fresh copy of 1.0.1k or are you using an existing git repo?
The identifier cflags that it is failing with is defined in the file crypto/buildinf.h - which is a generated file. Does that file exist for you and what does it contain?

@mpdaly

This comment has been minimized.

Show comment
Hide comment
@mpdaly

mpdaly Jan 8, 2015

Win64, with a fresh 1.0.1k

My buildinf.h is as follows:

#ifndef MK1MF_BUILD
  /* auto-generated by Configure for crypto/cversion.c:
   * for Unix builds, crypto/Makefile.ssl generates functional definitions;
   * Windows builds (and other mk1mf builds) compile cversion.c with
   * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
  #error "Windows builds (PLATFORM=VC-WIN64A) use mk1mf.pl-created Makefiles"
#endif
#ifdef MK1MF_PLATFORM_VC_WIN64A
  /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
  #define CFLAGS "cl  /MDd /Od -DDEBUG -D_DEBUG -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_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SSL3 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGINE    "
  #define PLATFORM "VC-WIN64A"
  #define DATE "Thu Jan  8 17:05:37 2015"
#endif

mpdaly commented Jan 8, 2015

Win64, with a fresh 1.0.1k

My buildinf.h is as follows:

#ifndef MK1MF_BUILD
  /* auto-generated by Configure for crypto/cversion.c:
   * for Unix builds, crypto/Makefile.ssl generates functional definitions;
   * Windows builds (and other mk1mf builds) compile cversion.c with
   * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
  #error "Windows builds (PLATFORM=VC-WIN64A) use mk1mf.pl-created Makefiles"
#endif
#ifdef MK1MF_PLATFORM_VC_WIN64A
  /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
  #define CFLAGS "cl  /MDd /Od -DDEBUG -D_DEBUG -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_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SSL3 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGINE    "
  #define PLATFORM "VC-WIN64A"
  #define DATE "Thu Jan  8 17:05:37 2015"
#endif
@mattcaswell

This comment has been minimized.

Show comment
Hide comment
@mattcaswell

mattcaswell Jan 8, 2015

Member

Can you confirm if the following change fixes it for you:

From 0fe653506d2974b57fde6301e1b72bb7017abd3e Mon Sep 17 00:00:00 2001
From: Matt Caswell <matt@openssl.org>
Date: Thu, 8 Jan 2015 18:01:29 +0000
Subject: [PATCH] Fix windows build

---
 crypto/cversion.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/crypto/cversion.c b/crypto/cversion.c
index 0336ada..21a2532 100644
--- a/crypto/cversion.c
+++ b/crypto/cversion.c
@@ -76,7 +76,9 @@ const char *SSLeay_version(int t)
        }
    if (t == SSLEAY_CFLAGS)
        {
-#ifdef CFLAGS
+#if defined(MK1MF_BUILD)
+       return(CFLAGS);
+#elif defined(CFLAGS)
        return(cflags);
 #else
        return("compiler: information not available");
-- 
2.1.0
Member

mattcaswell commented Jan 8, 2015

Can you confirm if the following change fixes it for you:

From 0fe653506d2974b57fde6301e1b72bb7017abd3e Mon Sep 17 00:00:00 2001
From: Matt Caswell <matt@openssl.org>
Date: Thu, 8 Jan 2015 18:01:29 +0000
Subject: [PATCH] Fix windows build

---
 crypto/cversion.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/crypto/cversion.c b/crypto/cversion.c
index 0336ada..21a2532 100644
--- a/crypto/cversion.c
+++ b/crypto/cversion.c
@@ -76,7 +76,9 @@ const char *SSLeay_version(int t)
        }
    if (t == SSLEAY_CFLAGS)
        {
-#ifdef CFLAGS
+#if defined(MK1MF_BUILD)
+       return(CFLAGS);
+#elif defined(CFLAGS)
        return(cflags);
 #else
        return("compiler: information not available");
-- 
2.1.0
@serin13

This comment has been minimized.

Show comment
Hide comment
@serin13

serin13 Jan 8, 2015

I see the same thing when trying to compile on Win64 with Visual Studio 2013. I'm compiling against the FIPS container.

Build steps (after compiling the latest FIPS container):

perl Configure VC-WIN64A fips --with-fipslibdir=C:\projects\openssl-fips-2.0.9-x64\out32dll

perl util\mkfiles.pl >MINFO

cmd /c "nasm -f win64 -v" >NUL: 2>&1
if %errorlevel% neq 0 goto ml64

perl ms\uplink-x86_64.pl nasm > ms\uptable.asm
nasm -f win64 -o ms\uptable.obj ms\uptable.asm
goto proceed

:ml64
perl ms\uplink-x86_64.pl masm > ms\uptable.asm
ml64 -c -Foms\uptable.obj ms\uptable.asm

:proceed
perl util\mk1mf.pl nasm debug dll VC-WIN64A >ms\d64dll.mak
perl util\mk1mf.pl nasm dll VC-WIN64A >ms\64dll.mak

perl util\mkdef.pl 32 libeay > ms\libeay32.def
perl util\mkdef.pl 32 ssleay > ms\ssleay32.def

@if errorlevel 1 goto end
nmake -f ms\64dll.mak

serin13 commented Jan 8, 2015

I see the same thing when trying to compile on Win64 with Visual Studio 2013. I'm compiling against the FIPS container.

Build steps (after compiling the latest FIPS container):

perl Configure VC-WIN64A fips --with-fipslibdir=C:\projects\openssl-fips-2.0.9-x64\out32dll

perl util\mkfiles.pl >MINFO

cmd /c "nasm -f win64 -v" >NUL: 2>&1
if %errorlevel% neq 0 goto ml64

perl ms\uplink-x86_64.pl nasm > ms\uptable.asm
nasm -f win64 -o ms\uptable.obj ms\uptable.asm
goto proceed

:ml64
perl ms\uplink-x86_64.pl masm > ms\uptable.asm
ml64 -c -Foms\uptable.obj ms\uptable.asm

:proceed
perl util\mk1mf.pl nasm debug dll VC-WIN64A >ms\d64dll.mak
perl util\mk1mf.pl nasm dll VC-WIN64A >ms\64dll.mak

perl util\mkdef.pl 32 libeay > ms\libeay32.def
perl util\mkdef.pl 32 ssleay > ms\ssleay32.def

@if errorlevel 1 goto end
nmake -f ms\64dll.mak

@mattcaswell

This comment has been minimized.

Show comment
Hide comment
@mattcaswell

mattcaswell Jan 8, 2015

Member

There is a fix for this issue in git. See commit 56cd740

Member

mattcaswell commented Jan 8, 2015

There is a fix for this issue in git. See commit 56cd740

@mpdaly

This comment has been minimized.

Show comment
Hide comment
@mpdaly

mpdaly Jan 8, 2015

Fix from git confirmed working here.

mpdaly commented Jan 8, 2015

Fix from git confirmed working here.

@mpdaly mpdaly closed this Jan 8, 2015

@winkelsdorf

This comment has been minimized.

Show comment
Hide comment
@winkelsdorf

winkelsdorf Jan 10, 2015

As a note: Issue and fix also apply to official 1.0.0p release

winkelsdorf commented Jan 10, 2015

As a note: Issue and fix also apply to official 1.0.0p release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment