首页 > 解决方案 > 如何在 CLion 中使用 WSL

问题描述

我正在尝试按照https://www.jetbrains.com/help/clion/how-to-use-wsl-development-environment-in-clion.html中的说明设置 CLion 以使用适用于 Linux 的 Windows 子系统# . Windows 版本 10.0.18362.836。Ubuntu 20.04 LTS,所有软件都是最新的。

我在设置对话框的构建、执行、部署 > 工具链页面上报告了以下错误: Test CMake run finished with error more... 详细信息...

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

我该怎么做才能解决这个问题?

标签: ubuntuclionwindows-subsystem-for-linux

解决方案


我在使用 WSL 2 和 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 重新启动wsl --shutdownwsl解决了该问题。

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


推荐阅读