i want to use opencv in QT, so i must compile it with mingw. When i want to compile it with CMake 2.8.10.2 it has following error
The CXX compiler identification is GNU 4.7.2
The C compiler identification is GNU 4.7.2
Check for working CXX compiler: C:/Qt/Qt5.0.1/Tools/MinGW/bin/g++.exe
Check for working CXX compiler: C:/Qt/Qt5.0.1/Tools/MinGW/bin/g++.exe -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "C:/Qt/Qt5.0.1/Tools/MinGW/bin/g++.exe" is not able to
compile a simple test program.
It fails with the following output:
Change Dir: C:/opencv_bin/CMakeFiles/CMakeTmp
Run Build Command:C:/Qt/Qt5.0.1/Tools/MinGW/bin/mingw32-make.exe
"cmTryCompileExec2270185098/fast"
C:/Qt/Qt5.0.1/Tools/MinGW/bin/mingw32-make.exe -f
CMakeFiles\cmTryCompileExec2270185098.dir\build.make
CMakeFiles/cmTryCompileExec2270185098.dir/build
mingw32-make.exe[1]: Entering directory
'C:/opencv_bin/CMakeFiles/CMakeTmp'
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report
C:\opencv_bin\CMakeFiles\CMakeTmp\CMakeFiles 1
'C:\Users\' is not recognized as an internal or external command,
operable program or batch file.
CMakeFiles\cmTryCompileExec2270185098.dir\build.make:59: recipe for target
'CMakeFiles/cmTryCompileExec2270185098.dir/testCXXCompiler.cxx.obj' failed
mingw32-make.exe[1]: ***
[CMakeFiles/cmTryCompileExec2270185098.dir/testCXXCompiler.cxx.obj] Error
1
mingw32-make.exe[1]: Leaving directory 'C:/opencv_bin/CMakeFiles/CMakeTmp'
makefile:116: recipe for target 'cmTryCompileExec2270185098/fast' failed
mingw32-make.exe: *** [cmTryCompileExec2270185098/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:61 (project)
Configuring incomplete, errors occurred!
any idea?
I have a newer version but in my case you should try in the folder QtSDK/minGW/bin instead of Qt folder.
Related
I am trying to install this project onto my computer and have been running into issue after issue.
The roadblock I've run into now is error 127. Most of the install works fine, until it gets to the step "make." I get the following output:
mkdir -p build && cd build && cmake .. && make
/bin/sh: cmake: commant not found
make: *** [Makefile:2: all] Error 127
I have tried installing on Git Bash for Windows 10 and using the terminal in CentOS. Both give me the same error. I have tried installing cmake on CentOS, but I'm unsure what to do with it now that it is installed. I also installed MinGW onto the Windows machine, but with no luck.
I'm relatively new to Linux/Unix (and very new to Git) so if the answer is obvious, I apologize.
I have found other questions similar to this, but the answer is always something along the lines of "it is trying to build something and it can't. need more context"
edit: Cmake is installed (as far as I can tell). I used this walk through to install it (updating the file names and stuff to correspond with the current version of cmake). The cmake directory was installed in the Downloads directory until I moved it (details below).
Someone had suggested that the cmake wasn't in a directory accessible to the $PATH variable. I moved it into a directory that I had added to the $PATH variable a while ago, but I am still getting the same error.
Edit 2: Alright, so I installed cmake through the CentOS software app thing. The make command works now, but theres a different problem. Running the make command outputs errors. The CMakerror.log file is filled with this over and over again:
Compilling the CXX compiler identification source file "CMakeCXXComilerID.cpp" failed
Compiler: CMAKE_CXX_COMPILER-NOTFOUND
Build flags:
Id flags: -c
The output was:
No such file or directory
There are a bunhc of different entries like this, the only difference between them is that the Id flags bit sometimes has a "-c" but it also does "--c++" and "--ec++"
Edit 3: Here is the output from using the make command:
mkdir -p build && cd build && cmake .. && make
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.11)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring incomplete, errors occurred!
See also "/home/ellingtonj/wave-gui/CMakeFiles/CMakeOutput.log".
See also "/home/ellingtonj/wave-gui/CMakeFiles/CMakeError.log".
make: *** [Makefile:2: all] Error 1
I checked the CMakeLists.txt file and there is, in fact a cmake_minimum_required line (It specifically says "cmake_minimum_required (VERSION 2.8)").
Edit 4: A user below suggested I may not have gcc/g++ installed. So I used this tutorial to install gcc. Now I get error 2. Progress!! The ouput of the make command is below:
mkdir -p build && cd build && cmake .. && make
-- The CXX compiler identification is GNU 8.3.1
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Creating program 'wave-gui' with sources:
-- main.cpp
-- app.cpp
-- core.cpp
-- ui.cpp
-- data.cpp
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.11)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ellingtonj/wave-gui
make[1]: Entering directory '/home/ellingtonj/wave-gui/build'
make[1]: *** No targets specified and no makefile found. Stop.
make[1]: Leaving directory '/home/ellingtonj/wave-gui/build'
make: *** [Makefile:2: all] Error 2
Before anyone says it, yes, there is a makefile in the directory. Here is the output of ls for the directory I'm working in:
build CMakeCache.txt cmake_install.cmake external main README.md
cmake CMakeFiles CMakeLists.txt LICENSE Makefile src
Edit 5: I renamed "Makefile" on the off chance that it was looking for "makefile" and it kinda worked. I got a new error message which is good. Kinda. make ouput below:
-- Creating program 'wave-gui' with sources:
-- main.cpp
-- app.cpp
-- core.cpp
-- ui.cpp
-- data.cpp
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.11)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ellingtonj/wave-gui
Scanning dependencies of target wave-gui
[ 16%] Building CXX object CMakeFiles/wave-gui.dir/main.o
/home/ellingtonj/wave-gui/main/main.cpp:10:10: fatal error: cg_config.h: No such file or directory
#include "cg_config.h"
^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/wave-gui.dir/build.make:63: CMakeFiles/wave-gui.dir/main.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/wave-gui.dir/all] Error 2
make: *** [makefile:130: all] Error 2
Edit 6(?): my problem has changed so much that I figured a new thread should be made to more accurately reflect the problem I'm dealing with. This thread is located here.
I've just installed CLion and i needed compiler. I installed Cygwin.
But there was an error:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
CMake Error: Error executing cmake::LoadCache(). Aborting.
Error code: 1
So, CMake was "bundled" and i tried to install it from site. But there was the next error:
Selected CMake might be incompatible with the Cygwin environment.
In order to run on Cygwin, CMake needs to be specially compiled.
Please select either CMake bundled with CLion or CMake from the Cygwin installation.
CMake Error: The source directory "/cygdrive/c/Users/Пользователь/AppData/Local/Temp/cmake_check_environment" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
Error code: 1
Then i've tried to install MinGW - this time it was the following problem:
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe -- broken
CMake Error at D:/CLion 182.2574.4/bin/cmake/share/cmake-3.11/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"D:/MinGW/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp
Run Build Command:"D:/MinGW/mingw64/bin/mingw32-make.exe" "cmTC_a4ce5/fast"
D:/MinGW/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_a4ce5.dir\build.make CMakeFiles/cmTC_a4ce5.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj
D:\MinGW\mingw64\bin\gcc.exe -o CMakeFiles\cmTC_a4ce5.dir\testCCompiler.c.obj -c C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c
gcc.exe: error: C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
mingw32-make.exe[1]: *** [CMakeFiles\cmTC_a4ce5.dir\build.make:65: CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:125: cmTC_a4ce5/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeError.log".
Error code: 1
In both cases it's problems with paths, i think. I tried to give root to CLion, gcc, etc. - nothing.
I've tried to find logs or just way to this path - but all was worthless - path doesn't exist.I just can't find out, why that's happening.
Help me, please
Looks like there is a problem with encodings somewhere between windows/cygwin/clion/cmake (I assume you user name is non-ascii).
As a quick workaround try:
installing CLion in the location without non-latin symbols
changing CLion's system and config folders to the location without non-latin symbols. instructions
And to troubleshoot the problem, could you please check if the cygwin's console shows the user home path correctly? (e.g. use ls /cygdrive/c/Users/, then cd to the user home path).
If Cygwin can correctly work with the user home, could you please file a bug report and attach CLion's log files? (Help | Show Log in Explorer)
I have trouble in compiling a simple hello world application with CLion and MinGW. The buttons for Run and Debug are grayd out.
I have installed MinGW with mingw32-gcc-g++ and mingw32-make packages.
After that I have install CLion which detected automatically the right folder for MinGW. However make, c compiler and c++ compiler will not get the checkmark.
Also in CMakeError.log file found the following:
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/MinGW/bin/gcc.exe
Build flags:
Id flags:
The output was:
1
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/MinGW/bin/gcc.exe
Build flags:
Id flags: -c
The output was:
1
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/MinGW/bin/gcc.exe
Build flags:
Id flags: -Aa
The output was:
1
Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler":
gcc.exe: fatal error: no input files
compilation terminated.
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 C compiler works failed with the following output:
Change Dir: D:/Users/Tau/.clion10/system/cmake/generated/94853116/94853116/__default__0/CMakeFiles/CMakeTmp
Run Build Command:C:/MinGW/bin/mingw32-make.exe "cmTryCompileExec3424130643/fast"
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTryCompileExec3424130643.dir\build.make CMakeFiles/cmTryCompileExec3424130643.dir/build
mingw32-make.exe[1]: Entering directory 'D:/Users/Tau/.clion10/system/cmake/generated/94853116/94853116/__default__0/CMakeFiles/CMakeTmp'
"C:\Program Files (x86)\JetBrains\CLion 138.2344.17\bin\cmake\bin\cmake.exe" -E cmake_progress_report D:\Users\Tau\.clion10\system\cmake\generated\94853116\94853116\__default__0\CMakeFiles\CMakeTmp\CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec3424130643.dir/testCCompiler.c.obj
C:\MinGW\bin\gcc.exe -o CMakeFiles\cmTryCompileExec3424130643.dir\testCCompiler.c.obj -c D:\Users\Tau\.clion10\system\cmake\generated\94853116\94853116\__default__0\CMakeFiles\CMakeTmp\testCCompiler.c
CMakeFiles\cmTryCompileExec3424130643.dir\build.make:56: recipe for target 'CMakeFiles/cmTryCompileExec3424130643.dir/testCCompiler.c.obj' failed
mingw32-make.exe[1]: Leaving directory 'D:/Users/Tau/.clion10/system/cmake/generated/94853116/94853116/__default__0/CMakeFiles/CMakeTmp'
mingw32-make.exe[1]: *** [CMakeFiles/cmTryCompileExec3424130643.dir/testCCompiler.c.obj] Error 1
Makefile:113: recipe for target 'cmTryCompileExec3424130643/fast' failed
mingw32-make.exe: *** [cmTryCompileExec3424130643/fast] Error 2
I am unable to figure out. I have tried also with cygwin x64 and the same issue occurs. What is wrong?
After so much time spent without any clue, I found that actually the crashing softwares were cc1.exe and cc1plus.exe. After using Dependency Waker tool which led mo to manually adding the zlib1.dll file near these two crashing exe, I found that the real reason was that package mingw32-libz was not installed.
I have installed mingw32-libz package in MinGW and removed manually added dlls and I get all checkmarks in settings.
I'm trying to use CMake to code with CodeBlocks under Windows.
Inside Cygwin console I do :
cmake .. -G"CodeBlocks - Unix Makefiles"
and output is :
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:D:/sources/tests/testOSG/build_CodeBlocks/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:D:/sources/tests/testOSG/build_CodeBlocks/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
I tried to set those problematic variables, but result is the same :
set CMAKE_MAKE_PROGRAM=C:/Progra~2/CodeBlocks/MinGW/bin/mingw32-make.exe
set CMAKE_C_COMPILER=C:/Progra~2/Microsoft Visual Studio 10.0/VC/bin/cl.exe
set CMAKE_CXX_COMPILER=C:/Progra~2/Microsoft Visual Studio 10.0/VC/bin/cl.exe
Any ideas how to make it work ?
Edit : adding the path to the compiler helps, but there's still an error :
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Defining WIN32 under Cygwin due to CMAKE_LEGACY_CYGWIN_WIN32
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- broken
CMake Error at /usr/share/cmake-2.8.9/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /cygdrive/d/sources/tests/testOSG/build_CodeBlocks/CMakeFiles/CMakeTmp
Run Build Command:C:/Program\ Files\
(x86)/CodeBlocks/MinGW/bin/mingw32-make.exe
"cmTryCompileExec437970983/fast"
C:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-make -f
CMakeFiles/cmTryCompileExec437970983.dir/build.make
CMakeFiles/cmTryCompileExec437970983.dir/build
/usr/bin/sh: -c: line 0: Erreur de syntaxe près du symbole inattendu « (
»
/usr/bin/sh: -c: line 0: `C:/Program Files
(x86)/CodeBlocks/MinGW/bin/mingw32-make -f
CMakeFiles/cmTryCompileExec437970983.dir/build.make
CMakeFiles/cmTryCompileExec437970983.dir/build'
mingw32-make: *** [cmTryCompileExec437970983/fast] Error 1
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
-- Configuring incomplete, errors occurred!
Maybe you installed the 'basic setup' from 'MinGW Installation Manager'. As it does not install the GNU C++ compiler with package name- 'mingw-gcc-g++'you should select its 'bin' and 'dev' and install manually. This worked for me.
for me following worked:
downloaded codeblocks-17.12mingw-setup.
added path to /MinGW/bin
hint: DONT INSTALL TO PATH WITH SPACES IN IT
in my case C:\Program Files (x86)\CodeBlocks\MinGW\bin dont worked for some projects.
when using c:\codeblocks... they work
in cmake use "CodeBlocks - MinGW Makefiles"
then open project.cbp
Make sure the directory with compilers(MinGw-gcc.exe or something similar) is in the PATH, after that start console one more time and try to run cmake again.
I have issue running cmake on a package residing in a mounted folder. I have full permissions on this mounted folder.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:50 (MESSAGE):
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/X/win_tmp/cmake/build/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make "cmTryCompileExec/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make
CMakeFiles/cmTryCompileExec.dir/build
make: Warning: File `Makefile' has modification time 0.38 s in the future
make[1]: Entering directory
`/home/X/win_tmp/cmake/build/CMakeFiles/CMakeTmp'
make[1]: Warning: File `CMakeFiles/cmTryCompileExec.dir/flags.make' has
modification time 0.35 s in the future
/usr/bin/cmake -E cmake_progress_report
/home/X/win_tmp/cmake/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o
/usr/bin/gcc -o CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c
/home/X/win_tmp/cmake/build/CMakeFiles/CMakeTmp/testCCompiler.c
cc1: error:
/home/X/win_tmp/cmake/build/CMakeFiles/CMakeTmp/testCCompiler.c:
Value too large for defined data type
make[1]: *** [CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o] Error 1
make[1]: Leaving directory
`/home/X/win_tmp/cmake/build/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
Cmake seems to run fine when I copy the package on to my linux filesystem.
Thanks,
Gudge
According to this link, the error Value too large for defined data type has to do with gcc executing stat() on Samba-mounted file systems. The inode returned is apparently rather large for those file systems.
The solution is to ensure your mount command has nounix,noserverino in the options column (in /etc/fstab or equivalent).
See the mount.cifs man page for further details.
This problem with mounted folders can also manifest itself with a failure for the cmake command "file(GLOB VAR PATTERNS)" to find anything. In my case, the subsequent command "add_library" would end up with no source files and fail with the following error:
You have called ADD_LIBRARY for library ... without any source files. This typically indicates a problem with your CMakeLists.txt file.
I hope that by mentioning this here that it will cut the search time of others from 4 to 2 minutes.