# Cmake Error

**URL:** https://discourse.cmake.org/t/cmake-error/6345
**Category:** Usage
**Created:** [August 25, 2022, 5:07pm UTC](https://discourse.cmake.org/t/cmake-error/6345 "2022-08-25T17:07:22Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Yugoo](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/y/b77776/32.png) [@Yugoo](https://discourse.cmake.org/u/Yugoo)
#### Post date: [August 25, 2022, 5:07pm UTC](https://discourse.cmake.org/t/cmake-error/6345/1 "2022-08-25T17:07:22Z")

</div>

Hi,  
I am using Windows Subsystem for Linux (WSL), to run a project. I am encountering some errors when I try to build my project.  
[cmake] Not searching for unused variables given on the command line.  
[cmake] – The C compiler identification is GNU 7.2.0  
[cmake] – The CXX compiler identification is GNU 7.2.0  
[cmake] – Check for working C compiler: /mnt/c/Program Files/Haskell Platform/8.6.3/mingw/bin/gcc.exe  
[cmake] – Check for working C compiler: /mnt/c/Program Files/Haskell Platform/8.6.3/mingw/bin/gcc.exe – broken  
[cmake] CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):  
[cmake] The C compiler  
[cmake]  
[cmake] “/mnt/c/Program Files/Haskell Platform/8.6.3/mingw/bin/gcc.exe”  
[cmake]  
[cmake] is not able to compile a simple test program.  
[cmake]  
[cmake] It fails with the following output:  
[cmake]  
[cmake] Change Dir: /mnt/c/Users/uosuj/source/repos/MyProject/oop/build/CMakeFiles/CMakeTmp  
[cmake]  
[cmake] Run Build Command(s):/usr/bin/make cmTC\_bd248/fast && make: Warning: File ‘Makefile’ has modification time 16 s in the future  
[cmake] /usr/bin/make -f CMakeFiles/cmTC\_bd248.dir/build.make CMakeFiles/cmTC\_bd248.dir/build  
[cmake] make[1]: Entering directory ‘/mnt/c/Users/uosuj/source/repos/MyProject/oop/build/CMakeFiles/CMakeTmp’  
[cmake] make[1]: Warning: File ‘CMakeFiles/cmTC\_bd248.dir/flags.make’ has modification time 16 s in the future  
[cmake] Building C object CMakeFiles/cmTC\_bd248.dir/testCCompiler.c.o  
[cmake] “/mnt/c/Program Files/Haskell Platform/8.6.3/mingw/bin/gcc.exe” -o CMakeFiles/cmTC\_bd248.dir/testCCompiler.c.o -c /mnt/c/Users/uosuj/source/repos/MyProject/oop/build/CMakeFiles/CMakeTmp/testCCompiler.c  
[cmake] realgcc.exe: error: /mnt/c/Users/uosuj/source/repos/MyProject/oop/build/CMakeFiles/CMakeTmp/testCCompiler.c: No such file or directory  
[cmake] realgcc.exe: fatal error: no input files  
[cmake] compilation terminated.  
[cmake] make[1]: \*\*\* [CMakeFiles/cmTC\_bd248.dir/build.make:66: CMakeFiles/cmTC\_bd248.dir/testCCompiler.c.o] Error 1  
[cmake] make[1]: Leaving directory ‘/mnt/c/Users/uosuj/source/repos/MyProject/oop/build/CMakeFiles/CMakeTmp’  
[cmake] make: \*\*\* [Makefile:121: cmTC\_bd248/fast] Error 2  
[cmake]  
[cmake]  
[cmake]  
[cmake]  
[cmake]  
[cmake] CMake will not be able to correctly generate this project.  
[cmake] Call Stack (most recent call first):  
[cmake] CMakeLists.txt:2 (project)  
[cmake]  
[cmake]  
[cmake] – Configuring incomplete, errors occurred!  
[cmake] See also “/mnt/c/Users/uosuj/source/repos/MyProject/oop/build/CMakeFiles/CMakeOutput.log”.  
[cmake] See also “/mnt/c/Users/uosuj/source/repos/MyProject/oop/build/CMakeFiles/CMakeError.log”.  
Please can someone help me figure this out as the deadline is fast approaching for the project.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [August 26, 2022, 5:10pm UTC](https://discourse.cmake.org/t/cmake-error/6345/2 "2022-08-26T17:10:33Z")

</div>

It looks like you’re trying to build within WSL using a Windows compiler? That’s unlikely to work well. You should be able to get a compiler from the distro you’re using inside of WSL instead.

---

<div class="post-metadata">

### Author: ![Yugoo](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/y/b77776/32.png) [@Yugoo](https://discourse.cmake.org/u/Yugoo)
#### Post date: [August 26, 2022, 6:09pm UTC](https://discourse.cmake.org/t/cmake-error/6345/3 "2022-08-26T18:09:09Z")

</div>

Hi,  
Thank you for your response. How can I get a compiler inside of WSL? Because from what I know, I already have gcc installed in WSL.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [August 26, 2022, 6:17pm UTC](https://discourse.cmake.org/t/cmake-error/6345/4 "2022-08-26T18:17:17Z")

</div>

The GCC that is being found is coming from your Haskell SDK installation in your Windows machine. This is almost certainly a Windows compiler, not a Linux compiler. You’ll need to figure out what distribution is being used (`cat /etc/os-release` should help there) and follow the instructions for that distro to install them. If I had to guess, `apt-get install build-essential` is what you want).

---

<div class="post-metadata">

### Author: ![Yugoo](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/y/b77776/32.png) [@Yugoo](https://discourse.cmake.org/u/Yugoo)
#### Post date: [August 29, 2022, 2:57pm UTC](https://discourse.cmake.org/t/cmake-error/6345/5 "2022-08-29T14:57:55Z")

</div>

Hi Ben,  
I have the build essentials already installed. I read on stack overflow that it might be a cross compiling situation. But I still cannot figure it out.

---

<div class="post-metadata">

### Author: ![Yugoo](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/y/b77776/32.png) [@Yugoo](https://discourse.cmake.org/u/Yugoo)
#### Post date: [September 8, 2022, 6:20pm UTC](https://discourse.cmake.org/t/cmake-error/6345/6 "2022-09-08T18:20:10Z")

</div>

Anyone has an idea how to resolve the issue above?

---

<div class="post-metadata">

### Author: ![iphelf](https://discourse.cmake.org/user_avatar/discourse.cmake.org/iphelf/32/2752_2.png) [@iphelf](https://discourse.cmake.org/u/iphelf)
#### Post date: [September 8, 2022, 6:39pm UTC](https://discourse.cmake.org/t/cmake-error/6345/7 "2022-09-08T18:39:00Z")

</div>

Maybe you should try to prevent Windows `PATH` from being added to WSL environment (like [this](https://gist.github.com/ilbunilcho/4280bd55a10cefef75e74986b6bff936)) if the problem is the gcc outside in Windows shadows the gcc inside WSL.
