windowsgcccmakecmake-gui

CMake reports broken g++ and missing libiconv-2.dll


I have some strange problem with CMake when I press Configure button.

It reports me all the time that libiconv-2.dll is missing and fails to finish operation. However, this library is present in MinGW/bin folder.

I am using CodeBlocks-MinGW Makefiles and CMake version 3.6.1 - 32 bit version (although this same problem is with 64 bit version). One interesting thing is that in consol it shows:

The CXX compiler identification is unknown

Check for working CXX compiler: C:/MinGW/bin/g++.exe

Check for working CXX compiler: C:/MinGW/bin/g++.exe -- broken

MinGW is correctly added to the system path and I was able to check version (GNU 4.8.1) and also compile simple hello world from command line using:

g++ test.cpp -o test

Testing this same CMakeLists file on another machine with this same configuration, but older CMake version 3.2.3 everything works. Doing some research online I've found that problem with this file is not new, so I doubt this is version problem.

Anyone has any idea what can be done more?

EDIT 1 This is the content of CMakeError.log

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: C:/MinGW/bin/g++.exe Build flags: Id flags:

The output was: 1

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: C:/MinGW/bin/g++.exe Build flags: Id flags: -c

The output was: 1

Checking whether the CXX compiler is IAR using "" did not match "IAR .+ Compiler": g++.exe: fatal error: no input files compilation terminated. Determining if the CXX compiler works failed with the following output: Change Dir: C:/Users/testuser/Desktop/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_c9a03/fast" C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_c9a03.dir\build.make CMakeFiles/cmTC_c9a03.dir/build

mingw32-make.exe1: Entering directory 'C:/Users/testuser/Desktop/build/CMakeFiles/CMakeTmp'

Building CXX object CMakeFiles/cmTC_c9a03.dir/testCXXCompiler.cxx.obj

C:\MinGW\bin\g++.exe -o CMakeFiles\cmTC_c9a03.dir\testCXXCompiler.cxx.obj -c C:\Users\testuser\Desktop\build\CMakeFiles\CMakeTmp\testCXXCompiler.cxx

CMakeFiles\cmTC_c9a03.dir\build.make:64: recipe for target 'CMakeFiles/cmTC_c9a03.dir/testCXXCompiler.cxx.obj' failed

mingw32-make.exe1: *** [CMakeFiles/cmTC_c9a03.dir/testCXXCompiler.cxx.obj] Error 1

mingw32-make.exe1: Leaving directory 'C:/Users/testuser/Desktop/build/CMakeFiles/CMakeTmp'

Makefile:125: recipe for target 'cmTC_c9a03/fast' failed

mingw32-make.exe: *** [cmTC_c9a03/fast] Error 2

I have manually compiled the file testCXXCompiler.cpp with g++ and it worked. There was no error during compilation.

EDIT 2

I have created SSCCE to test if problem isn't with some dependencies or some other code-related things. But testing this file:

test.cpp

#include <iostream>

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

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
project(Test)
add_executable(Test test.cpp)

I have still problems with missing library. The console output changed however slightly and now it is:

The C compiler identification is unknown

The CXX compiler identification is unknown

Check for working C compiler: C:/MinGW/bin/gcc.exe

Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken


Solution

  • I suppose I have found the answer. At least it is working for me.

    Apparently I needed to run the CMake on the other machine as an Administrator. This way I assume it could accessed to GCC files correctly. However, I am not completely sure why on the other machine it wasn't required and worked just fine.