Tensorflow compiler error in bazel
Hi @BiophiliaSWDA ,

This seems to be issue related to linker ids on Macos. Please have a look into the bazel repo issues [1](https://github.com/bazelbuild/bazel/issues/16286), [2](https://github.com/bazelbuild/bazel/issues/16053) and let us know if this is of help. > Hi @BiophiliaSWDA ,
> 
> This seems to be issue related to linker ids on Macos. Please have a look into the bazel repo issues [1](https://github.com/bazelbuild/bazel/issues/16286), [2](https://github.com/bazelbuild/bazel/issues/16053) and let us know if this is of help.

Thanks for the reply, I have finished compiling on ubuntu. But I didn't find a way to calculate the `c++ code coverage`. For example, I now have a tensorflow network written in python, can I use `bazel coverage` to get the `c++ code coverage`. Hi @BiophiliaSWDA ,

Could you please refer this [documentation](https://www.tensorflow.org/community/contribute/tests) on TF tests is of any help. I find out similar issue #51091 where author tried same but couldn't succeed in older TF versions. Could you try and let us know the outcome with latest versions? Also all tests coverage shall be available on [tensorflow/tensorflow.bazel](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tensorflow.bzl). 

Thanks! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. 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/62374">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/62374">No</a>

### Issue type

Feature Request

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

No

### Source

binary

### TensorFlow version

tf2.12.0

### Custom code

No

### OS platform and distribution

MacOS12.6

### Mobile device

_No response_

### Python version

3.10

### Bazel version

5.3.0

### GCC/compiler version

clang14 llvm14

### CUDA/cuDNN version

no

### GPU model and memory

no

### Current behavior?

 I use `python3 configure.py`, and `bazel build //tensorflow/tools/pip_package:build_pip_package` atfer. I get an error :
```
clang: error: invalid linker name in argument '-fuse-ld=-debugger-tuning=lldb'
```

All logs is here:
```
(tensorflowcov) my@mydeMacBook-Pro tensorflow % python3 configure.py
You have bazel 5.3.0 installed.
Please specify the location of python. [Default is /Users/my/miniconda3/envs/tensorflowcov/bin/python3]: 


Found possible Python library paths:
  /Users/my/miniconda3/envs/tensorflowcov/lib/python3.10/site-packages
Please input the desired Python library path to use.  Default is [/Users/my/miniconda3/envs/tensorflowcov/lib/python3.10/site-packages]

Do you wish to build TensorFlow with ROCm support? [y/N]: n
No ROCm support will be enabled for TensorFlow.

Do you wish to build TensorFlow with CUDA support? [y/N]: n
No CUDA support will be enabled for TensorFlow.

Do you wish to download a fresh release of clang? (Experimental) [y/N]: n
Clang will not be downloaded.

Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -Wno-sign-compare]: 


Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: n
Not configuring the WORKSPACE for Android builds.

Do you wish to build TensorFlow with iOS support? [y/N]: n
No iOS support will be enabled for TensorFlow.

Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See .bazelrc for more details.
	--config=mkl         	# Build with MKL support.
	--config=mkl_aarch64 	# Build with oneDNN and Compute Library for the Arm Architecture (ACL).
	--config=monolithic  	# Config for mostly static monolithic build.
	--config=numa        	# Build with NUMA support.
	--config=dynamic_kernels	# (Experimental) Build kernels into separate shared objects.
	--config=v1          	# Build with TensorFlow 1 API instead of TF 2 API.
Preconfigured Bazel build configs to DISABLE default on features:
	--config=nogcp       	# Disable GCP support.
	--config=nonccl      	# Disable NVIDIA NCCL support.
(tensorflowcov) my@mydeMacBook-Pro tensorflow % bazel build //tensorflow/tools/pip_package:build_pip_package
WARNING: Ignoring JAVA_HOME, because it must point to a JDK, not a JRE.
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=121
INFO: Reading rc options for 'build' from /Users/my/tensorflowcov/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /Users/my/tensorflowcov/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 /Users/my/tensorflowcov/tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/Users/my/miniconda3/envs/tensorflowcov/bin/python3 --action_env PYTHON_LIB_PATH=/Users/my/miniconda3/envs/tensorflowcov/lib/python3.10/site-packages --python_path=/Users/my/miniconda3/envs/tensorflowcov/bin/python3
INFO: Reading rc options for 'build' from /Users/my/tensorflowcov/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 /Users/my/tensorflowcov/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /Users/my/tensorflowcov/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:macos in file /Users/my/tensorflowcov/tensorflow/.bazelrc: --apple_platform_type=macos --copt=-DGRPC_BAZEL_BUILD --copt=-w --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
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
INFO: Build options --action_env and --python_path have changed, discarding analysis cache.
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 (583 packages loaded, 42968 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_my/d373406bd1736cab8f8b5a2e209dce51/external/com_google_protobuf/BUILD.bazel:459:10: Linking external/com_google_protobuf/protoc failed: (Exit 1): cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh @bazel-out/darwin_arm64-opt-exec-50AE0418/bin/external/com_google_protobuf/protoc-2.params
clang: error: invalid linker name in argument '-fuse-ld=-debugger-tuning=lldb'
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: 51.060s, Critical Path: 4.94s
INFO: 398 processes: 195 internal, 203 local.
FAILED: Build did NOT complete successfully
```

After searching I found [ISSUE](https://github.com/tensorflow/tensorflow/issues/59739)
At the end of this issue, the author also mentioned this problem, but did not fix yet.

Sorry to interrupt.

I want to use `bazel coverage` to get the `c++` operator coverage of my network after compiling `tensorflow2.12.0` with `bazel`. I don't know if this is ok, maybe you can give me some advice on this point? I would really appreciate it.
Or, you can give me the algorithm to get the `c++ operators`, because AFAIK, pytorch provides [code_coverage](https://github.com/pytorch/pytorch/tree/main/tools/code_coverage) to get the coverage of c++ operators

### Standalone code to reproduce the issue

```shell
No code
```


### Relevant log output

_No response_