Ken Cummins
Ken Cummins

Reputation: 61

VS2022 Cross-compile via WSL2 fails (libcmake error?)

I'm trying to compile a fairly straightforward C++ project into ELF format for containerization, and I actually had it working briefly, but now, when I try to build ANY C++ code via WSL2, it fails in the CMake stage, before it can even configure itself. I have uninstalled and reinstalled VS 2022 17.4, and even rolled back the latest Windows 11 update from yesterday, just in case, but I still get the same error implying that a cmake library isn't loading properly (although I've even installed the MS cmake in my WSL environment):

10:26:15.5353681 [Info, Thread 54] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.BuildProjectScannerService: Switching config to linux-debug
10:26:15.5363640 [Info, Thread 50] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.WaitableIndexService: WaitableIndexService listening to IndexService at Completed
10:26:15.5363640 [Info, Thread 47] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.BuildProjectScannerService: OnFileScannerCompleted for CMakeLists.txt
10:26:15.5388714 [Info, Thread 54] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.ParseCache: Canceling all ongoing generations for workspaceDirectory='C:\Users\kenne\source\repos\TestCMake'
10:26:15.5398772 [Warning, Thread 54] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.BuildProjectScannerService: Data is not valid, just removing canceled for CMakeLists.txt linux-debug
10:26:15.5408777 [Info, Thread 53] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.BuildProjectScannerService: Starting scan ...
10:26:15.5428770 [Info, Thread 15] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.BuildProjectScannerService: Scanner Parsing starting: projectfilepath CMakeLists.txt Config Name:linux-debug
10:26:15.5498775 [Info, Thread 53] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.WaitableIndexService: WaitableIndexService listening to IndexService at Completed
10:26:15.5778801 [Info, Thread 47] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.ParseCache: CacheGenerationStarted root: CMAKELISTS.TXTlinux-debug CMakeLists.txt linux-debug
10:26:15.5859133 [Info, Thread 47] Microsoft.VisualStudio.CMake.Linux.Project.RemoteCMakeParser: RemoteCMakeParser ctor
10:26:15.5869118 [Info, Thread 47] libcmake.Linux.RemoteCMakeParser: RemoteCMakeParser ctor
10:26:15.5869118 [Info, Thread 47] Microsoft.VisualStudio.CMake.Linux.Project.RemoteCMakeParser: RemoteCMakeParser finished
10:26:15.5909273 [Error, Thread 47] Microsoft.VisualStudio.CMake.Project.ExternalBuildProject.ProjectProvider: System.MissingMethodException: Method not found: 'Void libcmake.CMakeParameters..ctor(System.String, System.String, libcmake.CMakeConfiguration)'.
   at libcmake.Linux.RemoteCMakeParameters..ctor(String daemonDirectory, String cmakeListsDirectory, Func`1 remoteSourceFilesDirectoryResolver, Func`1 remoteCMakeListsTxtDirectoryResolver, CMakeConfiguration config)
   at Microsoft.VisualStudio.CMake.Linux.Project.RemoteCMakeParserProvider.GetCMakeParameters(String cmakeListsFileOrDirectory, CMakeWorkspaceConfiguration cmakeConfiguration, String workspaceDirectory)
   at Microsoft.VisualStudio.CMake.Project.Utils.<GetCMakeParametersAsync>d__35.MoveNext()
End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.CMake.Project.ExternalBuildProject.ProjectProvider.<ParseProjectAsync>d__46.MoveNext()
10:26:15.5909273 [Error, Thread 47] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.ParseCache: Unknown exception during cache generation: root: CMAKELISTS.TXTlinux-debug CMakeLists.txt linux-debug
10:26:15.5919103 [Error, Thread 47] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.ParseCache: System.MissingMethodException: Method not found: 'Void libcmake.CMakeParameters..ctor(System.String, System.String, libcmake.CMakeConfiguration)'.
   at libcmake.Linux.RemoteCMakeParameters..ctor(String daemonDirectory, String cmakeListsDirectory, Func`1 remoteSourceFilesDirectoryResolver, Func`1 remoteCMakeListsTxtDirectoryResolver, CMakeConfiguration config)
   at Microsoft.VisualStudio.CMake.Linux.Project.RemoteCMakeParserProvider.GetCMakeParameters(String cmakeListsFileOrDirectory, CMakeWorkspaceConfiguration cmakeConfiguration, String workspaceDirectory)
   at Microsoft.VisualStudio.CMake.Project.Utils.<GetCMakeParametersAsync>d__35.MoveNext()
End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.CMake.Project.ExternalBuildProject.ProjectProvider.<ParseProjectAsync>d__46.MoveNext()
End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.CMake.Project.ExternalBuildProject.ProjectProvider.<ParseProjectAsync>d__46.MoveNext()
End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.ParseCache.<ParseAsyncImpl>d__34.MoveNext()
10:26:15.5939244 [Info, Thread 47] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.BuildProjectScannerService: Scanner Parsing done: projectfilepath CMakeLists.txt Config Name:linux-debug, took 51ms.
10:26:15.5939244 [Info, Thread 47] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.BuildProjectScannerService: Compute file data values for CMakeLists.txt Config linux-debug
10:26:15.5939244 [Error, Thread 47] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.BuildProjectScannerService: FDV Error for CMakeLists.txt Config linux-debug Canceled False AutoGenerateCanceled False
10:26:15.5988930 [Info, Thread 6] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.BuildProjectScannerService: OnFileScannerCompleted for CMakeLists.txt
10:26:15.5988930 [Info, Thread 15] Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.Services.BuildProjectScannerService: Finishing scan.

I've tried deleting and rebuilding the cmake cache, I've tweaked the cmake presets, I've followed the MS instructions on using WSL2 to compile for Linux, but it never works any more.

Upvotes: 1

Views: 625

Answers (1)

Ken Cummins
Ken Cummins

Reputation: 61

After poking around the MS site(s) long enough, an answer scurried out from behind a shrubbery...

The VS 17.4 update (11/30/2022) killed the cmake/wsl integration. So, until they sort that out, I'm going to try to uninstall and reinstall 17.2

https://developercommunity.visualstudio.com/t/CMake-Project-stopped-working-on-WSL-aft/10216023

Upvotes: 5

Related Questions