The C compiler "C:/cygwin64/bin/i686-pc-cygwin-gcc.exe" is not able to compile a simple test program.

已完成

Hi,

Having gone through all the similar threads, none of the solutions worked for me. Help would be appreciated

The error I get is:

It fails with the following output:

Change Dir: /cygdrive/d/src/tester/cmake-build-debug/CMakeFiles/CMakeTmp

Run Build Command(s):/cygdrive/x/bin/gmake.exe cmTC_2a7e6/fast && X:/bin/gmake.exe -f CMakeFiles/cmTC_2a7e6.dir/build.make CMakeFiles/cmTC_2a7e6.dir/build
X:\bin\gmake.exe[1]: Entering directory `D:/src/tester/cmake-build-debug/CMakeFiles/CMakeTmp'
The system cannot find the path specified.

The folder does exist, and I can write to it from command line.  I also tried while running CLion as administrator to rule out lack of permissions

0

Hi!

Have you installed all required packages mentioned in https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-windows.html#Cygwin?

Please provide a screenshot of File | Settings | Build, Execution, Deployment | Toolchains (please capture the screenshot after the compiler detection is completed).

0

 

 

When I click on the 'more...' I get this:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Warning at /cygdrive/c/Users/owoloch/.CLion2019.3/system/cygwin_cmake/share/cmake-3.15.3/Modules/Platform/CYGWIN.cmake:15 (message):
CMake no longer defines WIN32 on Cygwin!

(1) If you are just trying to build this project, ignore this warning or
quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in
the CMake cache. If later configuration or build errors occur then this
project may have been written under the assumption that Cygwin is WIN32.
In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.

(2) If you are developing this project, add the line

set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required

at the top of your top-level CMakeLists.txt file or set the minimum
required version of CMake to 2.8.4 or higher. Then teach your project to
build on Cygwin without WIN32.
Call Stack (most recent call first):
/cygdrive/c/Users/owoloch/.CLion2019.3/system/cygwin_cmake/share/cmake-3.15.3/Modules/CMakeSystemSpecificInformation.cmake:26 (include)
CMakeLists.txt:1 (project)


CMake Error at CMakeLists.txt:1 (project):
No CMAKE_C_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:1 (project):
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.


-- Configuring incomplete, errors occurred!
See also "/cygdrive/d/temp/cmake_check_environment/_build3228418452328867185/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/d/temp/cmake_check_environment/_build3228418452328867185/CMakeFiles/CMakeError.log".

Error code: 1

0

Please install "gcc-g++" and "make" Cygwin packages. After that in CLion please empty the "C/C++ compiler" fields so that it looks like this:

Does it work in this case?

0

 

And still getting errors:

:\Users\owoloch\.CLion2019.3\system\cygwin_cmake\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /cygdrive/d/src/testproject
-- The C compiler identification is GNU 6.4.0
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc.exe
-- Check for working C compiler: /usr/bin/gcc.exe -- broken
CMake Error at /cygdrive/c/Users/owoloch/.CLion2019.3/system/cygwin_cmake/share/cmake-3.15.3/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"/usr/bin/gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /cygdrive/d/src/testproject/cmake-build-debug/CMakeFiles/CMakeTmp

Run Build Command(s):/cygdrive/x/bin/gmake.exe cmTC_a5b42/fast && X:/bin/gmake.exe -f CMakeFiles/cmTC_a5b42.dir/build.make CMakeFiles/cmTC_a5b42.dir/build
X:\bin\gmake.exe[1]: Entering directory `D:/src/testproject/cmake-build-debug/CMakeFiles/CMakeTmp'
The system cannot find the path specified.
/usr/bin/gcc.exe -o CMakeFiles/cmTC_a5b42.dir/testCCompiler.c.o -c /cygdrive/d/src/testproject/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c
The system cannot find the path specified.
The system cannot find the path specified.
/cygdrive/c/Users/owoloch/.CLion2019.3/system/cygwin_cmake/bin/cmake.exe -E cmake_link_script CMakeFiles/cmTC_a5b42.dir/link.txt --verbose=1
The system cannot find the path specified.
X:\bin\gmake.exe[1]: Leaving directory `D:/src/testproject/cmake-build-debug/CMakeFiles/CMakeTmp'
The batch file cannot be found.
X:\bin\gmake.exe: *** [cmTC_a5b42/fast] Error 1

 

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "/cygdrive/d/src/testproject/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/d/src/testproject/cmake-build-debug/CMakeFiles/CMakeError.log".

[Finished]

0

Please try specifying the Cygwin's make utility (C:\cygwin64\bin\make.exe) in the "make" field. 

0

Now I get this:

C:\Users\owoloch\.CLion2019.3\system\cygwin_cmake\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:/cygwin64/bin/make.exe -G "CodeBlocks - Unix Makefiles" /cygdrive/d/src/testproject
-- The C compiler identification is GNU 6.4.0
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc.exe
CMake Error at /cygdrive/c/Users/owoloch/.CLion2019.3/system/cygwin_cmake/share/cmake-3.15.3/Modules/CMakeTestCCompiler.cmake:32 (file):
file failed to open for writing (Is a directory):

/cygdrive/d/src/testproject/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c
Call Stack (most recent call first):
CMakeLists.txt:2 (project)


CMake Error at /cygdrive/c/Users/owoloch/.CLion2019.3/system/cygwin_cmake/share/cmake-3.15.3/Modules/CMakeTestCCompiler.cmake:44 (try_compile):
Failed to open

/cygdrive/d/src/testproject/cmake-build-debug/CMakeFiles/CMakeTmp/CMakeLists.txt

Is a directory
Call Stack (most recent call first):
CMakeLists.txt:2 (project)


-- Check for working C compiler: /usr/bin/gcc.exe -- broken
CMake Error at /cygdrive/c/Users/owoloch/.CLion2019.3/system/cygwin_cmake/share/cmake-3.15.3/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"/usr/bin/gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

 

 

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "/cygdrive/d/src/testproject/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/d/src/testproject/cmake-build-debug/CMakeFiles/CMakeError.log".

[Finished]

 

 

0

Please do File | Close Project. Then on the "Welcome screen" choose New project, then choose C++ Executable, click Create. Do you get the error for this project?

0

exactly the same

0

I found that cygwin has an issue with permissions on NTFS https://georgik.rocks/how-to-fix-incorrect-cygwin-permission-inwindows-7/ 
I tried this, and permissions seem to work fine now in cygwin shell but still not in CLion - is there some internal fstab?

0

Could you please restart computer?

0

did not do the trick:

The error in Clion:

 Change Dir: /cygdrive/d/src/newtest/cmake-build-debug/CMakeFiles/CMakeTmp

Run Build Command(s):/cygdrive/x/bin/gmake.exe cmTC_5aec3/fast && X:/bin/gmake.exe -f CMakeFiles/cmTC_5aec3.dir/build.make CMakeFiles/cmTC_5aec3.dir/build
X:\bin\gmake.exe[1]: Entering directory `D:/src/newtest/cmake-build-debug/CMakeFiles/CMakeTmp'
The system cannot find the path specified.
/usr/bin/gcc.exe -o CMakeFiles/cmTC_5aec3.dir/testCCompiler.c.o -c /cygdrive/d/src/newtest/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c
The system cannot find the path specified.
The system cannot find the path specified.

