【问题标题】:MinGW gcc isn't able to compile a simple test program(same with cygwin) in CLionMinGW gcc 无法在 CLion 中编译简单的测试程序(与 cygwin 相同)
【发布时间】:2018-05-27 10:51:21
【问题描述】:

我刚刚安装了 CLion,我需要编译器。我安装了 Cygwin。 但是出现了错误:

CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in

CMake Error: Error executing cmake::LoadCache(). Aborting.

Error code: 1

所以,CMake 是“捆绑”的,我尝试从站点安装它。但是出现了下一个错误:

 Selected CMake might be incompatible with the Cygwin environment.
In order to run on Cygwin, CMake needs to be specially compiled.
Please select either CMake bundled with CLion or CMake from the Cygwin installation.


CMake Error: The source directory "/cygdrive/c/Users/Пользователь/AppData/Local/Temp/cmake_check_environment" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

Error code: 1

然后我尝试安装 MinGW - 这次是以下问题:

-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe -- broken
CMake Error at D:/CLion 182.2574.4/bin/cmake/share/cmake-3.11/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "D:/MinGW/mingw64/bin/gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp

    Run Build Command:"D:/MinGW/mingw64/bin/mingw32-make.exe" "cmTC_a4ce5/fast"
    D:/MinGW/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_a4ce5.dir\build.make CMakeFiles/cmTC_a4ce5.dir/build
    mingw32-make.exe[1]: Entering directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj
    D:\MinGW\mingw64\bin\gcc.exe    -o CMakeFiles\cmTC_a4ce5.dir\testCCompiler.c.obj   -c C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c
    gcc.exe: error: C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
    gcc.exe: fatal error: no input files
    compilation terminated.
    mingw32-make.exe[1]: *** [CMakeFiles\cmTC_a4ce5.dir\build.make:65: CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj] Error 1
    mingw32-make.exe[1]: Leaving directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
    mingw32-make.exe: *** [Makefile:125: cmTC_a4ce5/fast] Error 2




  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeError.log".

Error code: 1

我认为,在这两种情况下,路径都有问题。我试图给 CLion、gcc 等 root 权限 - 没有。 我试图找到日志或只是找到这条路径的方法 - 但一切都毫无价值 - 路径不存在。我只是不知道为什么会这样。 请帮帮我

【问题讨论】:

    标签: windows compiler-errors path clion


    【解决方案1】:

    看起来 windows/cygwin/clion/cmake 之间的编码存在问题(我假设您的用户名是非 ascii)。

    作为一种快速解决方法尝试:

    • 在没有非拉丁符号的位置安装 CLion

    • 将 CLion 的 systemconfig 文件夹更改为没有非拉丁符号的位置。 instructions

    为了解决问题,您能否检查一下 cygwin 的控制台是否正确显示了用户主路径? (例如,使用ls /cygdrive/c/Users/,然后使用cd 到用户主路径)。 如果 Cygwin 可以正确使用用户 home,请file a bug report 并附上 CLion 的日志文件吗? (帮助 | 在资源管理器中显示日志)

    【讨论】:

    • 是的,我已经更改了文件夹 systemconfig - 没有。这很有趣,但有新错误 - The source directory "/cygdrive/c/Users/Пользователь/AppData/Local/Temp/cmake_check_environment" does not appear to contain CMakeLists.txt.
    猜你喜欢
    • 2015-07-05
    • 1970-01-01
    • 2023-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-12
    • 2019-05-07
    • 2020-11-13
    相关资源
    最近更新 更多