Dolarun
@Dolarun

Как исправить ошибку PermissionDenied, try_compile?

Вот вывод с косноли:
C:\Users\79306\Desktop\CMAKETEST>cmake -G "MinGW Makefiles"
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The CXX compiler identification is GNU 6.3.0
-- Detecting CXX compiler ABI info
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.22/Modules/CMakeDetermineCompilerABI.cmake:49 (try_compile):
  Failed to open

    C:/Users/79306/Desktop/CMAKETEST/CMakeFiles/CMakeTmp/CMakeLists.txt

  Permission denied
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
  CMakeLists.txt:3 (project)


-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Users/79306/Desktop/DEVELOPMENT-LIBRARIES/MINGW_FOLDER/bin/g++.exe
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:49 (try_compile):
  Failed to open

    C:/Users/79306/Desktop/CMAKETEST/CMakeFiles/CMakeTmp/CMakeLists.txt

  Permission denied
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


-- Check for working CXX compiler: C:/Users/79306/Desktop/DEVELOPMENT-LIBRARIES/MINGW_FOLDER/bin/g++.exe - broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
  The C++ compiler

    "C:/Users/79306/Desktop/DEVELOPMENT-LIBRARIES/MINGW_FOLDER/bin/g++.exe"

  is not able to compile a simple test program.

  It fails with the following output:





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


-- Configuring incomplete, errors occurred!
See also "C:/Users/79306/Desktop/CMAKETEST/CMakeFiles/CMakeOutput.log".
See also "C:/Users/79306/Desktop/CMAKETEST/CMakeFiles/CMakeError.log".

Cmake
cmake_minimum_required(VERSION 3.2)

project(cmaketest CXX)

add_executable(test test.cpp)

test.cpp
#include <iostream>

int main()
{
	std::cout<<"KEKW";
	return 0;
}

CMakeoutput.log
The system is: Windows - 10.0.19044 - AMD64
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: C:/Users/79306/Desktop/DEVELOPMENT-LIBRARIES/MINGW_FOLDER/bin/g++.exe 
Build flags: 
Id flags:  

The output was:
0


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.exe"

The CXX compiler identification is GNU, found in "C:/Users/79306/Desktop/CMAKETEST/CMakeFiles/3.22.2/CompilerIdCXX/a.exe"

CMakeError
Detecting CXX compiler ABI info failed to compile with the following output:



Determining if the CXX compiler works failed with the following output:

Почему программа не собирается через cmake -G "MinGW Makefiles"?
Пробовал через админа запускать, тоже не получается.
  • Вопрос задан
  • 382 просмотра
Решения вопроса 1
@res2001
Developer, ex-admin
Похоже cmake не может найти компилятор. Возможно надо в переменную окружения PATH добавить путь до исполняемых файлов mingw и возможно еще создать переменную окружения MINGW_HOME. Тогда cmake должен нормально найти компилятор.

Лично я не использую mingw и cmake в чистом виде. Использую msys2 с установленным туда с помощью штатного пакетного менеджера и mingw и cmake. В этом случае они отлично дружат.
Никаких проблем со сборкой именно из-за cmake не было. Можно использовать и из командной строки msys2, можно и из cmd, если добавить пути в PATH и настроить переменные окружения MSYS_HOME и MINGW_HOME.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы