Your C++ compiler does NOT fully support C++17

15.2k Views Asked by At
Searching Python 3.6 libraries...                                  
Found Python library: /home/luan/anaconda3/envs/za/lib/libpython3.6m.so
Found Python headers folder: /home/luan/anaconda3/envs/za/include/python3.6m
-- The C compiler identification is GNU 7.5.0             
-- The CXX compiler identification is GNU 7.5.0
-- 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/c++     
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info                 
-- Detecting CXX compiler ABI info - done                
-- Detecting CXX compile features          
-- Detecting CXX compile features - done       
CMake Error at CMakeLists.txt:232 (message):    
  **Your C++ compiler does NOT fully support C++17.**    
                                             
                                                
-- Configuring incomplete, errors occurred!
See also "/tmp/ycm_build_6b5ro8ju/CMakeFiles/CMakeOutput.log".
ERROR: the build failed.                
                                             
NOTE: it is *highly* unlikely that this is a bug but rather
that this is a problem with the configuration of your system
or a missing dependency. Please carefully read CONTRIBUTING.md
and if you're sure that it is a bug, please raise an issue on the
issue tracker, including the entire output of this script
and the invocation line used to run it.
4

There are 4 best solutions below

1
On BEST ANSWER

My solution: Install G++-8 (follow this answer https://askubuntu.com/a/1028656/987517)

sudo apt-get install g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8
1
On

As an alternative to setting gcc-8 as the default compiler as done in the accepted answer you can also pass environment variables to the installation command of YouCompleteMe, like so:

CC=gcc-8 CXX=g++-8 python3 ./install.py

Then you don't need to update the default gcc, if that is not wanted.

0
On

If you're using centos, you should install devtoolset-8

see Developer Toolset 8

sudo yum install centos-release-scl
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
sudo yum install devtoolset-8
scl enable devtoolset-8 bash
0
On

If you happen to be using gcc installed using Homebrew, the steps are slightly different:

> brew install gcc@8
> brew unlink gcc
> brew link gcc@8

(Homebrew has other versions of gcc, you can run brew search gcc to see them all.)

Note that, even if the gcc in your PATH points to your system gcc (e.g., /usr/bin/gcc), a setup/install/make script running in a different environment may still be seeing your Homebrew version of gcc. This is what happened to me, and the steps in @Luan Pham's answer didn't work as a result!