View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015951CMakeCMakepublic2016-02-02 17:512016-06-10 14:21
ReporterKemin Zhou 
Assigned To 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformLinuxOSLinux CentosOS Version6.5
Product VersionCMake 3.4.3 
Target VersionFixed in Version 
Summary0015951: cannot configure cmake
DescriptionCannot pass the configuration step of cmake while trying to build cmake.
The problem is the the g++ compiler is in /usr/local
which g++
/usr/local/bin/g++

 g++ --version
g++ (GCC) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.

echo $CXX
/usr/local/bin/g++



./configure
---------------------------------------------
CMake 3.5.0-rc1, Copyright 2000-2016 Kitware, Inc.
C compiler on this system is: cc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C++ compiler on this system.
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /da/coding/download/cmake-3.5.0-rc1/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------

When I look into the log file:
I found the location and the reason for the failure:

cmake_bootstrap_12256_test.cxx:5:23: fatal error: iostream.h: No such file or directory
compilation terminated.
Test failed to compile
Try: /usr/local/bin/g++
Line: /usr/local/bin/g++ -DTEST3 cmake_bootstrap_12256_test.cxx -o cmake_bootstrap_12256_test

==== it is not using the include directory:
/usr/local/include/c++/5.3.0

CPLUS_INCLUDE_PATH=/usr/local/include/c++/5.3.0

the configuration script should add this variable to the make file.


Steps To ReproduceYou need to install the gcc to /usr/local
Additional InformationIt is the -I$CPLUS_INCLUDE_PATH
that is not being used by cmake
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0040431)
Brad King (manager)
2016-02-03 09:01

If you have your own toolchain installed then we expect that it can find its own standard libraries and include directories such that "g++ hello_world.cxx" can compile. You need to either set CPLUS_INCLUDE_PATH in your environment when using the compiler or get the compiler configured to know its own locations.
(0040433)
Kemin Zhou (reporter)
2016-02-03 13:15

The problem is that the configuration script of cmake (bootstrap)
is not picking up the environmental variable CPLUS_INCLUDE_PATH
At my end:

 echo $CPLUS_INCLUDE_PATH
/usr/local/include/c++/5.3.0

and cmake configuration is not using this include directory.
It should a simple fix on the configuration script.
(0040434)
Brad King (manager)
2016-02-03 13:38

Look at "man gcc". It says the compiler reads the CPLUS_INCLUDE_PATH environment variable. Scripts should not have to add any explicit -I options for it.

The "iostream.h" header check is not always expected to work. It is a platform introspection test. That entry in the log file may be a red herring. Please attach the log file here so we can see more.
(0040440)
Kemin Zhou (reporter)
2016-02-04 22:34

My compiler has no problem finding the header with other C++ projects. It only got stuck with cmake. Must be some configuration on my end.

Here is the full log.
I tried both 3.4.3 and 3.5.0, they had the exact same error.
cat Bootstrap.cmk/cmake_bootstrap.log
Try: cc
Line: cc cmake_bootstrap_27824_test.c -o cmake_bootstrap_27824_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;
}

------------------------------------------
1
Test succeeded
Try: /usr/local/bin/g++
Line: /usr/local/bin/g++ -DTEST1 cmake_bootstrap_27824_test.cxx -o cmake_bootstrap_27824_test
---------- file -----------------------

#if defined(TEST1)
# include <iostream>
#else
# include <iostream.h>
#endif

class NeedCXX
{
public:
  NeedCXX() { this->Foo = 1; }
  int GetFoo() { return this->Foo; }
private:
  int Foo;
};
int main()
{
  NeedCXX c;
#ifdef TEST3
  cout << c.GetFoo() << endl;
#else
  std::cout << c.GetFoo() << std::endl;
#endif
  return 0;
}

------------------------------------------
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
Test failed to compile
Try: /usr/local/bin/g++
Line: /usr/local/bin/g++ -DTEST2 cmake_bootstrap_27824_test.cxx -o cmake_bootstrap_27824_test
---------- file -----------------------

#if defined(TEST1)
# include <iostream>
#else
# include <iostream.h>
#endif

class NeedCXX
{
public:
  NeedCXX() { this->Foo = 1; }
  int GetFoo() { return this->Foo; }
private:
  int Foo;
};
int main()
{
  NeedCXX c;
#ifdef TEST3
  cout << c.GetFoo() << endl;
#else
  std::cout << c.GetFoo() << std::endl;
#endif
  return 0;
}

------------------------------------------
cmake_bootstrap_27824_test.cxx:5:23: fatal error: iostream.h: No such file or directory
compilation terminated.
Test failed to compile
Try: /usr/local/bin/g++
Line: /usr/local/bin/g++ -DTEST3 cmake_bootstrap_27824_test.cxx -o cmake_bootstrap_27824_test
---------- file -----------------------

#if defined(TEST1)
# include <iostream>
#else
# include <iostream.h>
#endif

class NeedCXX
{
public:
  NeedCXX() { this->Foo = 1; }
  int GetFoo() { return this->Foo; }
private:
  int Foo;
};
int main()
{
  NeedCXX c;
#ifdef TEST3
  cout << c.GetFoo() << endl;
#else
  std::cout << c.GetFoo() << std::endl;
#endif
  return 0;
}

------------------------------------------
cmake_bootstrap_27824_test.cxx:5:23: fatal error: iostream.h: No such file or directory
compilation terminated.
Test failed to compile
(0040441)
Brad King (manager)
2016-02-05 08:26

From the log:

> /usr/local/bin/g++ -DTEST1 cmake_bootstrap_27824_test.cxx -o cmake_bootstrap_27824_test
...
> /usr/bin/ld: cannot find -lgcc_s

That indicates the compiler cannot find its own runtime library to link into the program.
(0040484)
Kemin Zhou (reporter)
2016-02-13 12:57

the libgcc_s.so is located in /usr/local/lib64
For some reason, g++ could not find it. I put a symbolic link
in /usr/local/lib
this still did not help the g++. Basically, I cannot build cmake. Got stuck here. On my other computer this is not a problem. It must be something wrong with this particular computer. It is going to be hard to figure out the problem.
(0040485)
Kemin Zhou (reporter)
2016-02-13 13:02

Even putting /usr/local/lib64:/usr/local/lib
in the environmental variable LD_LIBRARY_PATH cannot help cmake test program to find the libgcc_s.so.

Even I solve the linking problem, the mechanism of locating the c++ includes is still another problem.
(0040486)
Kemin Zhou (reporter)
2016-02-13 14:26

I resolved the problem by reinstalling gcc! Somehow, GCC was not installed properly.
(0041254)
Kitware Robot (administrator)
2016-06-10 14:21

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2016-02-02 17:51 Kemin Zhou New Issue
2016-02-03 09:01 Brad King Note Added: 0040431
2016-02-03 13:15 Kemin Zhou Note Added: 0040433
2016-02-03 13:38 Brad King Note Added: 0040434
2016-02-04 22:34 Kemin Zhou Note Added: 0040440
2016-02-05 08:26 Brad King Note Added: 0040441
2016-02-13 12:57 Kemin Zhou Note Added: 0040484
2016-02-13 13:02 Kemin Zhou Note Added: 0040485
2016-02-13 14:26 Kemin Zhou Note Added: 0040486
2016-02-16 09:21 Brad King Status new => resolved
2016-02-16 09:21 Brad King Resolution open => no change required
2016-06-10 14:21 Kitware Robot Note Added: 0041254
2016-06-10 14:21 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team