Skip to content
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
Closed

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

mpdaly opened this issue Jan 8, 2015 · 7 comments

Comments

@mpdaly
Copy link

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
Copy link
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?

@mpdaly
Copy link
Author

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
Copy link
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

@serin13
Copy link

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
Copy link
Member

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

@mpdaly
Copy link
Author

mpdaly commented Jan 8, 2015

Fix from git confirmed working here.

@mpdaly mpdaly closed this as completed Jan 8, 2015
@winkelsdorf
Copy link

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

mcr pushed a commit to mcr/openssl that referenced this issue Jun 22, 2021
Test matrix update and additional test fixes for OpenSSL 1.1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants