MinGW gcc isn't able to compile a simple test program(same with cygwin) in CLion - windows

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)

Related

Parallel compilation giving problem in MSYS2

When I am compiling with J8, sometime I am getting the following error:
C:\msys64\usr\bin\make.exe -C firmware all -j8 -O
Compiling file: project/src/tests.c with optimization level: -Os
error: unable to open output file 'build/tests.o': 'no such file or directory'
1 error generated.
This happens randomly.
If I change J8 to J1, then compilation is always successful. There is no problem with path or directory permission as compilation is working with J1 and sometime with J8.
My setup details:
MSYS2
ARM Compiler v6.16
Windows 10
Not sure whether it is a problem of MSYS2 or ARM Compiler or Window specific problem.

Getting the error "make: [Makefile:2: all] Error 127" when I use the make command

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.

CMake for CodeBlocks under windows

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.

cmake error while running on a mounted directory

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.

QCA Library for windows

I am compiling the QCA Library for windows and using the steps from INSTALL File for for configure I am using the following command in windows console:
configure.exe --qtdir=C:\QtSDK\Desktop\Qt\4.7.3\mingw
The response is:
Configuring Qt Cryptographic Architecture (QCA) ...
Reason: There was an error compiling 'conf'. See conf.log for details.
I am trying to compile using Qt in windows directly and shows the following error:
-I"c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\ActiveQt" -I"release" -I"." -I"c:\QtSDK\Desktop\Qt\4.7.3\mingw\mkspecs\win32-g++" -o release\mlock.o ..\..\Encryption-QCA\src\botantools\botan\ml_win32\mlock.cpp
In file included from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/objbase.h:73,
from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/ole2.h:9,
from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/windows.h:114,
from ..\..\Encryption-QCA\src\botantools\botan\ml_win32\mlock.cpp:37:
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/objidl.h:95: error: expected unqualified-id before string constant
mingw32-make[2]: Leaving directory `C:/Users/AlejoLina/Documents/Alejandro/Compacta/SE-HA_Tool/Encryption-QCA-build-desktop/src'
mingw32-make[1]: Leaving directory `C:/Users/AlejoLina/Documents/Alejandro/Compacta/SE-HA_Tool/Encryption-QCA-build-desktop/src'
mingw32-make[2]: *** [release/mlock.o] Error 1
mingw32-make[1]: *** [release] Error 2
mingw32-make: *** [sub-src-make_default] Error 2
The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project qca (target: Desktop)
When executing build step 'Make'
Thanks in advance for the help
I can't say for sure that this is your problem but you may want to try using the make that is available with MSYS. I've always had better success with it. From MinGW's own FAQ..
The "native" (i.e.: MSVCRT dependent)
port of make is lacking in some
functionality and has modified
functionality due to the lack of POSIX
on Win32.
The problem in the configure was that the executable doesnt find the windows make (mingw-make).
The solution is to put the right path to the envinronment variables (qt and mingw bin path).

Resources