Cmake not running on AIX 7.1,7.2

i have a very simple test cmake project which i am trying to build on aix 7.2. its as simple as it gets.

cmake_minimum_required(VERSION 3.10)

project(myapp LANGUAGES CXX)

add_executable(myapp myapp.cpp)

when i run Cmake . there is an attempt to detect the aix Xlc compiler (as thats what i need to use and i know works and is installed correctly) however i get the following and cmake doesnt build the makefiles.

-- The C compiler identification is unknown
-- The CXX compiler identification is XL 16.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /opt/IBM/xlC/16.1.0/bin/cc
-- Check for working C compiler: /opt/IBM/xlC/16.1.0/bin/cc - broken
CMake Error at /opt/freeware/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/opt/IBM/xlC/16.1.0/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /data/js/cmaketest/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/local/bin/gmake -f Makefile cmTC_b4d42/fast && /usr/local/bin/gmake  -f CMakeFiles/cmTC_b4d42.dir/build.make CMakeFiles/cmTC_b4d42.dir/build
    gmake[1]: Entering directory '/data/js/cmaketest/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_b4d42.dir/testCCompiler.c.o
    /opt/IBM/xlC/16.1.0/bin/cc    -o CMakeFiles/cmTC_b4d42.dir/testCCompiler.c.o -c /data/js/cmaketest/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_b4d42
    /opt/freeware/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b4d42.dir/link.txt --verbose=1
    /opt/IBM/xlC/16.1.0/bin/cc CMakeFiles/cmTC_b4d42.dir/testCCompiler.c.o -o cmTC_b4d42  /usr/lib /lib
    ld: 0711-168 SEVERE ERROR: Input file: /usr/lib
        Input files must be regular files.
    CMakeFiles/cmTC_b4d42.dir/build.make:98: recipe for target 'cmTC_b4d42' failed
    gmake[1]: *** [cmTC_b4d42] Error 12
    gmake[1]: Leaving directory '/data/js/cmaketest/CMakeFiles/CMakeTmp'
    Makefile:127: recipe for target 'cmTC_b4d42/fast' failed
    gmake: *** [cmTC_b4d42/fast] Error 2





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


-- Configuring incomplete, errors occurred!
See also "/data/js/cmaketest/CMakeFiles/CMakeOutput.log".
See also "/data/js/cmaketest/CMakeFiles/CMakeError.log".
-bash-5.1$

It looks like link directories are being passed without flags?

Cc: @brad.king

The first problem visible in the output is:

-- The C compiler identification is unknown

Once that compiler identification fails, CMake doesn’t know what compiler flags to pass for anything later.

The CMakeFiles/CMakeError.log file mentioned at the end of the output may have details about the failure of the compiler identification step.

I cant upload the log file so am pasting it in here. Looks like for some reason xlC is failing to compiler the compiler identification code, its a bit odd as the version of XLC does support single line comment. I have pasted the lines the error mentions into a standalone c module and they do compile.

CMakeError.log
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags:

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -c

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -Aa

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -D__CLASSIC_C__

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: --target=arm-arm-none-eabi;-mcpu=cortex-m3

The output was:

1

/opt/IBM/xlC/16.1.0/bin/.orig/cc: 1501-216 (W) command option --target=arm-arm-none-eabi is not recognized - passed to ld

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -c;-I__does_not_exist__

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags:

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -c

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -Aa

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -D__CLASSIC_C__

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: --target=arm-arm-none-eabi;-mcpu=cortex-m3

The output was:

1

/opt/IBM/xlC/16.1.0/bin/.orig/cc: 1501-216 (W) command option --target=arm-arm-none-eabi is not recognized - passed to ld

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -c;-I__does_not_exist__

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler":

/opt/IBM/xlC/16.1.0/bin/.orig/cc: 1501-294 (S) No input file specified. Please use -qhelp for more information.

Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler":

/opt/IBM/xlC/16.1.0/bin/.orig/cc: 1501-294 (S) No input file specified. Please use -qhelp for more information.

Detecting C compiler ABI info failed to compile with the following output:

Change Dir: /data/js/cmaketest/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/local/bin/gmake -f Makefile cmTC_04415/fast && /usr/local/bin/gmake -f CMakeFiles/cmTC_04415.dir/build.make CMakeFiles/cmTC_04415.dir/build

gmake[1]: Entering directory '/data/js/cmaketest/CMakeFiles/CMakeTmp'

Building C object CMakeFiles/cmTC_04415.dir/CMakeCCompilerABI.c.o

