# The C compiler "/usr/bin/cc" is not able to compile a simple test program.

**URL:** https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258
**Category:** Usage
**Tags:** os:linux
**Created:** [August 13, 2022, 8:42am UTC](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258 "2022-08-13T08:42:30Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Doug\_Rattmann](https://discourse.cmake.org/user_avatar/discourse.cmake.org/doug_rattmann/32/2669_2.png) [@Doug\_Rattmann](https://discourse.cmake.org/u/Doug_Rattmann)
#### Post date: [August 13, 2022, 8:42am UTC](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258/1 "2022-08-13T08:42:30Z")

</div>

Hi I was triying to install asepire by source i followed this tutorial: [How to Compile Aseprite on Ubuntu Linux - YouTube](https://www.youtube.com/watch?v=s3hhkcDOASc.Iam) on Linux Mint 19.3 its my first time trying to install something from source and using Cmake so Iam just copieng and pasting. When i was trying to run that command:  
cmake   
-DCMAKE\_BUILD\_TYPE=RelWithDebInfo   
-DCMAKE\_CXX\_FLAGS:STRING=-stdlib=libc++   
-DCMAKE\_EXE\_LINKER\_FLAGS:STRING=-stdlib=libc++   
-DLAF\_BACKEND=skia   
-DSKIA\_DIR=$HOME/programme/deps/skia   
-DSKIA\_LIBRARY\_DIR=$HOME/programme/deps/skia/out/Release-x64   
-DSKIA\_LIBRARY=$HOME/programme/deps/skia/out/Release-x64/libskia.a   
-G Ninja   
…  
I got this Error:

– Detecting C compiler ABI info - failed  
– Check for working C compiler: /usr/bin/cc  
– Check for working C compiler: /usr/bin/cc - broken  
CMake Error at /usr/local/share/cmake-3.24/Modules/CMakeTestCCompiler.cmake:69 (message):  
The C compiler

```
"/usr/bin/cc"

```

is not able to compile a simple test program.

It fails with the following output:

```
Change Dir: /home/karl/programme/aseprite/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/ninja cmTC_04eaa && [1/2] Building C object CMakeFiles/cmTC_04eaa.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_04eaa
FAILED: cmTC_04eaa 
: && /usr/bin/cc -stdlib=libc++ CMakeFiles/cmTC_04eaa.dir/testCCompiler.c.o -o cmTC_04eaa && :
cc: error: unrecognized command line option ‘-stdlib=libc++’
ninja: build stopped: subcommand failed.

```

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

Hope you can help me with this thank you.

---

<div class="post-metadata">

### Author: ![McMartin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mcmartin/32/150_2.png) [@McMartin](https://discourse.cmake.org/u/McMartin)
#### Post date: [August 13, 2022, 6:09pm UTC](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258/2 "2022-08-13T18:09:07Z")

</div>

That video is one year old. It doesn’t match the current instructions. You should read [aseprite/INSTALL.md at main · aseprite/aseprite · GitHub](https://github.com/aseprite/aseprite/blob/main/INSTALL.md) for the latest instructions.

---

<div class="post-metadata">

### Author: ![Doug\_Rattmann](https://discourse.cmake.org/user_avatar/discourse.cmake.org/doug_rattmann/32/2669_2.png) [@Doug\_Rattmann](https://discourse.cmake.org/u/Doug_Rattmann)
#### Post date: [August 13, 2022, 6:18pm UTC](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258/3 "2022-08-13T18:18:24Z")

</div>

Thanks for your reply. I used the commands from the current instruction cant see where it is different from the video to the point i got.

---

<div class="post-metadata">

### Author: ![jtxa](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jtxa/32/1535_2.png) [@jtxa](https://discourse.cmake.org/u/jtxa)
#### Post date: [August 13, 2022, 9:48pm UTC](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258/4 "2022-08-13T21:48:37Z")

</div>

Those command line options are for clang, not gcc.  
According to that manual you need to export CC/CXX envvars first and set them to clang.  
If you did that, you probably don’t have clang installed.

---

<div class="post-metadata">

### Author: ![Doug\_Rattmann](https://discourse.cmake.org/user_avatar/discourse.cmake.org/doug_rattmann/32/2669_2.png) [@Doug\_Rattmann](https://discourse.cmake.org/u/Doug_Rattmann)
#### Post date: [August 14, 2022, 9:57am UTC](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258/5 "2022-08-14T09:57:01Z")

</div>

as in the instruction i did those two commands export CC=clang and export CXX=clang++ before that one which gibes me the error so i installed clang and it gives me still an error.

---

<div class="post-metadata">

### Author: ![jtxa](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jtxa/32/1535_2.png) [@jtxa](https://discourse.cmake.org/u/jtxa)
#### Post date: [August 14, 2022, 2:26pm UTC](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258/6 "2022-08-14T14:26:39Z")

</div>

Have you removed your build directory before trying again with clang installed?  
CMake caches some information, like the compiler found. GCC was already found previously, so it probably still tries GCC.

---

<div class="post-metadata">

### Author: ![Doug\_Rattmann](https://discourse.cmake.org/user_avatar/discourse.cmake.org/doug_rattmann/32/2669_2.png) [@Doug\_Rattmann](https://discourse.cmake.org/u/Doug_Rattmann)
#### Post date: [August 14, 2022, 2:58pm UTC](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258/7 "2022-08-14T14:58:34Z")

</div>

Thank you so much, it worked.

---

<div class="post-metadata">

### Author: ![baishui\_ma](https://discourse.cmake.org/user_avatar/discourse.cmake.org/baishui_ma/32/3530_2.png) [@baishui\_ma](https://discourse.cmake.org/u/baishui_ma)
#### Post date: [June 15, 2023, 6:33am UTC](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258/8 "2023-06-15T06:33:47Z")

</div>

> [@Doug\_Rattmann](#):
>
> ```auto
> 
> ```
> 
> CMake will not be able to correctly generate this project.

gcc11 compile clang9 fail  
same problem

---

<div class="post-metadata">

### Author: ![skystalkerrc](https://discourse.cmake.org/user_avatar/discourse.cmake.org/skystalkerrc/32/6153_2.png) [@skystalkerrc](https://discourse.cmake.org/u/skystalkerrc)
#### Post date: [June 10, 2026, 6:18am UTC](https://discourse.cmake.org/t/the-c-compiler-usr-bin-cc-is-not-able-to-compile-a-simple-test-program/6258/9 "2026-06-10T06:18:23Z")

</div>

Thanks, it works.
