# Cannot compile in AIX using c-compiler

**URL:** https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549
**Category:** Usage
**Created:** [January 28, 2020, 10:23pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549 "2020-01-28T22:23:01Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![zeigercap1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/z/b782af/32.png) [@zeigercap1](https://discourse.cmake.org/u/zeigercap1)
#### Post date: [January 28, 2020, 10:23pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/1 "2020-01-28T22:23:01Z")

</div>

Trying to build executables from c-code in AIX (IBM version of Unix) using CMake. CMake downloaded and installed without incident. However, when giving it a test c-code file to build, it finds the c-compiler correctly, but it seems to think it is broken (it isn’t) and it keeps asking for a CXX compiler… can you please help?  
(We don’t have a C++ compiler in AIX of course.) Thanks!

---

<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: [January 29, 2020, 8:16am UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/2 "2020-01-29T08:16:34Z")

</div>

Are you calling the `project` command in your `CMakeLists.txt`? If yes, what arguments are you passing to it?  
I think you have to pass it `LANGUAGES C` to enable the `C` language only. Otherwise, both `C` and `CXX` are enabled by default.

---

<div class="post-metadata">

### Author: ![zeigercap1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/z/b782af/32.png) [@zeigercap1](https://discourse.cmake.org/u/zeigercap1)
#### Post date: [January 29, 2020, 6:48pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/3 "2020-01-29T18:48:07Z")

</div>

I think so… the CMAkeLists.txt file looks like this:

project(name1)  
set(CMAKE\_C\_COMPILER “location”)  
add\_executable(app name2.c)

Is this not what it needs? The funny thing is that it finds the c-compiler, but it thinks it’s broken…  
yet it isn’t, and I can straight compile the source code just fine. Any thoughts?  
Thanks Alain!

---

<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: [January 29, 2020, 7:31pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/4 "2020-01-29T19:31:17Z")

</div>

Could you try this instead?

```cmake
set(CMAKE_C_COMPILER "location")
project(name1 LANGUAGES C)
add_executable(app name2.c)

```

---

<div class="post-metadata">

### Author: ![zeigercap1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/z/b782af/32.png) [@zeigercap1](https://discourse.cmake.org/u/zeigercap1)
#### Post date: [January 29, 2020, 8:32pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/5 "2020-01-29T20:32:40Z")

</div>

Your suggestion improved things in that cmake is no longer asking for a CXX compiler. However,  
it’s still strangely complaining about the C-compiler:

“Check for working C compiler -broken  
The C compiler is not able to compile a simple text program”

But the C compiler is fine, and is able to compile name2.c without any issues!

---

<div class="post-metadata">

### Author: ![zeigercap1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/z/b782af/32.png) [@zeigercap1](https://discourse.cmake.org/u/zeigercap1)
#### Post date: [January 29, 2020, 8:33pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/6 "2020-01-29T20:33:36Z")

</div>

Could it be a permissions issue? The compiler permissions are set to bin bin

Thanks much, Alain!

---

<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: [January 29, 2020, 8:45pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/7 "2020-01-29T20:45:03Z")

</div>

Did you have a look at `CMakeFiles/CMakeError.log` and/or `CMakeFiles/CMakeOutput.log`? They should contain more details about why CMake fails to use the C compiler.

---

<div class="post-metadata">

### Author: ![zeigercap1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/z/b782af/32.png) [@zeigercap1](https://discourse.cmake.org/u/zeigercap1)
#### Post date: [January 29, 2020, 9:04pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/8 "2020-01-29T21:04:01Z")

</div>

I looked at the two log files, and I see no indication of errors, at least to my untrained eye. The first is a long list of possible versions of the C compiler for many platforms, and it seems to identify that this is AIX  
with no problems… the second confirms that it knows it is AIX, and seems to show no errors… the output file a.out is binary, and scanning it I see nothing obvious pointing to the problem…

thanks!

---

<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: [January 29, 2020, 9:17pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/9 "2020-01-29T21:17:05Z")

</div>

> [@zeigercap1](#):
>
> I see no indication of errors, at least to my untrained eye

Could you please upload `CMakeError.log`? I would like to have a look.

---

<div class="post-metadata">

### Author: ![zeigercap1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/z/b782af/32.png) [@zeigercap1](https://discourse.cmake.org/u/zeigercap1)
#### Post date: [January 29, 2020, 9:33pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/10 "2020-01-29T21:33:26Z")

</div>

Alain,

Does the CMake bulletin board have rules against the uploading of files? I am new at this one… if so, please let me know an email address to send the file directly… Thanks!

---

<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: [January 29, 2020, 9:38pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/11 "2020-01-29T21:38:42Z")

</div>

Uploading files might be limited for new users indeed. You can copy-paste the file contents in a new message, right? Please write 3 back ticks (```) before and after to use preformatted text.

---

<div class="post-metadata">

### Author: ![zeigercap1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/z/b782af/32.png) [@zeigercap1](https://discourse.cmake.org/u/zeigercap1)
#### Post date: [January 29, 2020, 9:52pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/12 "2020-01-29T21:52:17Z")

</div>

This error file is big, about 630K, or about 30-40 pages… most of which seem to be explanation of  
flags. Cutting and pasting would be problematic. Is there another way I can get this file to you?  
Otherwise I can try to excise the unnecessary flag listings and post the important parts- but I might cut out an important clue. Thanks!

---

<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: [January 29, 2020, 9:59pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/13 "2020-01-29T21:59:08Z")

</div>

I see… 🤔  
You could create a gist on GitHub, or a Google Doc, or upload the file on some free file sharing platform like WeTransfer.  
Then you can share the link here.

---

<div class="post-metadata">

### Author: ![zeigercap1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/z/b782af/32.png) [@zeigercap1](https://discourse.cmake.org/u/zeigercap1)
#### Post date: [January 29, 2020, 10:17pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/14 "2020-01-29T22:17:11Z")

</div>

Alain,

The simplest thing was to excise all the unnecessary fluff from the error log (Usage flag descriptions)  
It also seems to have tried to do the same thing multiple times… I will now attempt to share the file on the board. Thanks!

---

<div class="post-metadata">

### Author: ![zeigercap1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/z/b782af/32.png) [@zeigercap1](https://discourse.cmake.org/u/zeigercap1)
#### Post date: [January 29, 2020, 10:18pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/15 "2020-01-29T22:18:54Z")

</div>

he C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/CMakeCCompilerId.o”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

Checking whether the C compiler is IAR using “” did not match “IAR .+ Compiler”:  
C for AIX Compiler, Version 6

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” failed.  
Compiler: CMAKE\_CXX\_COMPILER-NOTFOUND  
Build flags:  
Id flags:

The output was:  
No such file or directory

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” failed.  
Compiler: CMAKE\_CXX\_COMPILER-NOTFOUND  
Build flags:  
Id flags: -c

The output was:  
No such file or directory

Determining if the C compiler works failed with the following output:

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/CMakeCCompilerId.o”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

Checking whether the C compiler is IAR using “” did not match “IAR .+ Compiler”:  
C for AIX Compiler, Version 6

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” failed.  
Compiler: CMAKE\_CXX\_COMPILER-NOTFOUND  
Build flags:  
Id flags:

The output was:  
No such file or directory

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” failed.  
Compiler: CMAKE\_CXX\_COMPILER-NOTFOUND  
Build flags:  
Id flags: -c

The output was:  
No such file or directory

Determining if the C compiler works failed with the following output:

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/CMakeCCompilerId.o”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

Checking whether the C compiler is IAR using “” did not match “IAR .+ Compiler”:  
C for AIX Compiler, Version 6

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” failed.  
Compiler: CMAKE\_CXX\_COMPILER-NOTFOUND  
Build flags:  
Id flags:

The output was:  
No such file or directory

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” failed.  
Compiler: CMAKE\_CXX\_COMPILER-NOTFOUND  
Build flags:  
Id flags: -c

The output was:  
No such file or directory

Determining if the C compiler works failed with the following output:

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/CMakeCCompilerId.o”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

Checking whether the C compiler is IAR using “” did not match “IAR .+ Compiler”:  
C for AIX Compiler, Version 6

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” failed.  
Compiler: CMAKE\_CXX\_COMPILER-NOTFOUND  
Build flags:  
Id flags:

The output was:  
No such file or directory

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” failed.  
Compiler: CMAKE\_CXX\_COMPILER-NOTFOUND  
Build flags:  
Id flags: -c

The output was:  
No such file or directory

Determining if the C compiler works failed with the following output:

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/CMakeCCompilerId.o”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

Checking whether the C compiler is IAR using “” did not match “IAR .+ Compiler”:  
C for AIX Compiler, Version 6

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” failed.  
Compiler: CMAKE\_CXX\_COMPILER-NOTFOUND  
Build flags:  
Id flags:

The output was:  
No such file or directory

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” failed.  
Compiler: CMAKE\_CXX\_COMPILER-NOTFOUND  
Build flags:  
Id flags: -c

The output was:  
No such file or directory

Determining if the C compiler works failed with the following output:

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/CMakeCCompilerId.o”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

Checking whether the C compiler is IAR using “” did not match “IAR .+ Compiler”:  
C for AIX Compiler, Version 6

Determining if the C compiler works failed with the following output:

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/CMakeCCompilerId.o”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

Checking whether the C compiler is IAR using “” did not match “IAR .+ Compiler”:  
C for AIX Compiler, Version 6

Determining if the C compiler works failed with the following output:

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/CMakeCCompilerId.o”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

Checking whether the C compiler is IAR using “” did not match “IAR .+ Compiler”:  
C for AIX Compiler, Version 6

Determining if the C compiler works failed with the following output:

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/CMakeCCompilerId.o”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

Checking whether the C compiler is IAR using “” did not match “IAR .+ Compiler”:  
C for AIX Compiler, Version 6

Determining if the C compiler works failed with the following output:

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/CMakeCCompilerId.o”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

Checking whether the C compiler is IAR using “” did not match “IAR .+ Compiler”:  
C for AIX Compiler, Version 6

Determining if the C compiler works failed with the following output:

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/CMakeCCompilerId.o”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

The C compiler identification could not be found in “/opt/hellow/CMakeFiles/3.6.3/CompilerIdC/a.out”

Checking whether the C compiler is IAR using “” did not match “IAR .+ Compiler”:  
C for AIX Compiler, Version 6

Determining if the C compiler works failed with the following output:

---

<div class="post-metadata">

### Author: ![zeigercap1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/z/b782af/32.png) [@zeigercap1](https://discourse.cmake.org/u/zeigercap1)
#### Post date: [January 29, 2020, 10:19pm UTC](https://discourse.cmake.org/t/cannot-compile-in-aix-using-c-compiler/549/16 "2020-01-29T22:19:36Z")

</div>

Alain, I hope the error file was readable! Thanks!
