linux 对configure_file的每次调用都在WSL上失败:configure_file配置文件时出现问题

00jrzges  于 2023-08-03  发布在  Linux
关注(0)|答案(2)|浏览(127)

我刚刚在一个全新的WSL安装(Ubuntu 18.04 LTS)上构建并安装了cmake 3.16。然后,我创建了一个默认的HelloWorld项目

(base) ciaran@DESKTOP-K0APGUV:/mnt/d/ATest$ tree .
.
├── CMakeLists.txt
└── main.cpp
//CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(ATest)

set(CMAKE_CXX_STANDARD 14)

add_executable(ATest main.cpp)
//main.cpp
#include <iostream>

#include <string>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

然后试图建立:

(base) ciaran@DESKTOP-K0APGUV:/mnt/d/ATest$ mkdir build
(base) ciaran@DESKTOP-K0APGUV:/mnt/d/ATest$ cd build/
(base) ciaran@DESKTOP-K0APGUV:/mnt/d/ATest/build$ cmake ..


我得到了以下结果。

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

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

-- The CXX compiler identification is GNU 10.1.0
CMake Error at /usr/local/share/cmake-3.16/Modules/CMakeDetermineCXXCompiler.cmake:210 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:2 (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/local/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:80 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:2 (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/local/share/cmake-3.16/Modules/CMakeTestCXXCompiler.cmake:73 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!
See also "/mnt/d/ATest/build/CMakeFiles/CMakeOutput.log".
See also "/mnt/d/ATest/build/CMakeFiles/CMakeError.log".
(base) ciaran@DESKTOP-K0APGUV:/mnt/d/ATest/build$


我最初尝试cmake 3.15,但升级,看看它是否是一个版本问题,鉴于此,我不这是。我还尝试了g++-7g++-9,它们的行为相同。
有人知道这里发生了什么吗?- 谢谢-谢谢

rsl1atfo

rsl1atfo1#

1.在/etc/中创建一个名为wsl.conf的文件,并使用以下文本:

# /etc/wsl.conf
[automount]
options = "metadata"
enabled = true

字符串
1.重新启动wsl:
wsl.exe -t Ubuntu // (or other e.g. Debian)
来源:

kcugc4gi

kcugc4gi2#

我可以通过按顺序运行以下命令来修复上述错误:

% cd build
% cmake -B . -S ..
% cmake --build .

字符串
该解取自here

相关问题