【问题标题】:How to use WSL with CLion如何在 CLion 中使用 WSL
【发布时间】:2020-07-29 03:32:38
【问题描述】:

我正在尝试按照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

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

【问题讨论】:

    标签: ubuntu clion windows-subsystem-for-linux


    【解决方案1】:

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

    问题的解决方法可以在here找到。

    【讨论】:

      【解决方案2】:

      首先检查你是否安装了所有依赖项

      sudo apt-get install cmake gcc clang gdb build-essential
      

      那么你应该在你的 ubuntu 终端上配置 ssh 服务器 如果你能自己做就很棒!你不需要做任何其他事情,但如果你不能使用 jet brains 脚本

      在工具链部分连接到您的 ssh 会话

      但在查看此内容后,我注意到编译器在最后一个底部为您提供了一个日志文件,以获取更多信息,请在此处发送,并尝试重新安装它们的软件包,这在大多数情况下应该可以正常工作 还有一个问题是您使用的是 wsl 1 还是 2? wsl 2 比 1 有更多的功能,但它有很多错误,对 mot 程序员不利,我不向任何人推荐它

      【讨论】:

      • 我已经确认它是 WSL 1。
      • 不幸的是,当我去查找日志文件时,cmake_check_environment 目录不存在。我使用 Windows 资源管理器和 Bash 找到了它。
      猜你喜欢
      • 1970-01-01
      • 2019-01-19
      • 2022-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-03
      • 1970-01-01
      相关资源
      最近更新 更多