Cannot compile in AIX using c-compiler

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!

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.

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!

Could you try this instead?

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

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!

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

Thanks much, Alain!

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.

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!

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

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!

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.

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!

I see… :thinking:
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.

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!

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:

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