/opt/IBM/xlC/16.1.0/bin/cc -o CMakeFiles/cmTC_04415.dir/CMakeCCompilerABI.c.o -c /opt/freeware/share/cmake-3.22/Modules/CMakeCCompilerABI.c

Linking C executable cmTC_04415

/opt/freeware/bin/cmake -E cmake_link_script CMakeFiles/cmTC_04415.dir/link.txt --verbose=1

/opt/IBM/xlC/16.1.0/bin/cc CMakeFiles/cmTC_04415.dir/CMakeCCompilerABI.c.o -o cmTC_04415 /usr/lib /lib

ld: 0711-168 SEVERE ERROR: Input file: /usr/lib

Input files must be regular files.

CMakeFiles/cmTC_04415.dir/build.make:98: recipe for target 'cmTC_04415' failed

gmake[1]: *** [cmTC_04415] Error 12

gmake[1]: Leaving directory '/data/js/cmaketest/CMakeFiles/CMakeTmp'

Makefile:127: recipe for target 'cmTC_04415/fast' failed

gmake: *** [cmTC_04415/fast] Error 2

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

Change Dir: /data/js/cmaketest/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/local/bin/gmake -f Makefile cmTC_8298e/fast && /usr/local/bin/gmake -f CMakeFiles/cmTC_8298e.dir/build.make CMakeFiles/cmTC_8298e.dir/build

gmake[1]: Entering directory '/data/js/cmaketest/CMakeFiles/CMakeTmp'

Building C object CMakeFiles/cmTC_8298e.dir/testCCompiler.c.o

/opt/IBM/xlC/16.1.0/bin/cc -o CMakeFiles/cmTC_8298e.dir/testCCompiler.c.o -c /data/js/cmaketest/CMakeFiles/CMakeTmp/testCCompiler.c

Linking C executable cmTC_8298e

/opt/freeware/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8298e.dir/link.txt --verbose=1

/opt/IBM/xlC/16.1.0/bin/cc CMakeFiles/cmTC_8298e.dir/testCCompiler.c.o -o cmTC_8298e /usr/lib /lib

ld: 0711-168 SEVERE ERROR: Input file: /usr/lib

Input files must be regular files.

CMakeFiles/cmTC_8298e.dir/build.make:98: recipe for target 'cmTC_8298e' failed

gmake[1]: *** [cmTC_8298e] Error 12

gmake[1]: Leaving directory '/data/js/cmaketest/CMakeFiles/CMakeTmp'

Makefile:127: recipe for target 'cmTC_8298e/fast' failed

gmake: *** [cmTC_8298e/fast] Error 2

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags:

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -c

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -Aa

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -D__CLASSIC_C__

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: --target=arm-arm-none-eabi;-mcpu=cortex-m3

The output was:

1

/opt/IBM/xlC/16.1.0/bin/.orig/cc: 1501-216 (W) command option --target=arm-arm-none-eabi is not recognized - passed to ld

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -c;-I__does_not_exist__

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags:

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -c

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -Aa

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -D__CLASSIC_C__

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: --target=arm-arm-none-eabi;-mcpu=cortex-m3

The output was:

1

/opt/IBM/xlC/16.1.0/bin/.orig/cc: 1501-216 (W) command option --target=arm-arm-none-eabi is not recognized - passed to ld

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

Compiler: /opt/IBM/xlC/16.1.0/bin/cc

Build flags:

Id flags: -c;-I__does_not_exist__

The output was:

1

"CMakeCCompilerId.c", line 758.2: 1506-275 (S) Unexpected text '/' encountered.

"CMakeCCompilerId.c", line 758.13: 1506-045 (S) Undeclared identifier _MSC_VER.

"CMakeCCompilerId.c", line 757.46: 1506-221 (S) Initializer must be a valid constant expression.

"CMakeCCompilerId.c", line 758.66: 1506-209 (S) Character constants must end before the end of a line.

"CMakeCCompilerId.c", line 758.39: 1506-076 (W) Character constant 's MSVC compatibility mode.' has more than 4 characters. No more than rightmost 4 characters are used.

"CMakeCCompilerId.c", line 758.23: 1506-277 (S) Syntax error: possible missing ';' or ','?

Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler":

/opt/IBM/xlC/16.1.0/bin/.orig/cc: 1501-294 (S) No input file specified. Please use -qhelp for more information.

Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler":

/opt/IBM/xlC/16.1.0/bin/.orig/cc: 1501-294 (S) No input file specified. Please use -qhelp for more information.

Detecting C compiler ABI info failed to compile with the following output:

