Why do not ubuntu16.04 on TX2 support C++11?

I want to generate cmake using source code on ubuntu16.04 based on TX2, but when I run ./bootstrap, the cmake can not be generated and the system give out “The C++ compiler does not support c++11(e.g. std::unique_ptr” message. My GCC version is 5.4.0 20160609(Ubuntu/linaro 5.4.0-6ubuntu1~16.04.9), does not it suppport c++11?

That isn’t the Jetson supporting or not supporting, it is the tool. In your case the tool very likely does support this, but you need to tell it to use C++11. See if “-std=c++11” works:

g++ ...whatever... <b>-std=c++11</b> ...whatever...

FYI, there is some code, which if it links directly to the GPU driver, which will accept C++11 talking to it, but won’t accept the ABI of gcc version 7 or higher (and some older drivers not accepting gcc version 6 or higher). So far as I know version 5 should always work with current or semi-current drivers.

Note that if you are using a version 4 gcc (you said version 5), then this does not support C++11.

On my R28.2-DP, it seems I have the same compiler and bootstrap works fine:

nvidia@tegra-ubuntu:/media/nvidia/Data/cmake/cmake-3.12.0-rc2$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/5/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.10' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-arm64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-arm64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-arm64 --with-arch-directory=aarch64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.10) 

nvidia@tegra-ubuntu:/media/nvidia/Data/cmake/cmake-3.12.0-rc2$ ./bootstrap 
---------------------------------------------
CMake 3.12.0-rc2, Copyright 2000-2018 Kitware, Inc. and Contributors
Found GNU toolchain
C compiler on this system is: gcc       
C++ compiler on this system is: g++  -std=gnu++17        
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>
---------------------------------------------
g++  -std=gnu++17            -I/media/nvidia/Data/cmake/cmake-3.12.0-rc2/Bootstrap.cmk   -I/media/nvidia/Data/cmake/cmake-3.12.0-rc2/Source   -I/media/nvidia/Data/cmake/cmake-3.12.0-rc2/Source/LexerParser   -I/media/nvidia/Data/cmake/cmake-3.12.0-rc2/Utilities  -c /media/nvidia/Data/cmake/cmake-3.12.0-rc2/Source/cmAddCustomCommandCommand.cxx -o cmAddCustomCommandCommand.o
...

Have you installed other versions of gcc or another compiler ?

Did you start from a clean source tree or copied a directory where it had already been built for another architecture ?

Hi,Honey_patouceul.
Thank you very much.
My g++ -std=gnu++1z is diffrent from your ++17.

In my case, the bootstrap script finished without error, however I think it has flaw and did not configure correctly, I faced some errors later with make (furthermore I don’t think -std=gnu++17 is ok for our gcc version).

I have been able to build with these commands:

# Build will be long so activate all 6 cores for parallel build
sudo nvpmodel -m0

# Save clocks config for restoring after build
sudo /home/nvidia/jetson_clocks.sh --store

# Boost clocks
sudo /home/nvidia/jetson_clocks.sh

# Run bootstrap forcing compilers and activating parallel build
CC=gcc CXX=g++ CXXFLAGS=-std=gnu++1z ./bootstrap --parallel=6

# build
make -j6

# Once done you may run tests (this may take hours)
make -j6 test

# If ok install your new cmake-3.12 on your system
sudo make install 

# Done. Restore normal clocks config so that fan will slow down 
sudo /home/nvidia/jetson_clocks.sh --restore

Additional note: I got some failing tests:

Total Test time (real) = 3145.66 sec

The following tests FAILED:
	146 - CPackComponentsDEB-components-source (Failed)
	147 - CPackComponentsDEB-components-shlibdeps1 (Failed)
	149 - CPackComponentsDEB-components-depend2 (Failed)
	163 - Qt4And5AutomocReverse (Failed)
	283 - CMakeOnly.AllFindModules (Failed)
	451 - RunCMake.CPack_DEB (Failed)
	452 - RunCMake.CPack_RPM (Failed)
Errors while running CTest

The DEB related tests passed after I’ve added read access for all to file /etc/ld.so.conf.d/zed.conf:

sudo chmod a+r /etc/ld.so.conf.d/zed.conf

If you don’t have ZED camera software it should not be a concern.

CMakeOnly.AllFindModules test requires environment variable FREETYPE_DIR to be defined, for example:

export FREETYPE_DIR=/usr

RunCMake.CPack_RPM fails because debuginfo has dependency to elfutils. Fixed after installing the package:

sudo apt-get install elfutils

Not found yet the cause of failing Qt4And5AutomocReverse test, but if you see it you may investigate with something like this:

./bin/ctest -V -R Qt4And5AutomocReverse

[EDIT: Seems that there was a mismatch where running Qt4And5AutomocReverse test it was using Qt4And5Automoc folder and didn’t generate files into Tests/Qt4And5AutomocReverse.
I have restarted from scratch, and run the above command ./bin/ctest -V -R Qt4And5AutomocReverse before make test. It generated files into Tests/Qt4And5AutomocReverse folder and showed success this time…(in fact there was no test really run, so it’s mainly a test suite failure).
Further reported here.]

Finally, my feeling is that the bootstrap has some flaws.

I have configured a new build with cmake-3.5.1 and everything went fine, so this would be my best advice.

[EDIT: Not sure my answer was very clear. What I did was using cmake-3.5.1 (installed from apt) for configuring the cmake-3.12.0-rc2 build. Use the bootstrap only if there is no available cmake version for your system.]

Hi,Honey_Patouceul.
Thank you very much.
Acoording to your advice, I have configured to cmake-3.5.1 also. This version can work normally.