VS2022通过WSL2交叉编译失败(libcmake错误?)

ssm49v7z  于 2022-12-04  发布在  其他
关注(0)|答案(1)|浏览(381)

我正在尝试将一个相当简单的C项目编译成ELF格式以进行容器化,实际上我已经让它工作了很短时间,但是现在,当我尝试通过WSL2构建任何C代码时,它在CMake阶段失败,甚至在它可以配置自己之前。我已经卸载并重新安装了VS 2022 17.4,甚至回滚了昨天的最新Windows 11更新,以防万一,但是我仍然得到同样的错误,暗示cmake库没有正确加载(尽管我甚至已经在WSL环境中安装了MS cmake):

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.

我试过删除和重建cmake缓存,我调整了cmake预置,我按照MS的说明使用WSL2为Linux编译,但它再也不能工作了。

7gcisfzg

7gcisfzg1#

在MS站点周围探查了足够长的时间后,一个答案从灌木丛后面匆匆跑了出来...
VS 17.4更新(2022年11月30日)取消了cmake/wsl集成。因此,在他们解决之前,我将尝试卸载并重新安装17.2
https://developercommunity.visualstudio.com/t/CMake-Project-stopped-working-on-WSL-aft/10216023

相关问题