[CMake] Configuration issues on AIX

Jakob Reschke forums.jakob at resfarm.de
Tue Feb 27 11:30:50 EST 2018


Hello,

In search for a new build tool for an existing project, I wanted to
give CMake 3.6.3 a try on AIX 5.3 with gcc 4.0.0, but quickly hit
obstacles with the GCC compiler identification and the file(STRINGS)
command. What I am looking for is guidance on how to solve the issues,
and for info whether I might miss some prerequisites, or whether there
are any workarounds I could temporarily put in place to get a first
build going.

Given this simple CMakeLists.txt:

    cmake_minimum_required(VERSION 3.6)
    project(foo LANGUAGES C)
    add_executable(hello main.c)
    # where main.c is just a printf hello world program

It does not recognize the compiler identification:

<<<<<<<<<<<<<
$ (mkdir -p build && cd build && cmake ..)
-- The C compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc
CMake Error at /opt/freeware/share/cmake/Modules/CMakeTestCCompiler.cmake:47
(try_compile):
  Unknown extension ".c" for file

    /home/.../build/CMakeFiles/CMakeTmp/testCCompiler.c

  try_compile() works only for enabled languages.  Currently these are:

    C

  See project() command to enable other languages.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /opt/freeware/share/cmake/Modules/CMakeTestCCompiler.cmake:61
(message):
  The C compiler "/usr/bin/gcc" is not able to compile a simple test program.

  It fails with the following output:





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


-- Configuring incomplete, errors occurred!
See also "/home/.../build/CMakeFiles/CMakeOutput.log".
See also "/home/.../build/CMakeFiles/CMakeError.log".
>>>>>>>>>>>>>



I got hold of the try_compile output and it contains the following info:

    $ strings -a a.out | grep INFO
    INFO:compiler[GNU]
    INFO:platform[AIX]
    INFO:arch[]
    INFO:dialect_default[90]
    INFO:compiler_version[00000004.00000000.00000000]

Yet, the CMakeError.log states: The C compiler identification could
not be found in "/home/.../build/CMakeFiles/3.6.3/CompilerIdC/a.out"

I followed this up to the file(STRING ...) command in
CMakeDetermineCompilerId.cmake and noticed that the command seems
unable to grep any strings out of any file:

    file(STRINGS CMakeLists.txt strs)
    message("strs: ${strs}")
    file(STRINGS a.out strs) # copied the CompilerIdC/a.out file to
the source tree
    message("strs: ${strs}")

Output is
strs:
strs:

So not even the CMakeLists.txt contained any strings according to
this. Reading the file with file(READ CMakeLists.txt strs) worked,
however. On my windows machine with CMake 3.6.2 it works as expected
with the same input files (copied from the AIX machine).

Meanwhile I tried to specify the compiler identification manually with
cmake -DCMAKE_C_COMPILER_ID=GNU, but the output is about the same,
including the "Unknown extension .c for file testCCompiler.c" message.
The CMakeError.log now only contains "Determining if the C compiler
works failed with the following output: [nothing]".

Any hints? Tell if you need any specific additional information, please.

Kind regards,
Jakob



More information about the CMake mailing list