Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake with mingw on Windows 10: Detecting CXX compiler ABI info - failed

I want to use cmake to create MinGW Makefiles on windows 10. I have installed mingw and I can use mingw32-make and g++ commands without issue.

The test project is a super simple CMakeLists.txt file:

cmake_minimum_required(VERSION 3.10)
project(hello-world)
add_executable(hello-world main.cpp)

and a simple main.cpp file:

#include <iostream>
int main() {
    std::cout << "hello Visual Studio Code! :)" << '\n'; 
    return 0;
}

These are the commands I use to create the makefiles:

>> mkdir build
>> cd build
>> cmake -G "MinGW Makefiles" ..

This is where I get errors:

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.10/Modules/CMakeDetermineCompilerId.cmake:495 (file):
file STRINGS file
"C:/Projects/test/build/CMakeFiles/3.10.1/CompilerIdCXX/a.exe" cannot be read.

... some more errors in the test files

-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring incomplete, errors occurred!

This is from the error log:

The CXX compiler identification could not be found in "C:/Projects/test/build/CMakeFiles/3.10.1/CompilerIdCXX/a.exe"

What is the CXX compiler ABI info and how can it be, that there is a working CXX compiler detected but this fails?

Let me know if you need anymore info about the setup!

like image 802
Jodo Avatar asked Jan 07 '18 21:01

Jodo


2 Answers

What turned out to be my culprit was Windows Defender! Turned that off and the CXX compiler ABI info - failed issue went away.

like image 150
TNorb Avatar answered Oct 23 '22 04:10

TNorb


I used the CMake-GUI tool to figure out the missing tool dependencies. For example : CMAKE_ADDR2LINE was not set, once I pointed it to the correct location of addr2line.exe ,the errors were resolved.

like image 1
eminemence Avatar answered Oct 23 '22 02:10

eminemence