gcc-4.8无法编译测试程序?
问题描述:
我已经在Ubuntu 16.04上安装了gcc-4.8来构建一个C++ 11程序。我有一个CMakeList.txt
文件,在Mac OS X操作系统上使用Clang和GCC 4.8可以很好地工作。gcc-4.8无法编译测试程序?
我开始通过设置CXX=/usr/bin/gcc-4.8
然后CMake的失败,出现以下错误:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/gcc-4.8
-- Check for working CXX compiler: /usr/bin/gcc-4.8 -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/usr/bin/gcc-4.8" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: /home/ruipacheco/databaseclient/cpp/ninja/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_5df0c/fast"
/usr/bin/make -f CMakeFiles/cmTC_5df0c.dir/build.make
CMakeFiles/cmTC_5df0c.dir/build
make[1]: Entering directory
'/home/ruipacheco/databaseclient/cpp/ninja/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_5df0c.dir/testCXXCompiler.cxx.o
/usr/bin/gcc-4.8 -o CMakeFiles/cmTC_5df0c.dir/testCXXCompiler.cxx.o -c
/home/ruipacheco/databaseclient/cpp/ninja/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
gcc-4.8: error trying to exec 'cc1plus': execvp: No such file or directory
CMakeFiles/cmTC_5df0c.dir/build.make:65: recipe for target
'CMakeFiles/cmTC_5df0c.dir/testCXXCompiler.cxx.o' failed
make[1]: *** [CMakeFiles/cmTC_5df0c.dir/testCXXCompiler.cxx.o] Error 1
make[1]: Leaving directory
'/home/ruipacheco/databaseclient/cpp/ninja/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_5df0c/fast' failed
make: *** [cmTC_5df0c/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:6 (project)
-- Configuring incomplete, errors occurred!
同样,我知道gcc-4.8
有能力建造C++ 11个的程序,我已经成功地使这个CMakeLists.txt
档案工作在OSX上使用gcc 4.8,那么我可能会错过什么?
也许正则表达式的支持? –
版本5之前的C++ 11支持仍然不完整。你为什么决定选择这样一个旧版本(现在已经超过7个)? –
请[编辑]你的问题提供[mcve]。 –