An error is reported when compiling a software using bazel, and the error message is:
absl/base/policy_checks.h:79:2: error: #error “C++ versions less than C++14 are not supported.”
The entire compilation information is:
devil@hp:~/lab$ bazel build -c opt // :deepmind_lab.so INFO: Build option -- cxxopt has changed, discarding analysis cache. WARNING: Download from https: // mirror.bazel.build/github.com /glennrp/libpng/archive/v1.6.37.zip failed: class java.io.FileNotFoundException GET returned 404 Not Found DEBUG: Rule ' com_google_absl ' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = " cd8a6aed3682cd6a0330e0c11828254877531109d7bddc9331109d7bddc9 Repository com_google_absl instantiated at: /home/devil/lab/WORKSPACE: 18 : 13 : in <toplevel> Repository rule http_archive defined at: /home/devil/.cache/bazel/_bazel_devil/485f2e56923c3d722a11a1d362ce5e93/external/bazel_tools/tools/build_defs/repo/http.bzl: 355 : 31 : in <toplevel> DEBUG: Rule ' bazel_skylib ' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = " a9432ad1582da1dd8a2bcbbdaf11d887b38d97c226207b00471eeb2985576797 " DEBUG : Repository bazel_skylib instantiated at: / home/devil/lab/ in : WORK : SPACE : 12 Repository rule http_archive defined at: /home/devil/.cache/bazel/_bazel_devil/485f2e56923c3d722a11a1d362ce5e93/external/bazel_tools/tools/build_defs/repo/http.bzl: 355 : 31 : in <toplevel> INFO: Analyzed target // :deepmind_lab .so (0 packages loaded, 4197 targets configured). INFO: Found 1 target... ERROR: /home/devil/.cache/bazel/_bazel_devil/485f2e56923c3d722a11a1d362ce5e93/external/com_google_absl/absl/types/BUILD.bazel: 153 : 11 : Compiling absl/types/bad_optional_access.cc failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but- set -parameter -Wno-free-nonheap- object -fno-omit-frame-pointer -g0 -O2 ' -D_FORTIFY_SOURCE=1 ' -DNDEBUG -ffunction-sections ... (remaining 36 arguments skipped) Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging In file included from external/com_google_absl/absl/ base /config.h: 86 , fromexternal/com_google_absl/absl/types/bad_optional_access.h: 26 , from external/com_google_absl/absl/types/bad_optional_access.cc: 15 : external /com_google_absl/absl/ base /policy_checks.h: 79 : 2 : error: #error " C++ versions less than C++14 are not supported." 79 | #error "C++ versions less than C++14 are not supported." | ^~~~~ Target // :deepmind_lab.so failed to build Use -- verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 0.426s, Critical Path: 0 .26s INFO: 17 processes: 17 internal . FAILED: Build did NOT complete successfully
Solution:
Edit the file .bazelrc under home (this file generally does not exist in advance, you can save it directly after editing)
Fill in the content:
build –cxxopt=-std=c++14
Execute the compilation again and successfully pass:
Read More:
- Grpc Compilation issues: “C++ versions less than C++11 are not supported.
- [Solved] C++ Compile Error: prerequisites are different [How to Solve]
- Bazel error executing command /usr/bin/gcc @bazel-out/k8-fastbuild/bin/flashroute/flashroute-2.p
- [Solved] URIError: Failed to decode param ‘/%3C%=%20BASE_URL%20%3Estatic/index.%3C%=%20VUE_APP_INDEX_CSS_HASH%20%3E.css’
- [Solved] error C2041: illegal digit ‘9‘ for base ‘8‘ | error C2059: syntax error: ‘bad suffix on number‘
- [Solved] Software Compile Error: xdo.c:29:34: fatal error: X11/extensions/XTest.h:
- [Solved] Error: error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function
- [Solved] Opencv Compile Error: (CMake Error: The following variables are used in this project, but they are set to not)
- [Solved] fatal error C1083: Could Not Open Unable to open include file:“stdint.h”: No such file or directory
- [Solved] C++ Compile: error LNK2019: unresolved external “XX“
- [Solved] igb Compile Error: igb_main.c:10044:7: error: implicit declaration of function ‘isdigit’
- [Solved] ERROR_POLICY: attempt to perform an operation not allowed by the security policy `PDF‘ @ error/const
- [Solved] utils.c:33:18: fatal error: zlib.h: No such file or directory
- [Solved] fatal error C1083: Cannot open included files: “stdafx.h”: No such file or directory
- [Solved] winnt.h a large number of file errors (287): error c2059: syntax error: “;”
- [Solved] C + + compile Error: error: default argument given for parameter 3
- How to Solve Fatal error stdatomic in C/C++ Compilation
- C++ Compile Error: error: invalid conversion from ‘void*‘ to ‘char*‘ [-fpermissive]
- [Solved] MAC Compile Error: fatal error: ‘endian.h‘ file not found