Ubuntu 如何将WSL与CLion一起使用

Ubuntu 如何将WSL与CLion一起使用,ubuntu,clion,windows-subsystem-for-linux,Ubuntu,Clion,Windows Subsystem For Linux,我正试图按照中的说明,将CLion设置为使用Linux的Windows子系统。Windows版本10.0.18362.836。Ubuntu 20.04 LTS,所有软件都是最新版本 我在“设置”对话框的“生成、执行、部署”>“工具链”页面上报告了以下错误: 测试CMake运行已完成,错误更多… 细节 CMake Error at /usr/share/cmake-3.16/Modules/CMakeDetermineSystem.cmake:185 (configure_file): con

我正试图按照中的说明,将CLion设置为使用Linux的Windows子系统。Windows版本10.0.18362.836。Ubuntu 20.04 LTS,所有软件都是最新版本

我在“设置”对话框的“生成、执行、部署”>“工具链”页面上报告了以下错误:
测试CMake运行已完成,错误更多…
细节

CMake Error at /usr/share/cmake-3.16/Modules/CMakeDetermineSystem.cmake:185 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- The C compiler identification is GNU 9.3.0
CMake Error at /usr/share/cmake-3.16/Modules/CMakeDetermineCCompiler.cmake:212 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- The CXX compiler identification is GNU 9.3.0
CMake Error at /usr/share/cmake-3.16/Modules/CMakeDetermineCXXCompiler.cmake:210 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:80 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCXXCompiler.cmake:73 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!
See also "/mnt/c/Users/user/AppData/Local/Tmp/cmake_check_environment/_build2367382020510955708/CMakeFiles/CMakeOutput.log".
See also "/mnt/c/Users/user/AppData/Local/Tmp/cmake_check_environment/_build2367382020510955708/CMakeFiles/CMakeError.log".

Error code: 1

如何解决此问题?

在第一步检查您是否安装了所有依赖项

sudo-apt-get-install-cmake-gcc-clang-gdb-build-sential
然后,您应该在ubuntu终端上配置ssh服务器 如果你自己能做到,那就太棒了!你不需要做任何其他事情,但如果你不能使用jet brains脚本

在“工具链”部分中,连接到ssh会话

但在回顾了这一点之后,我注意到编译器在最后一个底部给了您一个日志文件,以获取进一步的信息。请将它发送到这里,然后尝试重新安装包,在大多数情况下都可以正常工作
还有一个问题,您使用的是wsl 1还是wsl 2?WSL2比1有更多的功能,但它有太多的bug,对mot程序员来说并不好,我不建议任何人使用它,我在使用WSL2和Ubuntu 20.04.1时也遇到过同样的问题

问题似乎是Ubuntu WSL和Windows主机的处理器时钟稍微不同步

CMakeError.log:

make: Warning: File 'CMakeFiles/cmTC_823ef.dir/flags.make' has modification time 0.046 s in the future
make: warning:  Clock skew detected.  Your build may be incomplete.
使用
WSL--shutdown
WSL
重新启动WSL修复了该问题


可以找到问题的解决方案。

我已确认它是WSL 1。不幸的是,当我查找日志文件时,
cmake\u check\u环境
目录不存在。我使用Windows资源管理器和Bash查找过它。