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

时间:2016-08-31 17:25:58

标签: windows gcc cmake cmake-gui

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

2 个答案:

答案 0 :(得分:0)

我想我找到了答案。至少它对我有用。

显然我需要在另一台计算机上以管理员的身份运行CMake。这样我认为它可以正确访问GCC文件。但是,我不完全确定为什么在另一台机器上它不是必需的并且工作得很好。

答案 1 :(得分:0)

您可能需要重新安装lib

mingw-get install --reinstall mingw32-libiconv-dll

我有一个非常相似的问题,并且这种问题已得到解决。

相关问题