Youcompleteme: Your C++ compiler does NOT support C++11.

Created on 31 Mar 2017  Â·  29Comments  Â·  Source: ycm-core/YouCompleteMe

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside
the brackets) _before_ filing your issue:

  • [x ] I have read and understood YCM's CONTRIBUTING document.
  • [ x] I have read and understood YCM's CODE_OF_CONDUCT document.
  • [x ] I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • [x ] I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • [ ] If filing a bug report, I have included the output of vim --version.

  • [ ] If filing a bug report, I have included the output of :YcmDebugInfo.

  • [ ] If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • [ ] If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • [ ] If filing a bug report, I have included a minimal test case that reproduces
    my issue, including what I expected to happen and what actually happened.
  • [ ] If filing a installation failure report, I have included the entire output
    of install.py (or cmake/make/ninja) including its invocation
  • [ ] I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt _gift_ of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • [ ] I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

Provide a clear description of the problem, including the following key
questions:

  • What did you do?
    I was trying to install YCM on a Linux redhat system. I have properly updated my gcc and g++, but I keep getting the problem

Include steps to reproduce here.

Include description of a minimal test case, including any actual code required
to reproduce the issue.

  • What did you expect to happen?

Include description of the expected behaviour.

  • What actually happened?

Include description of the observed behaviour, including actual output,
screenshots, etc.
`YouCompleteMe]$ sudo ./install.py
Searching Python 2.6 libraries...
Found Python library: /usr/lib64/python2.6/config/libpython2.6.so
Found Python headers folder: /usr/include/python2.6
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- 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
-- 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
CMake Error at CMakeLists.txt:188 (message):
Your C++ compiler does NOT support C++11.

-- Configuring incomplete, errors occurred!
See also "/tmp/ycm_build_z67MXd/CMakeFiles/CMakeOutput.log".
ERROR: the build failed.`

Diagnostic data

Output of vim --version

Place the output here, or a link to a gist.
f-b for $VIMRUNTIME: "/usr/share/vim/vim74" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -g -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE -L/usr/local/lib -Wl,--as-needed -o vim -lm -lnsl -lselinux -ltinfo -lacl -lattr -lgpm -Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE -fstack-protector -L/usr/lib64/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc

Output of YcmDebugInfo

Place the output here, or a link to a gist.

Contents of YCM, ycmd and completion engine logfiles

Include link here to a gist containing the entire logfiles for ycm, ycmd
and any completer logfiles listed by :YcmToggleLogs.

OS version, distribution, etc.

Include system information here.

Output of build/install commands

Include link to a gist containing the invocation and entire output of
install.py if reporting an installation issue.

Most helpful comment

I achieved this without root privileges by building g++ as shown in this article.

I downloaded gcc-5.2.0.tar.gz from here: http://www.netgull.com/gcc/releases/gcc-5.2.0/

Then ran the following commands to extract and build it:

tar xzvf gcc-5.2.0.tar.gz
cd gcc-5.2.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-5.2.0/configure --prefix=$HOME/gcc-5.2.0 --enable-languages=c,c++,fortran,go
make
make install

And then built YCM by running:

#!/bin/bash CXX=~/gcc-5.2.0/bin/c++ ./install.py

All 29 comments

I am not sure how to run the instal.py with supplied gcc path.

I guess that specifying the CXX env variable would suffice

I am sorry that this is a stupid question because I have no experience in this area but how?

On Mar 31, 2017, at 3:45 PM, Andrea Cedraro notifications@github.com wrote:

I guess that specifying the CXX env variable would suffice

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/Valloric/YouCompleteMe/issues/2596#issuecomment-290811833, or mute the thread https://github.com/notifications/unsubscribe-auth/AGHn0NLPT8QVcbVs5UsxofJQpgNCpH2Nks5rrVftgaJpZM4MvqpS.

All you need to do is something like this:
CXX="/path/to/your/c++/compiler" ./install.py

Of course, you would still supply the appropriate install.py flags that you already tried.

I had tried to do that, but I guess it is still now gcc installation not working.
`
sudo CXX="xxxx/gcc-6-my/" ./install.py
Searching Python 2.6 libraries...
Found Python library: /usr/lib64/python2.6/config/libpython2.6.so
Found Python headers folder: /usr/include/python2.6
-- The C compiler identification is GNU 4.4.7
-- 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
-- Check for working CXX compiler: /home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my
-- Check for working CXX compiler: /home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my" is
not able to compile a simple test program.

It fails with the following output:

Change Dir: /tmp/ycm_build_S4CS7D/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec2062178959/fast"

/usr/bin/gmake -f CMakeFiles/cmTryCompileExec2062178959.dir/build.make
CMakeFiles/cmTryCompileExec2062178959.dir/build

gmake[1]: Entering directory `/tmp/ycm_build_S4CS7D/CMakeFiles/CMakeTmp'

/usr/bin/cmake -E cmake_progress_report
/tmp/ycm_build_S4CS7D/CMakeFiles/CMakeTmp/CMakeFiles 1

Building CXX object
CMakeFiles/cmTryCompileExec2062178959.dir/testCXXCompiler.cxx.o

/home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my -o
CMakeFiles/cmTryCompileExec2062178959.dir/testCXXCompiler.cxx.o -c
/tmp/ycm_build_S4CS7D/CMakeFiles/CMakeTmp/testCXXCompiler.cxx

gmake[1]: execvp: /home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my:
Permission denied

gmake[1]: Leaving directory `/tmp/ycm_build_S4CS7D/CMakeFiles/CMakeTmp'

gmake[1]: *
[CMakeFiles/cmTryCompileExec2062178959.dir/testCXXCompiler.cxx.o] Error 127

gmake: * [cmTryCompileExec2062178959/fast] Error 2`

-- The C compiler identification is GNU 4.4.7
-- 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
-- Check for working CXX compiler: /home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my
-- Check for working CXX compiler: /home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my -- broken

There are a few thing wrong here.

  1. It recognised your c++ compiler, but not c compiler and emitted the error.
  2. It says your c++ compiler is broken.

For the first problem, pass CC variable as a path to your c compiler as well.

For the second, I'm not completely sure, but is gcc-6-my a directoy or a g++ symlink? If it's a directory that's what's wrong. You have to pass the executable itself.

EDIT:

-- The CXX compiler identification is unknown

This is so wrong. If cmake can't identify the compiler it won't ever set the required variable and say that the compiler has C++11 capabilities.

Ok. I changed that and the process of install.py goes welll now. But I get the message "The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Unexpected error while loading the YCM core library. Use the ':YcmToggleLogs' command to check the logs.".
sudo CXX="/home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my/bin/g++" CC="/home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my/bin/gcc" ./install.py [sudo] password for xz84438: Searching Python 2.6 libraries... Found Python library: /usr/lib64/python2.6/config/libpython2.6.so Found Python headers folder: /usr/include/python2.6 -- The C compiler identification is GNU 6.3.0 -- The CXX compiler identification is GNU 6.3.0 -- Check for working C compiler: /home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my/bin/gcc -- Check for working C compiler: /home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my/bin/g++ -- Check for working CXX compiler: /home/stat/xz84438/extdata/xinlian/softwares/gcc-6-my/bin/g++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Found PythonLibs: /usr/lib64/python2.6/config/libpython2.6.so (found suitable version "2.6.6", minimum required is "2.6") NOT using libclang, no semantic completion for C/C++/ObjC will be available -- Found PythonInterp: /usr/bin/python (found version "2.6.6") -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Configuring done -- Generating done -- Build files have been written to: /tmp/ycm_build_xoCzgn Scanning dependencies of target BoostParts [ 0%] [ 1%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/gregorian_types.cpp.o [ 2%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/greg_weekday.cpp.o [ 2%] [ 3%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/date_generators.cpp.o [ 4%] [ 5%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/greg_month.cpp.o Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/posix_time/posix_time_types.cpp.o [ 5%] [ 6%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/system/src/error_code.cpp.o .......... [100%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierCompleter.cpp.o Building CXX object ycm/CMakeFiles/ycm_core.dir/CandidateRepository.cpp.o Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierDatabase.cpp.o Linking CXX shared library /home/stat/xz84438/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so [100%] Built target ycm_core

Use the ':YcmToggleLogs' command to check the logs.

Can you do that?

Why are you using sudo? You should not do this.

On 3 Apr 2017, at 22:17, Andrea Cedraro notifications@github.com wrote:

Use the ':YcmToggleLogs' command to check the logs.

Can you do that?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

No answer. Closing.

I had the same issue and resolved it by running sudo yum install gcc-c++

I achieved this without root privileges by building g++ as shown in this article.

I downloaded gcc-5.2.0.tar.gz from here: http://www.netgull.com/gcc/releases/gcc-5.2.0/

Then ran the following commands to extract and build it:

tar xzvf gcc-5.2.0.tar.gz
cd gcc-5.2.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-5.2.0/configure --prefix=$HOME/gcc-5.2.0 --enable-languages=c,c++,fortran,go
make
make install

And then built YCM by running:

#!/bin/bash CXX=~/gcc-5.2.0/bin/c++ ./install.py

@crclayton
When I follow your solution, it happens:

checking for uintmax_t... yes
checking for uintptr_t... yes
checking for int64_t underlying type... long long
configure: error: error verifying int64_t uses long long
make[2]: *** [configure-stage1-gcc] Error 1
make[2]: Leaving directory `/home/vagrant/test/objdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/vagrant/test/objdir'
make: *** [all] Error 2

Got the same issue here, fresh install, with all required dependencies installed, here is the error message:

 ./install.py --gocode-completer
Searching Python 2.7 libraries...
Found Python library: /usr/lib64/python2.7/config/libpython2.7.so
Found Python headers folder: /usr/include/python2.7
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- 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
-- 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
CMake Error at CMakeLists.txt:180 (message):
  Your C++ compiler does NOT fully support C++11.


-- Configuring incomplete, errors occurred!
See also "/tmp/ycm_build_mdm6Bl/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.

@zp-j

Your C++ compiler does NOT fully support C++11.

Use a more recent version of gcc.

Thanks @vheon, I manually installed gcc-5.2.0 and it worked out. It surprises me that YCM does not work with the latest gcc release in CentOS 7.3, probably it should be noted somewhere in the doc.

@zp-j we do not target any specific OS, and we have put the error message there for a reason.

I have pushed a PR to add a note to the build script for RHEL/CentOS users https://github.com/Valloric/ycmd/pull/775

Trying to do what @crclayton suggested. Getting further, but still getting an error. Any ideas?

CXX=~/gcc-5.2.0/bin/c++ ./install.py

Searching Python 2.7 libraries...
Found Python library: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
Found Python headers folder: /usr/include/python2.7
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 5.2.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
-- Check for working CXX compiler: /home/at/gcc-5.2.0/bin/c++
-- Check for working CXX compiler: /home/at/gcc-5.2.0/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PythonLibs: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so (found suitable version "2.7.6", minimum required is "2.6") 
NOT using libclang, no semantic completion for C/C++/ObjC will be available
-- Found PythonInterp: /usr/bin/python (found version "2.7.6") 
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found Git: /usr/bin/git (found version "1.9.1") 
-- git Version: v0.0.0
-- Version: 0.0.0
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WZERO_AS_NULL_POINTER_CONSTANT
-- Performing Test HAVE_CXX_FLAG_WZERO_AS_NULL_POINTER_CONSTANT - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- compiled but failed to run
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- compiled but failed to run
CMake Error at ycm/benchmarks/benchmark/CMakeLists.txt:183 (message):
  Failed to determine the source files for the regular expression backend


-- Configuring incomplete, errors occurred!
See also "/tmp/ycm_build_cCngM3/CMakeFiles/CMakeOutput.log".
See also "/tmp/ycm_build_cCngM3/CMakeFiles/CMakeError.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.

@a-torgovitsky what version of CMake do you have?

cmake version 2.8.12.2

@a-torgovitsky I got same problem

@a-torgovitsky I got the same problem too.

@a-torgovitsky @terrylove @elxy Did you export the LD_LIBRARY_PATH environment variables as explained in the article?

export LD_LIBRARY_PATH=~/gcc-5.2.0/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=~/gcc-5.2.0/lib64:$LD_LIBRARY_PATH

That's important because you also need a more recent version of the standard library stdlibc++ (one that implements std::regex) to build ycmd.

Thx @micbou. I just used CXX=/usr/bin/g++-5 ./install.py instead of CXX=/usr/bin/gcc-5 ./install.py and it worked out. My platform is openSUSE Leap 42.2.

Thanks @micbou I had missed that step. Now compiling finishes without error.

Sorry to ask this naive question but is "CXX='path to the c++ compiler' ./install.py" a shell command to run? I see the same issue that my system c++ compiler is old and need to redirect a newer version.

Yes, CXX='/some/path/to/the/compiler' would set an environment variable which cmake uses to choose your compiler.

I see the same issue that my system c++ compiler is old and need to redirect a newer version.

Set your path environment so that the new version is before the system one in the path. That said, this is basically tech support, which the issue tracker is not for. There is no ycm issue here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

beojan picture beojan  Â·  4Comments

ioeric picture ioeric  Â·  4Comments

d0u9 picture d0u9  Â·  4Comments

jwu26 picture jwu26  Â·  3Comments

blackode picture blackode  Â·  3Comments