from cygwin shell:

owoloch@owoloch-g2-ssd ~
$ ls -l /cygdrive/d/src/newtest/cmake-build-debug/CMakeFiles/CMakeTmp
total 0

owoloch@owoloch-g2-ssd ~
$ ls -l /cygdrive/d/src/newtest/cmake-build-debug/CMakeFiles
total 26
drwxr-xr-x 1 owoloch IL_RND_MANSEC 0 Dec 17 17:33 3.15.3
-rw-r--r-- 1 owoloch IL_RND_MANSEC 54 Dec 17 17:33 clion-environment.txt
-rw-r--r-- 1 owoloch IL_RND_MANSEC 1981 Dec 17 17:33 clion-log.txt
-rw-r--r-- 1 owoloch IL_RND_MANSEC 85 Dec 17 17:33 cmake.check_cache
-rw-r--r-- 1 owoloch IL_RND_MANSEC 7476 Dec 17 17:33 CMakeError.log
-rw-r--r-- 1 owoloch IL_RND_MANSEC 806 Dec 17 17:33 CMakeOutput.log
drwxr-xr-x 1 owoloch IL_RND_MANSEC 0 Dec 17 17:33 CMakeTmp

 

0

It's again X:\bin\gmake.exe instead of the Cygwin's make utility.

And I am not sure it's a CLion-related issue. Please try building the CMake project outside CLion - in the Command Prompt, for example. Is it built successfully?

Maybe you can try using MinGW?

0

I finally solved this by using an older version of cygwin.

Thanks. I really appreciate your responsiveness.

0

I'm glad you solved the issue! And thanks a lot for sharing the solution here!

0

请先登录再写评论。