Repository navigation
Closed
Labels
area-Infrastructure-coreclrOnly use for closed issuesuntriagedNew issue has not been triaged by the area owner
Description
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
Metadata
Metadata
Assignees
Labels
area-Infrastructure-coreclrOnly use for closed issuesuntriagedNew issue has not been triaged by the area owner
Activity
[-]CLR msbuild builds fail[/-][+]CLR msbuild builds fail with unresolved external symbol RedirectedHandledJITCaseForGCStress_Stub[/+]Wraith2 commentedon Feb 24, 2022
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
RelWithDebInfobut I can't identify why.Area owners suggests the owner is @agocke not the person tagged.
tannergooding commentedon Feb 25, 2022
Notably just doing
.\build.cmd -subset clr -msbuildI saw some immediate but different failures.Doing
.\build.cmd -subset clrfollowed by.\build.cmd -subset clr -msbuildeverything 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.
Wraith2 commentedon Feb 25, 2022
With
mainas of a couple of hours ago i still see the same result. From cleaned runtime directlybuild -s clrsill succeed,build -s clr -msbuildwill fail due to missing externals, caused by the exports file not building because the linker is looking for it in theRelwithDebInfofolder not the configured build folder.agocke commentedon Feb 25, 2022
Unfortunately, I'm investigating other infra issues right now. @jkoritzinsky might have some ideas on CMake issues, though
Wraith2 commentedon Feb 26, 2022
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.
Wraith2 commentedon Mar 2, 2022
AsmConstants.zip as requested.
agocke commentedon Mar 3, 2022
Sorry, but since this is a non-default build configuration, it might take a while for anyone to look at this
Wraith2 commentedon Mar 3, 2022
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.
L2 commentedon Mar 3, 2022
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.
danmoseley commentedon Mar 3, 2022
@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 commentedon Mar 3, 2022
BTW thanks @L2 for root causing this.
Wraith2 commentedon Mar 3, 2022
Yes, much appreciated.
L2 commentedon Mar 9, 2022
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?
Wraith2 commentedon Mar 9, 2022
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
huoyaoyuan commentedon Mar 10, 2022
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?
Wraith2 commentedon Mar 10, 2022
Version 3.22.2. If you use
cmake --versionfrom 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.marcpopMSFT commentedon Mar 12, 2022
@danmoseley Build 17.1.1 of VS released on March 8th per the release notes.