"Error:The C compiler "gcc.exe" is not able to compile a simple test program."

Hi all, I don't use CMake for my project, and we have a custom build system (MSVC/GCC on Windows/Linux), so I just want to use CLion as my IDE but not my build tool.

I downloaded the latest CLion build (138.2344.15), as well as a fresh copy of MinGW (installed on my D drive, as I don't have full write access to my C drive). I then started CLion, added all my source files (~30k C++ files) but then got the following error in the CMake pane at the bottom of the screen:

Error:The C compiler "D:/mingw/bin/gcc.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/aludwin/.clion10/system/cmake/generated/a5af3c4a/a5af3c4a/__default__/CMakeFiles/CMakeTmp
Run Build Command:D:/mingw/bin/mingw32-make.exe "cmTryCompileExec2576536829/fast"
D:/mingw/bin/mingw32-make.exe -f CMakeFiles\cmTryCompileExec2576536829.dir\build.make CMakeFiles/cmTryCompileExec2576536829.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/aludwin/.clion10/system/cmake/generated/a5af3c4a/a5af3c4a/__default__/CMakeFiles/CMakeTmp'
"D:\JetBrains\CLion 138.2344.15\bin\cmake\bin\cmake.exe" -E cmake_progress_report C:\Users\aludwin\.clion10\system\cmake\generated\a5af3c4a\a5af3c4a\__default__\CMakeFiles\CMakeTmp\CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec2576536829.dir/testCCompiler.c.obj
D:\mingw\bin\gcc.exe -o CMakeFiles\cmTryCompileExec2576536829.dir\testCCompiler.c.obj -c C:\Users\aludwin\.clion10\system\cmake\generated\a5af3c4a\a5af3c4a\__default__\CMakeFiles\CMakeTmp\testCCompiler.c
CMakeFiles\cmTryCompileExec2576536829.dir\build.make:56: recipe for target 'CMakeFiles/cmTryCompileExec2576536829.dir/testCCompiler.c.obj' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTryCompileExec2576536829.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/aludwin/.clion10/system/cmake/generated/a5af3c4a/a5af3c4a/__default__/CMakeFiles/CMakeTmp'
Makefile:113: recipe for target 'cmTryCompileExec2576536829/fast' failed
mingw32-make.exe: *** [cmTryCompileExec2576536829/fast] Error 2
CMake will not be able to correctly generate this project.


CLion then proceeded to index my project for a minute or two, but only appears to have indexed the (very few) Javascript files located in our source tree. None of the C++ files were indexed.

I had a look inside my c:\users\<whoami>\.clion\...\CMakeError.log but it wasn't terribly illuminating:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: D:/mingw/bin/gcc.exe
Build flags:
Id flags:

The output was:
1


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: D:/mingw/bin/gcc.exe
Build flags:
Id flags: -c

The output was:
1


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: D:/mingw/bin/gcc.exe
Build flags:
Id flags: -Aa

The output was:
1
<command-line>:0:1: error: missing '(' after predicate



So two questions:

  1. Is it necessary to resolve the problem shown above to get CLion to index my source files?
  2. If so, what might I be doing wrong?


I'd appreciate any help on this!

Thanks,
Adrian

7 comments
Comment actions Permalink

Note that this appears to be the same as https://youtrack.jetbrains.com/issue/CPP-785#u=1409812883584. However, the latest update seemed to be that they expected the latest MinGW (4.8) to work.


0
Comment actions Permalink

I tried downgrading GCC from 4.8 to 4.7, but no luck.

0
Comment actions Permalink

Have you added the Mingw /bin-path to your PATH variable in windows?

0
Comment actions Permalink

Just tried that but no change. I also deleted <user>/.clion10 and the .idea folder in my project before restartin clion, and verified the change by saying "echo %path%" from within the terminal inside clion.

0
Comment actions Permalink

Adrian, could you please check 'Toolchains' page in 'Settings' the latest EAP build, is there any problem reported?

0
Comment actions Permalink

Nope, everything looks ok.
clion.png

I'd be willing to do a live debug via Webex if you want, but not this week.

0
Comment actions Permalink

Does the same problem happen with a newly created project (File | New Project)?
If so, please to the following:
* clean ~/.clion10/system/cmake folder
* open newly created project
* when the problem happens, zip '~/.clion10/system/cmake' and send the content to clion-support email.

0

Please sign in to leave a comment.