Building stuck at "Linking tensorflow/libtensorflow_cc.so.2.16.0" with "--compilation_mode=dbg"
Build stopped with an error after several hours:

```
bazel build -c opt tensorflow/lite/python:tflite_convert --compilation_mode=dbg --verbose_failures
INFO: Reading 'startup' options from /private/tensorflow/.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=203
INFO: Reading rc options for 'build' from /private/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /private/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 --features=-force_no_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: Found applicable config definition build:short_logs in file /private/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /private/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:linux in file /private/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 --experimental_guard_against_concurrent_changes
INFO: Found applicable config definition build:dynamic_kernels in file /private/tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
INFO: Analyzed target //tensorflow/lite/python:tflite_convert (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /private/tensorflow/tensorflow/BUILD:1314:21: Linking tensorflow/libtensorflow_cc.so.2.16.0 failed: (Exit 1): gcc failed: error executing command (from target //tensorflow:libtensorflow_cc.so.2.16.0) 
  (cd /home/rd/.cache/bazel/_bazel_rd/7dd12a92052954e911919783cd6ca021/execroot/org_tensorflow && \
  exec env - \
    PATH=/home/rd/anaconda3/bin:/home/rd/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin \
    PWD=/proc/self/cwd \
    TF2_BEHAVIOR=1 \
  /usr/bin/gcc @bazel-out/k8-dbg/bin/tensorflow/libtensorflow_cc.so.2.16.0-2.params)
# Configuration: 922fc4df46810e014c35c27c9665581d34e181306206844730af5a180c2c4048
# Execution platform: @local_execution_config_platform//:platform
stderr (/home/rd/.cache/bazel/_bazel_rd/7dd12a92052954e911919783cd6ca021/execroot/org_tensorflow/bazel-out/_tmp/actions/stderr-2) 608971967 exceeds maximum size of --experimental_ui_max_stdouterr_bytes=1048576 bytes; skipping
Target //tensorflow/lite/python:tflite_convert failed to build
INFO: Elapsed time: 16653.336s, Critical Path: 16652.51s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully
```

The file stderr-2 is very large (at 600MB+) and contains lines such as:

```
bazel-out/k8-dbg/bin/external/com_google_absl/absl/random/internal/_objs/platform/randen_round_keys.pic.o(.debug_aranges+0x6): error: relocation overflow: reference to local symbol 3 in bazel-out/k8-dbg/bin/external/com_google_absl/absl/random/internal/_objs/platform/randen_round_keys.pic.o

bazel-out/k8-dbg/bin/external/com_google_absl/absl/log/internal/_objs/nullguard/nullguard.pic.o(.debug_info+0x4cd): error: relocation overflow: reference to local symbol 5 in bazel-out/k8-dbg/bin/external/com_google_absl/absl/log/internal/_objs/nullguard/nullguard.pic.o

bazel-out/k8-dbg/bin/tensorflow/core/kernels/_objs/cwise_op/cwise_op_maximum.pic.o(.debug_info+0x2f83ac): error: relocation overflow: reference to local symbol 15443 in bazel-out/k8-dbg/bin/tensorflow/core/kernels/_objs/cwise_op/cwise_op_maximum.pic.o

bazel-out/k8-dbg/bin/tensorflow/core/kernels/_objs/cwise_op/cwise_op_less_equal.pic.o(.debug_info+0x42a89c): error: relocation overflow: reference to local symbol 15191 in bazel-out/k8-dbg/bin/tensorflow/core/kernels/_objs/cwise_op/cwise_op_less_equal.pic.o
``` I'm not sure if changing --compilation_mode to --config fixed it or it was the --per_file_copt, nonetheless I ran this command and it worked:
`bazel build --config=dbg --verbose_failures --jobs=16 --per_file_copt=+tensorflow/compiler/mlir/lite/*@-g //tensorflow/lite/python:tflite_convert`.
This helped: https://github.com/tensorflow/tensorflow/blob/master/CONTRIBUTING.md 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/62871">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/62871">No</a>

### Issue type

Build/Install

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

source

### TensorFlow version

2.16

### Custom code

No

### OS platform and distribution

Linux Ubuntu 22.04.1 LTS

### Mobile device

_No response_

### Python version

3.11

### Bazel version

6.5.0

### GCC/compiler version

11.4.0

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

I'm trying to build tensorflow/lite/python:tflite_convert with compilation_mode=dbg to debug it later with gdb. I've tried with two very different systems: one with an intel cpu on WSL2 win11 and one with a ryzen cpu on native ubuntu. Both are getting stuck with linking "tensorflow/libtensorflow_cc.so.2.16.0". Is it supposed to take many hours? I've built the tflite_convert many times without that compilation mode and it always builds successfully.

Full output (after restarting the command):
```
bazel build -c opt tensorflow/lite/python:tflite_convert --compilation_mode=dbg --verbose_failures
INFO: Reading 'startup' options from /private/tensorflow/.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=203
INFO: Reading rc options for 'build' from /private/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /private/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 --features=-force_no_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: Found applicable config definition build:short_logs in file /private/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /private/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:linux in file /private/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 --experimental_guard_against_concurrent_changes
INFO: Found applicable config definition build:dynamic_kernels in file /private/tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
INFO: Analyzed target //tensorflow/lite/python:tflite_convert (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
[1 / 63] Linking tensorflow/libtensorflow_cc.so.2.16.0; 1220s local
```

### Standalone code to reproduce the issue

```shell
git clone latest tensorflow repo then run:
bazel build -c opt tensorflow/lite/python:tflite_convert --compilation_mode=dbg --verbose_failures
```


### Relevant log output

_No response_