Change Dir: /data/js/cmaketest/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/local/bin/gmake -f Makefile cmTC_f124f/fast && /usr/local/bin/gmake -f CMakeFiles/cmTC_f124f.dir/build.make CMakeFiles/cmTC_f124f.dir/build

gmake[1]: Entering directory '/data/js/cmaketest/CMakeFiles/CMakeTmp'

Building C object CMakeFiles/cmTC_f124f.dir/CMakeCCompilerABI.c.o

/opt/IBM/xlC/16.1.0/bin/cc -o CMakeFiles/cmTC_f124f.dir/CMakeCCompilerABI.c.o -c /opt/freeware/share/cmake-3.22/Modules/CMakeCCompilerABI.c

Linking C executable cmTC_f124f

/opt/freeware/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f124f.dir/link.txt --verbose=1

/opt/IBM/xlC/16.1.0/bin/cc CMakeFiles/cmTC_f124f.dir/CMakeCCompilerABI.c.o -o cmTC_f124f /usr/lib /lib

ld: 0711-168 SEVERE ERROR: Input file: /usr/lib

Input files must be regular files.

CMakeFiles/cmTC_f124f.dir/build.make:98: recipe for target 'cmTC_f124f' failed

gmake[1]: *** [cmTC_f124f] Error 12

gmake[1]: Leaving directory '/data/js/cmaketest/CMakeFiles/CMakeTmp'

Makefile:127: recipe for target 'cmTC_f124f/fast' failed

gmake: *** [cmTC_f124f/fast] Error 2

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

Change Dir: /data/js/cmaketest/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/local/bin/gmake -f Makefile cmTC_8d25a/fast && /usr/local/bin/gmake -f CMakeFiles/cmTC_8d25a.dir/build.make CMakeFiles/cmTC_8d25a.dir/build

gmake[1]: Entering directory '/data/js/cmaketest/CMakeFiles/CMakeTmp'

Building C object CMakeFiles/cmTC_8d25a.dir/testCCompiler.c.o

/opt/IBM/xlC/16.1.0/bin/cc -o CMakeFiles/cmTC_8d25a.dir/testCCompiler.c.o -c /data/js/cmaketest/CMakeFiles/CMakeTmp/testCCompiler.c

Linking C executable cmTC_8d25a

/opt/freeware/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8d25a.dir/link.txt --verbose=1

/opt/IBM/xlC/16.1.0/bin/cc CMakeFiles/cmTC_8d25a.dir/testCCompiler.c.o -o cmTC_8d25a /usr/lib /lib

ld: 0711-168 SEVERE ERROR: Input file: /usr/lib

Input files must be regular files.

CMakeFiles/cmTC_8d25a.dir/build.make:98: recipe for target 'cmTC_8d25a' failed

gmake[1]: *** [cmTC_8d25a] Error 12

gmake[1]: Leaving directory '/data/js/cmaketest/CMakeFiles/CMakeTmp'

Makefile:127: recipe for target 'cmTC_8d25a/fast' failed

gmake: *** [cmTC_8d25a/fast] Error 2

some more info after digging in a bit more, if i compile the CMakeCCompilerId.c manually with xlC then it does compile, however compiling with cc it fails.

Whats odd and i have checked and checked this is that cc is a soft link to xlC (see below) i wonder if the xlC compiler is compiling to a different standard when invoked as cc

-bash-5.1$ which cc
/opt/IBM/xlC/16.1.0/bin/cc
-bash-5.1$ which xlC
/opt/IBM/xlC/16.1.0/bin/xlC
-bash-5.1$ ls -l /opt/IBM/xlC/16.1.0/bin/cc
lrwxrwxrwx 1 root system 3 24 Apr 10:04 /opt/IBM/xlC/16.1.0/bin/cc → xlC
-bash-5.1$ ls -l /opt/IBM/xlC/16.1.0/bin/xlC
-rwxr-xr-x 1 root system 677 28 Sep 2022 /opt/IBM/xlC/16.1.0/bin/xlC
-bash-5.1$

More info.

from the IBM XLC documentation:

cc

This command supports pre-ANSI C, and many common language extensions. You can use this command to compile legacy code that does not conform to standard C.

if i set CC=c99 and then run cmake . then the project compiles and does indeed work.

this does unblock me but i guess isnt ideal

FWIW, on one of our nightly testing machines with AIX 7.2:

