Repository: tensorflow
Issue: Tensorflow 2.11.1 bazel failed with option framework_shared_object=false
Labels: stat:awaiting tensorflower,type:build/install,subtype: ubuntu/linux,TF 2.11

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Build/Install

### Have you reproduced the bug with TF nightly?

No

### Source

source

### Tensorflow Version

tf2.11.1

### Custom Code

No

### OS Platform and Distribution

Linux Ubuntu 18.04

### Mobile device

_No response_

### Python version

3.8.10

### Bazel version

5.3.0

### GCC/Compiler version

9.4.0

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

Tried to build Tensorflow 2.11.1 (and Tensorflow 2.12.0) using Tensorflow docker image: tensorflow/tensorflow:devel with option framework_shared_object=false. The build fails with the following error. (It's a build for CPU only).

Using the same option, previous versions of Tensorflow (such as v2.10.1) build without error. 






### Standalone code to reproduce the issue

```shell
docker pull tensorflow/tensorflow:devel
docker run -it -w /tensorflow -v /path/to/tensorflow:/tensorflow -v $PWD:/mnt \
    -e HOST_PERMS="\\((id -u):\\)(id -g)" tensorflow/tensorflow:devel bash

# within the container
bazel build --config opt --define framework_shared_object=false //tensorflow/tools/pip_package:build_pip_package
```


### Relevant log output

```shell
ERROR: /tensorflow/tensorflow/python/BUILD:889:29: Linking tensorflow/python/gen_ragged_math_ops_py_wrappers_cc failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc @bazel-out/k8-opt/bin/tensorflow/python/gen_ragged_math_ops_py_wrappers_cc-2.params
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function InitDefaultsscc_info_AutotuneResult_FailureResult_tensorflow_2fcore_2fprotobuf_2fautotuning_2eproto(): error: undefined reference to 'stream_executor::dnn::_AlgorithmProto_default_instance_'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function InitDefaultsscc_info_AutotuneResult_tensorflow_2fcore_2fprotobuf_2fautotuning_2eproto(): error: undefined reference to 'stream_executor::dnn::_AlgorithmProto_default_instance_'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult_FailureResult::MergeFrom(tensorflow::AutotuneResult_FailureResult const&): error: undefined reference to 'stream_executor::dnn::AlgorithmProto* google::protobuf::Arena::CreateMaybeMessage<stream_executor::dnn::AlgorithmProto>(google::protobuf::Arena*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult_FailureResult::MergeFrom(tensorflow::AutotuneResult_FailureResult const&): error: undefined reference to 'stream_executor::dnn::_AlgorithmProto_default_instance_'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult_FailureResult::MergeFrom(tensorflow::AutotuneResult_FailureResult const&): error: undefined reference to 'stream_executor::dnn::AlgorithmProto::MergeFrom(stream_executor::dnn::AlgorithmProto const&)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult_FailureResult::MergeFrom(tensorflow::AutotuneResult_FailureResult const&): error: undefined reference to 'stream_executor::dnn::AlgorithmProto::MergeFrom(stream_executor::dnn::AlgorithmProto const&)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult::MergeFrom(tensorflow::AutotuneResult const&): error: undefined reference to 'stream_executor::dnn::AlgorithmProto* google::protobuf::Arena::CreateMaybeMessage<stream_executor::dnn::AlgorithmProto>(google::protobuf::Arena*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult::MergeFrom(tensorflow::AutotuneResult const&): error: undefined reference to 'stream_executor::dnn::_AlgorithmProto_default_instance_'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult::MergeFrom(tensorflow::AutotuneResult const&): error: undefined reference to 'stream_executor::dnn::AlgorithmProto::MergeFrom(stream_executor::dnn::AlgorithmProto const&)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult::MergeFrom(tensorflow::AutotuneResult const&): error: undefined reference to 'stream_executor::dnn::AlgorithmProto::MergeFrom(stream_executor::dnn::AlgorithmProto const&)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult_FailureResult::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*): error: undefined reference to 'stream_executor::dnn::AlgorithmProto* google::protobuf::Arena::CreateMaybeMessage<stream_executor::dnn::AlgorithmProto>(google::protobuf::Arena*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult_FailureResult::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*): error: undefined reference to 'stream_executor::dnn::AlgorithmProto::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult_FailureResult::InternalSerializeWithCachedSizesToArray(unsigned char*) const: error: undefined reference to 'stream_executor::dnn::AlgorithmProto::InternalSerializeWithCachedSizesToArray(unsigned char*) const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult_FailureResult::ByteSizeLong() const: error: undefined reference to 'stream_executor::dnn::AlgorithmProto::ByteSizeLong() const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*): error: undefined reference to 'stream_executor::dnn::AlgorithmProto* google::protobuf::Arena::CreateMaybeMessage<stream_executor::dnn::AlgorithmProto>(google::protobuf::Arena*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*): error: undefined reference to 'stream_executor::dnn::AlgorithmProto::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult::InternalSerializeWithCachedSizesToArray(unsigned char*) const: error: undefined reference to 'stream_executor::dnn::AlgorithmProto::InternalSerializeWithCachedSizesToArray(unsigned char*) const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:function tensorflow::AutotuneResult::ByteSizeLong() const: error: undefined reference to 'stream_executor::dnn::AlgorithmProto::ByteSizeLong() const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:descriptor_table_tensorflow_2fcore_2fprotobuf_2fautotuning_2eproto_deps: error: undefined reference to 'descriptor_table_tensorflow_2fcompiler_2fxla_2fstream_5fexecutor_2fdnn_2eproto'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:scc_info_AutotuneResult_FailureResult_tensorflow_2fcore_2fprotobuf_2fautotuning_2eproto: error: undefined reference to 'scc_info_AlgorithmProto_tensorflow_2fcompiler_2fxla_2fstream_5fexecutor_2fdnn_2eproto'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/autotuning_proto_cc_impl/autotuning.pb.o:autotuning.pb.cc:scc_info_AutotuneResult_tensorflow_2fcore_2fprotobuf_2fautotuning_2eproto: error: undefined reference to 'scc_info_AlgorithmProto_tensorflow_2fcompiler_2fxla_2fstream_5fexecutor_2fdnn_2eproto'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function InitDefaultsscc_info_ConvolutionProto_tensorflow_2fcore_2fprotobuf_2fconv_5fautotuning_2eproto(): error: undefined reference to 'stream_executor::dnn::_TensorDescriptorProto_default_instance_'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function InitDefaultsscc_info_ConvolutionProto_tensorflow_2fcore_2fprotobuf_2fconv_5fautotuning_2eproto(): error: undefined reference to 'stream_executor::dnn::_ConvolutionDescriptorProto_default_instance_'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto::MergeFrom(stream_executor::dnn::TensorDescriptorProto const&)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto::MergeFrom(stream_executor::dnn::TensorDescriptorProto const&)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto::MergeFrom(stream_executor::dnn::TensorDescriptorProto const&)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::ConvolutionDescriptorProto::MergeFrom(stream_executor::dnn::ConvolutionDescriptorProto const&)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto* google::protobuf::Arena::CreateMaybeMessage<stream_executor::dnn::TensorDescriptorProto>(google::protobuf::Arena*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::_TensorDescriptorProto_default_instance_'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto* google::protobuf::Arena::CreateMaybeMessage<stream_executor::dnn::TensorDescriptorProto>(google::protobuf::Arena*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::_TensorDescriptorProto_default_instance_'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto* google::protobuf::Arena::CreateMaybeMessage<stream_executor::dnn::TensorDescriptorProto>(google::protobuf::Arena*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::_TensorDescriptorProto_default_instance_'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::ConvolutionDescriptorProto* google::protobuf::Arena::CreateMaybeMessage<stream_executor::dnn::ConvolutionDescriptorProto>(google::protobuf::Arena*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergeFrom(tensorflow::ConvolutionProto const&): error: undefined reference to 'stream_executor::dnn::_ConvolutionDescriptorProto_default_instance_'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*): error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto* google::protobuf::Arena::CreateMaybeMessage<stream_executor::dnn::TensorDescriptorProto>(google::protobuf::Arena*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*): error: undefined reference to 'stream_executor::dnn::ConvolutionDescriptorProto::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*): error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*): error: undefined reference to 'stream_executor::dnn::ConvolutionDescriptorProto* google::protobuf::Arena::CreateMaybeMessage<stream_executor::dnn::ConvolutionDescriptorProto>(google::protobuf::Arena*)'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::InternalSerializeWithCachedSizesToArray(unsigned char*) const: error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto::InternalSerializeWithCachedSizesToArray(unsigned char*) const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::InternalSerializeWithCachedSizesToArray(unsigned char*) const: error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto::InternalSerializeWithCachedSizesToArray(unsigned char*) const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::InternalSerializeWithCachedSizesToArray(unsigned char*) const: error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto::InternalSerializeWithCachedSizesToArray(unsigned char*) const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::InternalSerializeWithCachedSizesToArray(unsigned char*) const: error: undefined reference to 'stream_executor::dnn::ConvolutionDescriptorProto::InternalSerializeWithCachedSizesToArray(unsigned char*) const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::ByteSizeLong() const: error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto::ByteSizeLong() const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::ByteSizeLong() const: error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto::ByteSizeLong() const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::ByteSizeLong() const: error: undefined reference to 'stream_executor::dnn::TensorDescriptorProto::ByteSizeLong() const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:function tensorflow::ConvolutionProto::ByteSizeLong() const: error: undefined reference to 'stream_executor::dnn::ConvolutionDescriptorProto::ByteSizeLong() const'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:descriptor_table_tensorflow_2fcore_2fprotobuf_2fconv_5fautotuning_2eproto_deps: error: undefined reference to 'descriptor_table_tensorflow_2fcompiler_2fxla_2fstream_5fexecutor_2fdnn_2eproto'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:scc_info_ConvolutionProto_tensorflow_2fcore_2fprotobuf_2fconv_5fautotuning_2eproto: error: undefined reference to 'scc_info_TensorDescriptorProto_tensorflow_2fcompiler_2fxla_2fstream_5fexecutor_2fdnn_2eproto'
bazel-out/k8-opt/bin/tensorflow/core/protobuf/_objs/conv_autotuning_proto_cc_impl/conv_autotuning.pb.o:conv_autotuning.pb.cc:scc_info_ConvolutionProto_tensorflow_2fcore_2fprotobuf_2fconv_5fautotuning_2eproto: error: undefined reference to 'scc_info_ConvolutionDescriptorProto_tensorflow_2fcompiler_2fxla_2fstream_5fexecutor_2fdnn_2eproto'
collect2: error: ld returned 1 exit status
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /tensorflow/tensorflow/lite/python/BUILD:68:10 Middleman _middlemen/tensorflow_Slite_Spython_Stflite_Uconvert-runfiles failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc @bazel-out/k8-opt/bin/tensorflow/python/gen_ragged_math_ops_py_wrappers_cc-2.params
INFO: Elapsed time: 152.054s, Critical Path: 49.12s
INFO: 376 processes: 39 internal, 337 local.
FAILED: Build did NOT complete successfully
```
</details>