microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.15k stars 6.38k forks source link

Failed to build OpenSSL for UWP #2828

Closed levlam closed 5 years ago

levlam commented 6 years ago

Hi.

I have a problem with building OpenSSL package for UWP. Installation of openssl:x86-uwp package and other OpenSSL UWP packages fails with the error

    cl  /ZW:nostdlib /EHsc /ZW /Fotmp32dll\winrt.obj /FUPlatform.winmd  /FUwindows.foundation.foundationcontract.winmd /FUwindows.foundation.universalapicontract.winmd -Iinc32 -Itmp32dll -FS -FIWindows.h  /MD /Ox /O2 /Ob2 -DOPENSSL_THREADS  -FS -FIWindows.h -W3 -Gs0 -GF -Gy -nologo -DWIN32_LEAN_AND_MEAN -DWINAPI_FAMILY=WINAPI_FAMILY_APP -DOPENSSL_WINAPP -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -FIsdkddkver.h -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_HW -DOPENSSL_NO_JPAKE -DOPENSSL_NO_WEAK_SSL_CIPHERS -DOPENSSL_NO_STATIC_ENGINE /Zi /Fdtmp32dll/lib -D_WINDLL -c .\ms\winrt.cpp
winrt.cpp
.\ms\winrt.cpp: fatal error C1107: could not find assembly 'windows.foundation.foundationcontract.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable

Here is the full output of vcpkg install run:

C:\src\vcpkg>vcpkg install openssl:x86-uwp
Your feedback is important to improve Vcpkg! Please take 3 minutes to complete our survey by running: vcpkg contact --survey
The following packages will be built and installed:
    openssl[core]:x86-uwp
Starting package 1/1: openssl:x86-uwp
Building package openssl[core]:x86-uwp...
A suitable version of cmake was not found (required v3.10.2). Downloading portable cmake v3.10.2...
-- CURRENT_INSTALLED_DIR=C:/src/vcpkg/installed/x86-uwp
-- DOWNLOADS=C:/src/vcpkg/downloads
-- CURRENT_PACKAGES_DIR=C:/src/vcpkg/packages/openssl_x86-uwp
-- CURRENT_BUILDTREES_DIR=C:/src/vcpkg/buildtrees/openssl
-- CURRENT_PORT_DIR=C:/src/vcpkg/ports/openssl/.
-- Using cached C:/src/vcpkg/downloads/openssl-microsoft-1.0.2l_WinRT.zip
-- Testing integrity of cached file...
-- Testing integrity of cached file... OK
-- Extracting done
-- Build x86-uwp
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:56 (message):
    Command failed: C:/src/vcpkg/buildtrees/openssl/src/openssl-OpenSSL_1_0_2l_WinRT/make-openssl.bat;Win32
    Working Directory: C:/src/vcpkg/buildtrees/openssl/src/openssl-OpenSSL_1_0_2l_WinRT
    See logs for more information:
      C:\src\vcpkg\buildtrees\openssl\make-openssl-x86-uwp-out.log
      C:\src\vcpkg\buildtrees\openssl\make-openssl-x86-uwp-err.log

Call Stack (most recent call first):
  ports/openssl/portfile-uwp.cmake:56 (vcpkg_execute_required_process)
  ports/openssl/portfile.cmake:2 (include)
  scripts/ports.cmake:72 (include)

Error: Building package openssl:x86-uwp failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: openssl:x86-uwp
  Vcpkg version: 0.0.104-2018-02-17-12b30c0f88eb583ab8b60d4b7706574234696545

Additionally, attach any relevant sections from the log files above.

And here is full build logs: make-openssl-x86-uwp-err.log make-openssl-x86-uwp-out.log

Additional info:

levlam commented 6 years ago

It looks like the problem is in the lines C:\src\vcpkg\buildtrees\openssl\src\openssl-OpenSSL_1_0_2l_WinRT>for / %f in ("C:\Program Files (x86)\Windows Kits\10\References\10.0.14393.0\Windows.Foundation.FoundationContract*") do set LibPath=C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\store;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata;C:\Program Files (x86)\Windows Kits\10\References;C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.VCLibs\14.0\References\CommonConfiguration\neutral;;%f\

C:\src\vcpkg\buildtrees\openssl\src\openssl-OpenSSL_1_0_2l_WinRT>for / %f in ("C:\Program Files (x86)\Windows Kits\10\References\10.0.14393.0\Windows.Foundation.UniversalApiContract*") do set LibPath=C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\store;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata;C:\Program Files (x86)\Windows Kits\10\References;C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.VCLibs\14.0\References\CommonConfiguration\neutral;;%f\

My Windows 10 SDK is installed not in the subfolder 10.0.14393.0 of "C:\Program Files (x86)\Windows Kits\10\References\", but in that directory itself, so the correct path should be "C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.FoundationContract*" instead of "C:\Program Files (x86)\Windows Kits\10\References\10.0.14393.0\Windows.Foundation.FoundationContract*"

ras0219-msft commented 6 years ago

Thanks for posting this issue and digging further into it!

I've pushed a branch[1] that should fix it. Could you try it out and let me know?

[1] https://github.com/Microsoft/vcpkg/tree/dev/roschuma/openssl-winsdk-2828

levlam commented 6 years ago

I've just made vcpkg upgrade --no-dry-run with this branch checked out and successfully rebuilt OpenSSL UWP libraries (I've built them before by manually patching make-openssl.bat with similar changes). So I can confirm that the patch fixes the issue.

NancyLi1013 commented 5 years ago

Hi levlam, thanks a lot for your feedback about the test result.

levlam commented 5 years ago

@NancyLi1013 Will you merge the patch to the upstream to have the issue fixed for other users of Windows 10 SDK 10.0.14393?

NancyLi1013 commented 5 years ago

@ras0219-msft , could you please help merge the patch to the master with Windows SDK 10.0.14393? Thanks.