Cmake installation is failing

2

I'm trying to install CMake in Linux (RHEL). When I run the bootstrap script it throws following error:

---------------------------------------------
CMake 3.5.2, Copyright 2000-2016 Kitware, Inc.
Found GNU toolchain
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C compiler on this system.
Please specify one using environment variable CC.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /usr/cmake-3.5.2/Bootstrap.cmk/cmake_bootstrap.log


**Contents of the log file are as follows**

Checking for GNU toolchain
Try: gcc
Line: gcc  cmake_bootstrap_5875_test.c -o cmake_bootstrap_5875_test
----------  file   -----------------------
int main() { return 0; }
------------------------------------------
Test succeeded
Try: g++
Line: g++  cmake_bootstrap_5875_test.cpp -o cmake_bootstrap_5875_test
----------  file   -----------------------
int main() { return 0; }
------------------------------------------
Test succeeded
Try: gcc
Line: gcc  cmake_bootstrap_5875_test.c -o cmake_bootstrap_5875_test
----------  file   -----------------------
#ifdef __cplusplus
# error "The CMAKE_C_COMPILER is set to a C++ compiler"
#endif
#include<stdio.h>
#if defined(__CLASSIC_C__)
int main(argc, argv)
  int argc;
  char* argv[];
#else
int main(int argc, char* argv[])
#endif
{
  printf("%d%c", (argv != 0), (char)0x0a);
  return argc-1;
}
------------------------------------------
cmake_bootstrap_5875_test.c:6:18: error: stdio.h: No such file or directory
cmake_bootstrap_5875_test.c: In function 'main':
cmake_bootstrap_5875_test.c:16: warning: incompatible implicit declaration of built-in function 'printf'
Test failed to compile

I have gcc and g++ installed in the directory /usr/bin/.

Can anyone help me resolve this issue please?

Kranti Kumar

Posted 2016-07-12T13:57:21.533

Reputation: 21

Answers

1

Read the error logs:

cmake_bootstrap_5875_test.c:6:18: error: stdio.h: No such file or directory

Looks like the header files for the C library are not (properly) installed. They should have been installed automatically along with GCC. Did you install GCC manually? Check whether package "glibc-devel" is installed.

sleske

Posted 2016-07-12T13:57:21.533

Reputation: 19 887

I have installed gcc manually, glibc-devel is also installed in server, still getting the same error – Kranti Kumar – 2016-07-12T14:53:53.027

@KrantiKumar: Then don't install gcc manually, use RHEL's package. – sleske – 2016-07-12T15:53:07.050

HI, I have re-installed gcc and glibc-devel now it is working fine. Thank you. – Kranti Kumar – 2016-07-12T16:50:39.817