D
D
Dolarun2022-02-11 01:34:54
MinGW
Dolarun, 2022-02-11 01:34:54

How to fix PermissionDenied, try_compile error?

Here is the output from console:

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:

Why is the program not built with cmake -G "MinGW Makefiles"?
I tried running it as admin, but it doesn't work either.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2022-02-11
@Dolarun

Seems like cmake can't find the compiler. Perhaps you need to add the path to the mingw executable files to the PATH environment variable and perhaps also create the MINGW_HOME environment variable. Then cmake should normally find the compiler.
Personally, I don't use mingw and cmake in its purest form. I use msys2 with installed there using the regular package manager and mingw and cmake. In this case, they are great friends.
There were no problems with the assembly precisely because of cmake. It can also be used from the msys2 command line, it can also be used from cmd if you add paths to PATH and set the environment variables MSYS_HOME and MINGW_HOME.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question