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

Fix debug builds of msquic targeting UWP. #4373

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BillyONeal
Copy link
Member

Resolves the following compiler errors after vcpkg install ms-quic:x64-uwp. These errors are due to being built with /RTC1, but being linked with a release CRT that doesn't have the RTC stubs necessary for that.

[61/62] C:\Windows\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=src\bin\CMakeFiles\msquic.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe  CMakeFiles\MsQuicEtw_Resource.dir\inc\MsQuicEtw.rc.res src\bin\CMakeFiles\msquic.dir\winuser\dllmain.c.obj src\bin\CMakeFiles\msquic.dir\msquic.rc.res  /out:bin\Debug\msquic.dll /implib:obj\Debug\msquic.lib /pdb:bin\Debug\msquic.pdb /dll /version:0.0 /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG /WINMD:NO /APPCONTAINER /SUBSYSTEM:CONSOLE /MANIFESTUAC:NO  /nologo  /debug /DEF:"D:/vcpkg2/buildtrees/ms-quic/x64-uwp-dbg/src/bin/msquic.def"  /guard:cf /DYNAMICBASE  obj\Debug\core.lib  obj\Debug\platform.lib  wbemuuid.lib  winmm.lib  _deps\opensslquic-build\openssl\debug\lib\libssl.lib  _deps\opensslquic-build\openssl\debug\lib\libcrypto.lib  OneCore.lib  ws2_32.lib  ntdll.lib && cd ."
FAILED: bin/Debug/msquic.dll obj/Debug/msquic.lib
C:\Windows\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=src\bin\CMakeFiles\msquic.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe  CMakeFiles\MsQuicEtw_Resource.dir\inc\MsQuicEtw.rc.res src\bin\CMakeFiles\msquic.dir\winuser\dllmain.c.obj src\bin\CMakeFiles\msquic.dir\msquic.rc.res  /out:bin\Debug\msquic.dll /implib:obj\Debug\msquic.lib /pdb:bin\Debug\msquic.pdb /dll /version:0.0 /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG /WINMD:NO /APPCONTAINER /SUBSYSTEM:CONSOLE /MANIFESTUAC:NO  /nologo  /debug /DEF:"D:/vcpkg2/buildtrees/ms-quic/x64-uwp-dbg/src/bin/msquic.def"  /guard:cf /DYNAMICBASE  obj\Debug\core.lib  obj\Debug\platform.lib  wbemuuid.lib  winmm.lib  _deps\opensslquic-build\openssl\debug\lib\libssl.lib  _deps\opensslquic-build\openssl\debug\lib\libcrypto.lib  OneCore.lib  ws2_32.lib  ntdll.lib && cd ."
LINK: command "C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe CMakeFiles\MsQuicEtw_Resource.dir\inc\MsQuicEtw.rc.res src\bin\CMakeFiles\msquic.dir\winuser\dllmain.c.obj src\bin\CMakeFiles\msquic.dir\msquic.rc.res /out:bin\Debug\msquic.dll /implib:obj\Debug\msquic.lib /pdb:bin\Debug\msquic.pdb /dll /version:0.0 /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG /WINMD:NO /APPCONTAINER /SUBSYSTEM:CONSOLE /MANIFESTUAC:NO /nologo /debug /DEF:D:/vcpkg2/buildtrees/ms-quic/x64-uwp-dbg/src/bin/msquic.def /guard:cf /DYNAMICBASE obj\Debug\core.lib obj\Debug\platform.lib wbemuuid.lib winmm.lib _deps\opensslquic-build\openssl\debug\lib\libssl.lib _deps\opensslquic-build\openssl\debug\lib\libcrypto.lib OneCore.lib ws2_32.lib ntdll.lib" failed (exit code 1120) with the following output:
LINK : warning LNK4075: ignoring '/MANIFESTUAC' due to '/MANIFEST:NO' specification
   Creating library obj\Debug\msquic.lib and object obj\Debug\msquic.exp