$ export PATH=/opt/IBM/xlC/16.1.0/bin:$PATH
$ type -p cc
/opt/IBM/xlC/16.1.0/bin/cc
$ ls -l /opt/IBM/xlC/16.1.0/bin/cc
lrwxrwxrwx  ...  /opt/IBM/xlC/16.1.0/bin/cc -> xlC
$ cmake ../src
-- The C compiler identification is XL 16.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/IBM/xlC/16.1.0/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
...
$ cc CMakeFiles/*/CompilerIdC/CMakeCCompilerId.c && echo works
works

Did anyone else manage to get past this? I am seeing the exact same issue, with the same output as @tmx1835. XLC 16.1, cmake 3.22 from the IBM repo. AIX 7.3, but that shouldn’t matter.

@brad.king Do you have a working example of a CMakeLists.txt that works on AIX? This seems to be a fairly widespread issue, and it seems as though the IBM build of cmake may be broken.

Thank you.

CMake’s entire test suite runs on AIX 7.2 every night and passes. Several XL and XLClang compiler versions are covered, including version 16.1.0 of both.

The errors discussed above are unrelated to the particulars of any one CMakeLists.txt file.

Something seems to be wrong with the installation or configuration of the compiler on the machines in question.

Hi there!
I think there is an issue with the IBM-supplied cmake 3.22. I built the latest 3.26.4 from source and it works just fine. I reported the issue to IBM.

Thank you!

Hi @bhuntsman,

Do you have instructions or special AIX settings you used when you built cmake 3.26.4 from source? I was trying to build cmake 3.25.1 from source on AIX 7.1 but got the following errors show below from the ./bootstrap command:

gunzip cmake-3.25.1.tar.gz

tar xf cmake-3.25.1.tar

cd cmake-3.25.1

./bootstrap


CMake 3.25.1, Copyright 2000-2022 Kitware, Inc. and Contributors

Found XL toolchain

C compiler on this system is: xlc


Error when bootstrapping CMake:

Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.

Please specify one using environment variable CXX.

The C++ flags are “”.

They can be changed using the environment variable CXXFLAGS.

See cmake_bootstrap.log for compilers attempted.


Log of errors: /home1/hub/ghenry/cmake-3.25.1/Bootstrap.cmk/cmake_bootstrap.log


Before I go down this rabbit hole, I thought you might have some good instructions on how you were able to build 3.26.4 from source.

Thanks!

bootstrap might not support XL (I’m not sure), but you can use another cmake to configure and build a newer CMake itself.

For bootstrap, you would be best off using xlclang and xlclang++.

@ben.boeckel ,Thanks for the suggestion of using another cmake to configure and build a newer cmake. I tried to install one of the older builds of cmake from cmake is now available on AIX Toolbox but using yum and rpm there were a lot of unsatisfied dependencies I did not want to deal with because dependencies usually end up having other dependencies, thus the rabbit hole. If you have instructions on how to install an older version I would be more than happy to try it.

@kyle.edwards , I would like to try your suggestion. Would you happen to have an example using xlclang and xlclang++? Thanks.

export CC=/path/to/xlclang CXX=/path/to/xlclang++
./bootstrap

@kyle.edwards , I checked the version of my cc and xlc and it appears I have version 11.1:

cc -qversion
IBM XL C/C++ for AIX, V11.1 (5724-X13)
Version: 11.01.0000.0003

xlc -qversion
IBM XL C/C++ for AIX, V11.1 (5724-X13)
Version: 11.01.0000.0003

So I set the following:

export CC=/usr/vacpp/bin/cc CXX=/usr/vacpp/bin/xlc

But when I run bootstrap I get the following error saying: Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.:

---------------------------------------------
CMake 3.25.1, Copyright 2000-2022 Kitware, Inc. and Contributors
C compiler on this system is: /usr/vacpp/bin/cc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
Please specify one using environment variable CXX.
The C++ flags are "".
They can be changed using the environment variable CXXFLAGS.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------

If you happen to know what I am doing wrong or how to resolve this I would appreciate it. Thanks!

xlc is a C compiler. Use xlC (with capital C) for C++:

export CC=/usr/vacpp/bin/xlc CXX=/usr/vacpp/bin/xlC

@brad.king , Same error with uppercase C:

xlC -qversion
IBM XL C/C++ for AIX, V11.1 (5724-X13)
Version: 11.01.0000.0003

export CC=/usr/vacpp/bin/xlc CXX=/usr/vacpp/bin/xlC
./bootstrap
---------------------------------------------
CMake 3.25.1, Copyright 2000-2022 Kitware, Inc. and Contributors
C compiler on this system is: /usr/vacpp/bin/xlc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
Please specify one using environment variable CXX.
The C++ flags are "".
They can be changed using the environment variable CXXFLAGS.

Any other suggestions?

Please try xlclang:

export CC=/usr/vacpp/bin/xlclang CXX=/usr/vacpp/bin/xlclang++