tensorflow: gcc: error: unrecognized command line option '-std=c++14'

I’m trying to build on CentOS, but it fails:

INFO: Analyzed 4 targets (305 packages loaded, 27773 targets configured).
INFO: Found 4 targets...
INFO: Deleting stale sandbox base /home/xx/.cache/bazel/_bazel_xx/aee6fd7a0bb70a6e710bf5cf6db40de3/sandbox
ERROR: /home/xx/tensorflow-build/tensorflow/core/BUILD:386:1: C++ compilation of rule '//tensorflow/core:util_port' failed (Exit 1)
gcc: error: unrecognized command line option '-std=c++14'
INFO: Elapsed time: 13.712s, Critical Path: 0.21s
INFO: 17 processes: 17 local.
FAILED: Build did NOT complete successfully

Why is the C++ option -std=c++14 passed to gcc?

rev.e627965 gcc-9.2.0 CentOS 7.6.1810

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

Compiled latest master 2.4 successfully on CentOS 7.8 after having this error (and another one about gcc and libstdc++.so.6).

All steps I’ve done (relevant one specific to this ticket is highlighted):

  1. Upgrade to latest GCC by compiling from source. This guide is nice, but remember to reload PATH after install before checking the new version
  2. Check sudo find / -name "libstdc++.so.6*" and point /lib64/libstdc++.so.6 to the latest version, in my case (ref) cp /usr/local/lib64/libstdc++.so.6.0.24 /usr/lib64/ mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.OLD ln -s /usr/lib64/libstdc++.so.6.0.24 /usr/lib64/libstdc++.so.6
  3. Edit .bazelrc, line 300,301 (ref) : build:linux --cxxopt=-std=c++1y build:linux --host_cxxopt=-std=c++1y