Skip to content

CLR msbuild builds fail with unresolved external symbol RedirectedHandledJITCaseForGCStress_Stub #65562

Closed

Description

@Wraith2

Description

Building from the commandline (presumably with cmake) works. Building from the commandline with -msbuild fails. Attempting to build the CoreCLR solution using in visual studio fails, errors as below. Current git head is fb69200870cfa03d48d2e2dfee95a51a7d21d838
log files nicluding binlog

Reproduction Steps

git clean -xdf
build -s clr -msbuild

Expected behavior

Build should succeed.

Actual behavior

       Creating library E:/Programming/csharp7/runtime/artifacts/obj/coreclr/windows.x64.Debug/ide/dlls/mscoree/coreclr/Debug/coreclr.lib and object E:/Programming/csharp7/runtime/artifacts/obj/coreclr/windows.x64.Debug/ide/dlls/mscoree/coreclr/Debug/coreclr.exp
  threadsuspend.obj : error LNK2019: unresolved external symbol RedirectedHandledJITCaseForGCStress_Stub referenced in function "public: int __cdecl Thread::CheckForAndDoRedirectForGCStress(struct _CONTEXT *)" (?CheckForAndDoRedirectForGCStress@Thread@@QEAAHPEAU_CONTEXT@@@Z) [E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscoree\coreclr\coreclr.vcxproj]
  debugger.obj : error LNK2001: unresolved external symbol RedirectedHandledJITCaseForGCStress_Stub [E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscoree\coreclr\coreclr.vcxproj]
  debugger.obj : error LNK2019: unresolved external symbol RedirectedHandledJITCaseForGCStress_StubEnd referenced in function "void __cdecl `dynamic initializer for 'private: static class MemoryRange * Debugger::s_hijackFunction''(void)" (??__E?s_hijackFunction@Debugger@@0PAVMemoryRange@@A@@YAXXZ) [E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscoree\coreclr\coreclr.vcxproj]
  E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscoree\coreclr\Debug\coreclr.dll : fatal error LNK1120: 2 unresolved externals [E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscoree\coreclr\coreclr.vcxproj]
    coreclr_static.vcxproj -> E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscoree\coreclr\Debug\coreclr_static.lib

  Build FAILED.

  LINK : fatal error LNK1181: cannot open input file 'E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\debug\daccess\RelWithDebInfo\daccess.lib' [E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscordac\mscordaccore_exp.vcxproj]
  C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(245,5): error MSB8066: Custom build for 'E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\CMakeFiles\9e60c9b9cb41a192f91d1a3c78fd4d5f\mscordaccore.exp.rule;E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\CMakeFiles\1bf752c3a000341abc180bcf8eaadcbb\mscordaccore_exp.rule;E:\Programming\csharp7\runtime\src\coreclr\dlls\mscordac\CMakeLists.txt' exited with code 1181. [E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscordac\mscordaccore_exp.vcxproj]
  threadsuspend.obj : error LNK2019: unresolved external symbol RedirectedHandledJITCaseForGCStress_Stub referenced in function "public: int __cdecl Thread::CheckForAndDoRedirectForGCStress(struct _CONTEXT *)" (?CheckForAndDoRedirectForGCStress@Thread@@QEAAHPEAU_CONTEXT@@@Z) [E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscoree\coreclr\coreclr.vcxproj]
  debugger.obj : error LNK2001: unresolved external symbol RedirectedHandledJITCaseForGCStress_Stub [E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscoree\coreclr\coreclr.vcxproj]
  debugger.obj : error LNK2019: unresolved external symbol RedirectedHandledJITCaseForGCStress_StubEnd referenced in function "void __cdecl `dynamic initializer for 'private: static class MemoryRange * Debugger::s_hijackFunction''(void)" (??__E?s_hijackFunction@Debugger@@0PAVMemoryRange@@A@@YAXXZ) [E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscoree\coreclr\coreclr.vcxproj]
  E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscoree\coreclr\Debug\coreclr.dll : fatal error LNK1120: 2 unresolved externals [E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscoree\coreclr\coreclr.vcxproj]

Regression?

No response

Known Workarounds

No response

Configuration

Windows 10, x64.
VS2022 latest stable.
dotnet sdk 6.0.102

Other information

No response

