CMake无法在安装GCC 6.3的情况下进行自举。 由于没有找到在GCC 5中删除的stdlib.h和iostream.h,检查C ++编译器的测试失败。
Bootstrap.cmk / cmake_bootstrap.log的输出:
Try: cc
Line: cc cmake_bootstrap_39083_test.c -o cmake_bootstrap_39083_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: g++
Line: g++ -DTEST1 cmake_bootstrap_39083_test.cxx -o cmake_bootstrap_39083_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;
}
------------------------------------------
In file included from /usr/include/c++/6.3.0/ext/string_conversions.h:41:0,
from /usr/include/c++/6.3.0/bits/basic_string.h:5402,
from /usr/include/c++/6.3.0/string:52,
from /usr/include/c++/6.3.0/bits/locale_classes.h:40,
from /usr/include/c++/6.3.0/bits/ios_base.h:41,
from /usr/include/c++/6.3.0/ios:42,
from /usr/include/c++/6.3.0/ostream:38,
from /usr/include/c++/6.3.0/iostream:39,
from cmake_bootstrap_39083_test.cxx:3:
/usr/include/c++/6.3.0/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
^
compilation terminated.
Test failed to compile
Try: g++
Line: g++ -DTEST2 cmake_bootstrap_39083_test.cxx -o cmake_bootstrap_39083_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_39083_test.cxx:5:23: fatal error: iostream.h: No such file or directory
# include <iostream.h>
^
compilation terminated.
Test failed to compile
Try: g++
Line: g++ -DTEST3 cmake_bootstrap_39083_test.cxx -o cmake_bootstrap_39083_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_39083_test.cxx:5:23: fatal error: iostream.h: No such file or directory
# include <iostream.h>
^
compilation terminated.
Test failed to compile
可以解决问题,更改cstdlib中的以下行:
#include_next <stdlib.h>
要:
#include <stdlib.h>