microsoft / openssl

A cross-platform cryptographic library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'GetTickCount' undefined; assuming extern returning int when complile with Windows SDK (10.0.14393.0)

wangdevmgit opened this issue · comments

Hi, I have cloned from the repo branch OpenSSL_1_0_2_WinRT-stable. Then I try to build on UWP with ms\do_vsprojects14.bat (for Visual Studio 2015), an error occurs:

rand_win.c
Compile : .\crypto\rand\rand_win.c(664): error C2220: warning treated as error - no 'object' file generated [d:\build\ob\sb-14481047\openssl\windows_store_openssl\src\vsout\NT-Universal-10.0-Dll-Unicode\NT-Universal-10.0-Dll-Unicode.vcxproj]
Compile : .\crypto\rand\rand_win.c(664): warning C4013: 'GetTickCount' undefined; assuming extern returning int [d:\build\ob\sb-14481047\openssl\windows_store_openssl\src\vsout\NT-Universal-10.0-Dll-Unicode\NT-Universal-10.0-Dll-Unicode.vcxproj]
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"' : return code '0x2' [d:\build\ob\sb-14481047\openssl\windows_store_openssl\src\vsout\NT-Universal-10.0-Dll-Unicode\NT-Universal-10.0-Dll-Unicode.vcxproj]

So I disabled -WX and builded again, an error LNK2019 happened:

rand_win.obj : error LNK2019: unresolved external symbol _GetTickCount referenced in function _readtimer [d:\build\ob\sb-14477110\openssl\windows_store_openssl\src\vsout\NT-Universal-10.0-Dll-Unicode\NT-Universal-10.0-Dll-Unicode.vcxproj]

Note:
I could build successfully with Windows SDK (10.0.16299.0) but failed with 10.0.14393.0.

Is there anything I could to fix this issue?

uncomment https://github.com/Microsoft/openssl/blob/OpenSSL_1_0_2_WinRT-stable/ms/winrtdef.h#L24-L39 for 10.0.14393.0 SDK,
or the best wrap this into ifdef

#if !defined(NTDDI_WIN10_RS1) || (NTDDI_VERSION <= NTDDI_WIN10_RS1)
...
#endif

Thanks @afedchin,

Would you want to create a pull request and I can merge the change.

It gets challenging sometimes to try to validate all the combinations on SDKS.

I didn't try this solution. If @wangdevmgit confirm that it works I'll create a PR

Hi @afedchin ,
I have tried your first solution, tt works.

uncomment https://github.com/Microsoft/openssl/blob/OpenSSL_1_0_2_WinRT-stable/ms/winrtdef.h#L24-L39 for 10.0.14393.0 SDK,

However, I didn't try your the ifdef solution because I don't know how to do it.

Also, I modified LIBPATH in setVSvars.bat , because I met a compile-error : error C1107: could not find assembly 'windows.foundation.foundationcontract.winmd'

Merged. Thanks for the change.