Failed to build r2.12 from sources (ShardedLRUCache)
Hi @aquirin ,

GCC 13.1.0 not a tested configuration for TF2.12 and I am not sure of compatibility as it is not yet tested by TF team atleast for Tf2.12 version. Please find the Tested build configurations source [here](https://www.tensorflow.org/install/source#linux).



Version | Python version | Compiler | Build tools
-- | -- | -- | --
tensorflow-2.12.0 | 3.8-3.11 | GCC 9.3.1 | Bazel 5.3.0


I request you to test with above configurations and let us know if still having problem. Thanks!
 Hi @SuryanarayanaY ,

Thank you for the details. Yes GCC 13.1.0 is probably too recent. I compiled successfully TF-2.11 with GCC-9.3 and it is working fine. I will close this ticket,

Thanks!
 Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60577">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60577">No</a>
 simple fix by including the header

```
diff --git a/tensorflow/tsl/lib/io/cache.h.orig b/tensorflow/tsl/lib/io/cache.h
index f894c59..7b1cf32 100644
--- a/tensorflow/tsl/lib/io/cache.h.orig
+++ b/tensorflow/tsl/lib/io/cache.h
@@ -17,6 +17,7 @@ limitations under the License.
 #define TENSORFLOW_TSL_LIB_IO_CACHE_H_
 
 #include "tensorflow/tsl/platform/stringpiece.h"
+#include <cstdint>
 
 // A Cache is an interface that maps keys to values.  It has internal
 // synchronization and may be safely accessed concurrently from
``` > simple fix by including the header

> +#include <cstdint>

but does this break builds on GCC 9.3.1?

 > > simple fix by including the header
> 
> > +#include
> 
> but does this break builds on GCC 9.3.1?

no
<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Build/Install

### Have you reproduced the bug with TF nightly?

No

### Source

source

### Tensorflow Version

tf 2.12

### Custom Code

No

### OS Platform and Distribution

Debian GNU/Linux 12 (bookworm) (docker)

### Mobile device

_No response_

### Python version

3.11.2

### Bazel version

Bazelisk version: v1.16.0

### GCC/Compiler version

c++ (GCC) 13.1.0

### CUDA/cuDNN version

CPU only

### GPU model and memory

CPU only

### Current Behaviour?


I got a `marked 'override', but does not override` error while compiling TF r2.12

Step I have followed:

1. Install the latest GCC docker image: https://registry.hub.docker.com/_/gcc/
2. Install Bazelisk
3. Install a Python virtual env
4. Install the relevant libraries (pip, numpy, wheel, packaging, requests, opt_einsum, keras_preprocessing, see [1])
5. Cloned git clone https://github.com/tensorflow/tensorflow.git
6. git checkout r2.12
7. `./configure` (with the default options)
8. `bazel build //tensorflow/tools/pip_package:build_pip_package`

References:

[1] https://www.tensorflow.org/install/source?hl=fr



### Standalone code to reproduce the issue

```shell
bazel build //tensorflow/tools/pip_package:build_pip_package
```


### Relevant log output

```shell
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'build' from /root/repos/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /root/repos/tensorflow/.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from /root/repos/tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/root/python/envs/base/bin/python3 --action_env PYTHON_LIB_PATH=/root/python/envs/base/lib/python3.11/site-packages --python_path=/root/python/envs/base/bin/python3
INFO: Reading rc options for 'build' from /root/repos/tensorflow/.bazelrc:
  'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file /root/repos/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /root/repos/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:linux in file /root/repos/tensorflow/.bazelrc: --host_copt=-w --copt=-Wno-all --copt=-Wno-extra --copt=-Wno-deprecated --copt=-Wno-deprecated-declarations --copt=-Wno-ignored-attributes --copt=-Wno-array-bounds --copt=-Wunused-result --copt=-Werror=unused-result --copt=-Wswitch --copt=-Werror=switch --copt=-Wno-error=unused-but-set-variable --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --config=dynamic_kernels --distinct_host_configuration=false --experimental_guard_against_concurrent_changes
INFO: Found applicable config definition build:dynamic_kernels in file /root/repos/tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
Loading: 
Loading: 0 packages loaded
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/10939d1d580b9d3c9c2f3539c6bdb39f408179c0.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/91d765cad5599f9710973d3e34d4dc22583e2e79.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded, 0 targets configured)
WARNING: Download from https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/081771d4a0e9d7d3aa0eed2ef389fa4700dfb23e.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/XNNPACK/archive/659147817805d17c7be2d60bd7bbca7e780f9c82.zip failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/boringssl/archive/b9232f9e27e5668bc0414879dcdedb2a59ea75f2.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded, 0 targets configured).
INFO: Found 1 target...

[0 / 389] [Prepa] BazelWorkspaceStatusAction stable-status.txt
[1 / 396] Compiling tensorflow/tsl/platform/default/logging.cc; 3s local ... (4 actions running)
[1 / 396] Compiling tensorflow/tsl/platform/default/logging.cc; 11s local ... (4 actions running)
[4 / 418] Compiling tensorflow/core/data/dataset_utils.cc; 17s local ... (4 actions, 3 running)
[5 / 418] Compiling tensorflow/core/data/dataset_utils.cc; 23s local ... (4 actions running)
[7 / 418] Compiling tensorflow/core/data/dataset_utils.cc; 29s local ... (4 actions running)
[13 / 418] Compiling tensorflow/core/data/dataset_utils.cc; 35s local ... (4 actions running)
[22 / 418] Compiling tensorflow/core/data/dataset_utils.cc; 43s local ... (4 actions, 3 running)
[26 / 418] Compiling tensorflow/core/data/dataset_utils.cc; 58s local ... (4 actions running)
[27 / 418] Compiling tensorflow/core/data/dataset_utils.cc; 71s local ... (4 actions, 3 running)
[31 / 418] Compiling tensorflow/core/framework/dataset.cc; 44s local ... (4 actions, 3 running)
[36 / 418] Compiling tensorflow/core/lib/wav/wav_io.cc; 7s local ... (4 actions running)
ERROR: /root/repos/tensorflow/tensorflow/tsl/lib/io/BUILD:202:11: Compiling tensorflow/tsl/lib/io/cache.cc failed: (Exit 1): gcc failed: error executing command /usr/local/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 59 arguments skipped)
In file included from tensorflow/tsl/lib/io/cache.cc:16:
./tensorflow/tsl/lib/io/cache.h:99:11: error: 'uint64_t' does not name a type
   99 |   virtual uint64_t NewId() = 0;
      |           ^~~~~~~~
./tensorflow/tsl/lib/io/cache.h:20:1: note: 'uint64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
   19 | #include "tensorflow/tsl/platform/stringpiece.h"
  +++ |+#include <cstdint>
   20 | 
tensorflow/tsl/lib/io/cache.cc:391:12: error: 'uint64_t tsl::table::{anonymous}::ShardedLRUCache::NewId()' marked 'override', but does not override
  391 |   uint64_t NewId() override {
      |            ^~~~~
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 139.504s, Critical Path: 82.86s
INFO: 43 processes: 5 internal, 38 local.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
```
</details>