platform.lib(datapath_raw_dummy.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(certificates_capi.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(pcp.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(cert_capi.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(hashtable.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(crypt.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(platform_worker.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(datapath_winuser.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(datapath_win.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(storage_winuser.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(crypt_openssl.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(tls_openssl.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
Resolves the following compiler errors after `vcpkg install ms-quic:x64-uwp`. These errors are due to being built with /RTC1, but being linked with a release CRT that doesn't have the RTC stubs necessary for that.

```console
[61/62] C:\Windows\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=src\bin\CMakeFiles\msquic.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe  CMakeFiles\MsQuicEtw_Resource.dir\inc\MsQuicEtw.rc.res src\bin\CMakeFiles\msquic.dir\winuser\dllmain.c.obj src\bin\CMakeFiles\msquic.dir\msquic.rc.res  /out:bin\Debug\msquic.dll /implib:obj\Debug\msquic.lib /pdb:bin\Debug\msquic.pdb /dll /version:0.0 /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG /WINMD:NO /APPCONTAINER /SUBSYSTEM:CONSOLE /MANIFESTUAC:NO  /nologo  /debug /DEF:"D:/vcpkg2/buildtrees/ms-quic/x64-uwp-dbg/src/bin/msquic.def"  /guard:cf /DYNAMICBASE  obj\Debug\core.lib  obj\Debug\platform.lib  wbemuuid.lib  winmm.lib  _deps\opensslquic-build\openssl\debug\lib\libssl.lib  _deps\opensslquic-build\openssl\debug\lib\libcrypto.lib  OneCore.lib  ws2_32.lib  ntdll.lib && cd ."
FAILED: bin/Debug/msquic.dll obj/Debug/msquic.lib
C:\Windows\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=src\bin\CMakeFiles\msquic.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe  CMakeFiles\MsQuicEtw_Resource.dir\inc\MsQuicEtw.rc.res src\bin\CMakeFiles\msquic.dir\winuser\dllmain.c.obj src\bin\CMakeFiles\msquic.dir\msquic.rc.res  /out:bin\Debug\msquic.dll /implib:obj\Debug\msquic.lib /pdb:bin\Debug\msquic.pdb /dll /version:0.0 /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG /WINMD:NO /APPCONTAINER /SUBSYSTEM:CONSOLE /MANIFESTUAC:NO  /nologo  /debug /DEF:"D:/vcpkg2/buildtrees/ms-quic/x64-uwp-dbg/src/bin/msquic.def"  /guard:cf /DYNAMICBASE  obj\Debug\core.lib  obj\Debug\platform.lib  wbemuuid.lib  winmm.lib  _deps\opensslquic-build\openssl\debug\lib\libssl.lib  _deps\opensslquic-build\openssl\debug\lib\libcrypto.lib  OneCore.lib  ws2_32.lib  ntdll.lib && cd ."
LINK: command "C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe CMakeFiles\MsQuicEtw_Resource.dir\inc\MsQuicEtw.rc.res src\bin\CMakeFiles\msquic.dir\winuser\dllmain.c.obj src\bin\CMakeFiles\msquic.dir\msquic.rc.res /out:bin\Debug\msquic.dll /implib:obj\Debug\msquic.lib /pdb:bin\Debug\msquic.pdb /dll /version:0.0 /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG /WINMD:NO /APPCONTAINER /SUBSYSTEM:CONSOLE /MANIFESTUAC:NO /nologo /debug /DEF:D:/vcpkg2/buildtrees/ms-quic/x64-uwp-dbg/src/bin/msquic.def /guard:cf /DYNAMICBASE obj\Debug\core.lib obj\Debug\platform.lib wbemuuid.lib winmm.lib _deps\opensslquic-build\openssl\debug\lib\libssl.lib _deps\opensslquic-build\openssl\debug\lib\libcrypto.lib OneCore.lib ws2_32.lib ntdll.lib" failed (exit code 1120) with the following output:
LINK : warning LNK4075: ignoring '/MANIFESTUAC' due to '/MANIFEST:NO' specification
   Creating library obj\Debug\msquic.lib and object obj\Debug\msquic.exp
platform.lib(datapath_raw_dummy.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(certificates_capi.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(pcp.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(cert_capi.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(hashtable.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(crypt.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(platform_worker.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(datapath_winuser.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(datapath_win.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(storage_winuser.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(crypt_openssl.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
platform.lib(tls_openssl.c.obj) : error LNK2001: unresolved external symbol _RTC_InitBase
```
@BillyONeal BillyONeal requested a review from a team as a code owner June 24, 2024 20:34
BillyONeal added a commit to BillyONeal/vcpkg that referenced this pull request Jun 24, 2024
Also fix uwp builds so that all ci.baseline.txt entries can be removed, submitted upstream as microsoft/msquic#4373

Originally started from microsoft#39475

Co-authored by: Lily Wang <v-lilywang@microsoft.com>
BillyONeal added a commit to BillyONeal/vcpkg that referenced this pull request Jun 24, 2024
Also fix uwp builds so that all ci.baseline.txt entries can be removed, submitted upstream as microsoft/msquic#4373

Originally started from microsoft#39475

Co-authored by: Lily Wang <v-lilywang@microsoft.com>
# We are using dynamic linking. Ensure that only the release version of CRT is used.
message(STATUS "Configuring for release version of dynamically linked CRT")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
# We are using dynamic linking. Ensure that only the dynamic CRT is used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@csujedihy can you please take a look here? You're the one that added this code to link only release version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that you can always just only build the release DLL for redistribution :)

BillyONeal added a commit to microsoft/vcpkg that referenced this pull request Jun 25, 2024
Also fix uwp builds so that all ci.baseline.txt entries can be removed,
submitted upstream as microsoft/msquic#4373
Also fix x86-windows builds which incorrectly compared SYSTEM_PROCESSOR
with 'win32' rather than 'x86'. Submitted upstream as
microsoft/msquic#4374 . This patch originally
authored by @LillyWangLL

Originally started from #39475

Co-authored by: Lily Wang <v-lilywang@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants