12

I am trying to bootstrap cmake 3.11.3 on Ubuntu 16.04.4 LTS xenial.

I have upgrade my gnu g++ compiler as follows:

> $ g++ --version
g++ (Ubuntu 8.1.0-5ubuntu1~16.04) 8.1.0 Copyright (C) 2018 Free
Software Foundation, Inc. This is free software; see the source for 
copying conditions.  There is NO warranty; not even for MERCHANTABILITY 
or FITNESS FOR A PARTICULAR PURPOSE.

And manually re-pointed the symbolic links:

$ ll /usr/bin/*g++*
lrwxrwxrwx 1 root root       5 Jun  8 16:57 /usr/bin/g++ -> g++-8*
-rwxr-xr-x 1 root root  919832 Apr 24 15:02 /usr/bin/g++-5*
lrwxrwxrwx 1 root root      22 Jun  6 04:26 /usr/bin/g++-8 -> x86_64-linux-gnu-g++-8*
lrwxrwxrwx 1 root root      22 Jun  8 16:58 /usr/bin/x86_64-linux-gnu-g++ -> x86_64-linux-gnu-g++-8*
lrwxrwxrwx 1 root root       5 Apr 24 15:02 /usr/bin/x86_64-linux-gnu-g++-5 -> g++-5*
-rwxr-xr-x 1 root root 1071984 Jun  6 04:26 /usr/bin/x86_64-linux-gnu-g++-8*

However, I get the following error in the configuration of cmake:

$ sudo ./bootstrap 
---------------------------------------------
CMake 3.11.3, Copyright 2000-2018 Kitware, Inc. and Contributors
Found GNU toolchain
C compiler on this system is: gcc       
C++ compiler on this system is: g++          
Makefile processor on this system is: make
g++ has setenv
g++ has unsetenv
g++ does not have environ in stdlib.h
g++ has stl wstring
g++ has <ext/stdio_filebuf.h>
---------------------------------------------
make: Warning: File 'Makefile' has modification time 2.3 s in the future
make: 'cmake' is up to date.
make: warning:  Clock skew detected.  Your build may be incomplete.
loading initial cache file /mnt/ganymede/user/gpeytavi/srv_admin/software/cmake-3.11.3/Bootstrap.cmk/InitialCacheFlags.cmake
CMake Error at CMakeLists.txt:92 (message):
  The C++ compiler does not support C++11 (e.g.  std::unique_ptr).


-- Configuring incomplete, errors occurred!
See also "/mnt/ganymede/user/gpeytavi/srv_admin/software/cmake-3.11.3/CMakeFiles/CMakeOutput.log".
See also "/mnt/ganymede/user/gpeytavi/srv_admin/software/cmake-3.11.3/CMakeFiles/CMakeError.log".
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------

Any idea why I get a c++11 std::unique_ptr non-compliant error?

Ela
  • 123
  • 1
  • 6
  • The mention of unique_ptr is probably just a red herring. Your make file needs to specify `-std=c++11` to enable c++11 syntax. If your compiler or make are too old to recognise this, then `-std=gnu++11` might work. – Gem Taylor Jun 08 '18 at 15:53

4 Answers4

6

In my case, the issue is because of the folder where I have CMake source code is in a mounted directory (in fact my entire rootfs is mounted over NFS) So, I looked in 'mount' command output and selected '/run/user/1000' location as a local location as this is mounted using tmpfs and moved my CMake source code to this location. with this, ./bootstrap && make && sudo make install executed successfully.

VidyaSagar
  • 61
  • 1
  • 1
  • 2
    This worked! I had no idea that I was trying to build cmake in a mounted directory, but after doing the same thing in ~/ it just worked! Thanks you. – Sixtina Aquafina Apr 20 '20 at 08:13
  • Can you provide more detail on what the problem is here? I am trying to build something that I only have enough room to do on an NFS mount, so moving it somewhere else isn't really an option. – HunterZ Mar 30 '21 at 04:16
4

Actually the ./bootstrap script does try the different C++ standard flags with the compiler. So it should detect its capabilities automatically.

Please make sure you don't have any CXXFLAGS environment variable set and try from scratch again (the messages/warnings you get indicate several tries/errors in the same directory).

Output when Successful

As a reference on my Ubuntu calling CMake's ./bootstrap looks like this:

---------------------------------------------
CMake 3.11.20180423, Copyright 2000-2018 Kitware, Inc. and Contributors
Warning: This is an in-source build
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: make
g++ has setenv
g++ has unsetenv
g++ does not have environ in stdlib.h
g++ has stl wstring
g++ has <ext/stdio_filebuf.h>
---------------------------------------------

Debugging

For debugging your problem you also could:

  • Call ./bootstrap --verbose
  • Look into Bootstrap.cmk/cmake_bootstrap.log

Known Problem

I only once had a problem with bootstrap using clang compilers where I needed to do the following call:

export CXXFLAGS=-Xclang -std=c++1z -Xclang -stdlib=libc++

Alternative

If you just want to install the latest version see How to specify where CMake is installed in Ubuntu?

Florian
  • 39,996
  • 9
  • 133
  • 149
  • 2
    Many thanks, the --verbose option gave me the hint. I had the Cmake files in a mounted drive and was trying to bootstrap from there. Apparently (from reasons I don't understand) this is not possible. – Ela Jun 13 '18 at 09:27
  • 4
    In case anyone else hits this, the reason is clock skew. If the timestamps on the network drive don't line up with local files, cmake will become very confused and tests will start failing. Build in a local directory and the error vanishes. – jcupitt Nov 09 '18 at 14:36
  • Yes, for me it was clock skew too. I was using a cluster computer that had no direct www connection but instead had to pull all data from a central server; and for some reason the clock was wrong. That was quite an annoying error. – shevy May 03 '19 at 15:51
0

I was able to resolve the issue by ensuring that both the build machine and the NFS file server were synchronized by running ntpd on both.

0

For me it was clock skew. I use the below command :

date -s "2021-11-30 15:08:21" 

to set the time to now for the server. Then it work, thanks...

PJ.Jing
  • 11
  • 3