The C++ compiler does not support C++11 during bootstrap for cmake


What is CMAKE?

CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice. 

You can download the latest cmake from https://cmake.org/download/

Prerequisites that I use

  • gnu-6.5
  • m4-1.4.18
  • gmp-6.1.0
  • mpfr-3.1.4
  • mpc-1.0.3
  • isl-0.18
  • gsl-2.1

Step 1: You can use the bootstrap which will default the cmake to default location ie /usr/local/. If you are using bootstrap,

# tar -zxvf cmake-3.21.3.tar.gz
# cd cmake-3.21.3 
# ./bootstrap 
# make 
# make install

Errors encountered

CMake 3.21.3, Copyright 2000-2021 Kitware, Inc. and Contributors
Found GNU toolchain
C compiler on this system is: gcc
C++ compiler on this system is: g++  -std=gnu++1y
Makefile processor on this system is: gmake
g++ has setenv
g++ has unsetenv
g++ does not have environ in stdlib.h
g++ has stl wstring
g++ has <ext/stdio_filebuf.h>
---------------------------------------------
gmake: Warning: File `Makefile' has modification time 0.15 s in the future
gmake: `cmake' is up to date.
gmake: warning:  Clock skew detected.  Your build may be incomplete.
loading initial cache file /myhome/melvin/Downloads/cmake-3.21.3/Bootstrap.cmk/InitialCacheFlags.cmake
CMake Error at CMakeLists.txt:107 (message):
  The C++ compiler does not support C++11 (e.g.  std::unique_ptr).


-- Configuring incomplete, errors occurred!
See also "/myhome/melvin/Downloads/cmake-3.21.3/CMakeFiles/CMakeOutput.log".
See also "/myhome/melvin/Downloads/cmake-3.21.3/CMakeFiles/CMakeError.log".

Resolutions:

Step 1: You may want to export this before compiling

export CXXFLAGS="-O3"

Step 2: You might want to move to an unmounted directory like /root and try compiling again with root access.

Alternatively, instead of using ./boostrap, you can use the traditional configure command

#./configure --prefix=/usr/local/cmake-3.21.3
# make
# make install

References:

  1. The C++ compiler does not support C++11 (e.g. std::unique_ptr). building OpenWRT
  2. c++11 std::unique_ptr error cmake 3.11.3 bootstrap

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.