Activity

  1. ghost added
    area-Infrastructure-coreclr
    on Feb 18, 2022
  2. ghost added
    untriaged
    on Feb 18, 2022
  3. changed the title [-]CLR msbuild builds fail[/-] [+]CLR msbuild builds fail with unresolved external symbol RedirectedHandledJITCaseForGCStress_Stub[/+] on Feb 18, 2022
  4. Wraith2 commented on Feb 24, 2022

    @Wraith2
    ContributorAuthor

    The build fails because the linker can't create an exports file:
    LINK : fatal error LNK1181: cannot open input file 'E:\Programming\csharp7\runtime\artifacts\obj\coreclr\windows.x64.Checked\ide\debug\daccess\RelWithDebInfo\daccess.lib'
    Debug Release and Checked all incorrectly try to use RelWithDebInfo but I can't identify why.

    Area owners suggests the owner is @agocke not the person tagged.

  5. tannergooding commented on Feb 25, 2022

    @tannergooding
    Member

    Notably just doing .\build.cmd -subset clr -msbuild I saw some immediate but different failures.

    Doing .\build.cmd -subset clr followed by .\build.cmd -subset clr -msbuild everything looked to succeed as expected.

    It might be worth seeing if it still repros. Otherwise @agocke appears to be the right person to help route this as its a runtime-side infra issue.

  6. Wraith2 commented on Feb 25, 2022

    @Wraith2
    ContributorAuthor

    With main as of a couple of hours ago i still see the same result. From cleaned runtime directly build -s clr sill succeed, build -s clr -msbuild will fail due to missing externals, caused by the exports file not building because the linker is looking for it in the RelwithDebInfo folder not the configured build folder.

  7. agocke commented on Feb 25, 2022

    @agocke
    Member

    Unfortunately, I'm investigating other infra issues right now. @jkoritzinsky might have some ideas on CMake issues, though

  8. Wraith2 commented on Feb 26, 2022

    @Wraith2
    ContributorAuthor

    I've checked out in blocks back as far as November last year and can still repro the issue. I know that I've been able to work on the project after that date because I've got merged pull requests from this year so the problem isn't caused by a direct change to the codebase.

    One thing I know has changed is that I uninstalled vs 2019 and moved entirely to vs 2022.

  9. Wraith2 commented on Mar 2, 2022

    @Wraith2
    ContributorAuthor

    AsmConstants.zip as requested.

  10. agocke commented on Mar 3, 2022

    @agocke
    Member

    Sorry, but since this is a non-default build configuration, it might take a while for anyone to look at this

  11. Wraith2 commented on Mar 3, 2022

    @Wraith2
    ContributorAuthor

    Understood. It's blocking me implementing a few things so I'm coming back to it every now and again and seeing if I can gain any new insights. Someone on discord with area knowledge asked for the AsmConstants files which is why I uploaded them.

    I'm fairly convinced that the root cause is that all builds are ending up taking the RelWithDebugInfo path incorrectly which means the _debug symbol isn't defined when the asm is compiled. The logs aren't particularly useful in tracking that down though. Release builds fail because it's looking for a file that doesn't exist.

  12. L2 commented on Mar 3, 2022

    @L2
    Contributor

    Experiencing the same trying to get a debug build working in VS 2022. Dug around a little and the root cause is cmake generating an incorrect mscordaccore_exp.vcxproj file.

    Identical to this issue: https://developercommunity.visualstudio.com/t/CMake-vcxproj-regression-in-1710-when/1670541

    The visual studio team says they have a fix pending for release as of Feb.23.2022. @danmoseley , any chance you know when the fix might roll out as it affects development on .NET? (ie. anyone using VS 2022 attempting to develop coreclr via a debug build will run into this).

    @Wraith2 , opening the generated artifacts\obj\coreclr\windows.x64.Debug\ide\dlls\mscordac\mscordaccore_exp.vcxproj and looking under the CustomBuild tags shows the problem. cmake is duplicating condition checks / other weird behavior.

  13. danmoseley commented on Mar 3, 2022

    @danmoseley
    Contributor

    @L2 looking at the internal ticket, the fix was verified in "17.1.1 [32222.245.d17.1]". @marcpopMSFT do you know how to translate that roughly into a timeframe?

    I see newer builds, but I'm not on a public channel myself.

  14. danmoseley commented on Mar 3, 2022

    @danmoseley
    Contributor

    BTW thanks @L2 for root causing this.

  15. Wraith2 commented on Mar 3, 2022

    @Wraith2
    ContributorAuthor

    Yes, much appreciated.

  16. L2 commented on Mar 9, 2022

    @L2
    Contributor

    Looks like the fix has been released in VS 2022. Thanks @danmoseley for looking into the VS ticket and @Wraith2 for creating the issue.

    @Wraith2 Any chance you've tried out the new build?

  17. Wraith2 commented on Mar 9, 2022

    @Wraith2
    ContributorAuthor

    I have not. I installed a non vs packaged version of cmake and made sure it was on path which let me carry on with what I was working on. If it's fixed in vs I'll close this issue

  18. huoyaoyuan commented on Mar 10, 2022

    @huoyaoyuan
    Member

    I'm also hitting the exact same issue. I've uninstalled vs2019 totally.
    The fix was released in 17.1, but not in 17.2 preview right now. I have only preview installed so I'm not able to debug.

    @Wraith2 can you share the cmake version you are using?

  19. Wraith2 commented on Mar 10, 2022

    @Wraith2
    ContributorAuthor

    Version 3.22.2. If you use cmake --version from the commandline and it has an MSVC in the version string you're using the version from visual studio. Just take the latest stable from the CMake website and install that then ensure that it's on path before the vs version.

  20. marcpopMSFT commented on Mar 12, 2022

    @marcpopMSFT
    Member

    @L2 looking at the internal ticket, the fix was verified in "17.1.1 [32222.245.d17.1]". @marcpopMSFT do you know how to translate that roughly into a timeframe?

    I see newer builds, but I'm not on a public channel myself.

    @danmoseley Build 17.1.1 of VS released on March 8th per the release notes.

  21. ghost locked as resolved and limited conversation to collaborators on Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Infrastructure-coreclruntriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions