Failed building from source using clang compiler. Error: libtensorflow_framework.so.2 is a dangling symbolic link
Hi @vineel96 ,

Could you please confirm your `./configure` setup. I am getting a different error though in both r2.13 and master.

```
(bazel) suryanarayanay@surya-ubuntu20:~/tensorflow$ ./configure 
bash: /home/suryanarayanay/miniconda3/lib/libtinfo.so.6: no version information available (required by bash)
You have bazel 6.1.0 installed.
Please specify the location of python. [Default is /home/suryanarayanay/miniconda3/envs/bazel/bin/python3]: 


Found possible Python library paths:
  /home/suryanarayanay/miniconda3/envs/bazel/lib/python3.9/site-packages
Please input the desired Python library path to use.  Default is [/home/suryanarayanay/miniconda3/envs/bazel/lib/python3.9/site-packages]

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

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

Do you want to use Clang to build TensorFlow? [Y/n]: 
Clang will be used to compile TensorFlow.

Please specify the path to clang executable. [Default is /usr/lib/llvm-16/bin/clang]: 


WARNING: current clang installation is not a release version.

Traceback (most recent call last):
  File "/home/suryanarayanay/tensorflow/./configure.py", line 1466, in <module>
    main()
  File "/home/suryanarayanay/tensorflow/./configure.py", line 1417, in main
    disable_clang16_offsetof_extension(clang_version)
  File "/home/suryanarayanay/tensorflow/./configure.py", line 886, in disable_clang16_offsetof_extension
    if int(clang_version.split('.')[0]) == 16:
AttributeError: 'NoneType' object has no attribute 'split'
(bazel) suryanarayanay@surya-ubuntu20:~/tensorflow$ git checkout r2.13
Updating files: 100% (6178/6178), done.
Switched to branch 'r2.13'
Your branch is up to date with 'origin/r2.13'.
(bazel) suryanarayanay@surya-ubuntu20:~/tensorflow$ ./configure
bash: /home/suryanarayanay/miniconda3/lib/libtinfo.so.6: no version information available (required by bash)
You have bazel 5.3.0 installed.
Please specify the location of python. [Default is /home/suryanarayanay/miniconda3/envs/bazel/bin/python3]: 


Found possible Python library paths:
  /home/suryanarayanay/miniconda3/envs/bazel/lib/python3.9/site-packages
Please input the desired Python library path to use.  Default is [/home/suryanarayanay/miniconda3/envs/bazel/lib/python3.9/site-packages]

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

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

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

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]: 
Not configuring the WORKSPACE for Android builds.

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.
Configuration finished
(bazel) suryanarayanay@surya-ubuntu20:~/tensorflow$ bazel build --config=mkl --config=dbg --verbose_failures -c opt --copt=-march=native --spawn_strategy=sandboxed --sandbox_debug //tensorflow/tools/pip_package:build_pip_package
ERROR: Config value 'download_clang' is not defined in any .rc file
(bazel) suryanarayanay@surya-ubuntu20:~/tensorflow$ 
```

 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/61398">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/61398">No</a>

### System information

-   **Have I written custom code (as opposed to using a stock example script
    provided in TensorFlow)**:  No
-   **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: Linux Ubuntu 20.04.6 LTS. Building on Intel x86 CPU
-   **Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue
    happens on a mobile device**:
-   **TensorFlow installed from (source or binary)**: Source
-   **TensorFlow version (use command below)**: 2.13
-   **Python version**: 3.10.11
-   **Bazel version (if compiling from source)**: 5.3.0
-   **Clang/Compiler version (if compiling from source)**: Clang 16.0.6
-   **CUDA/cuDNN version**: None (Building on Intel x86 CPU)
-   **GPU model and memory**: None (Building on Intel x86 CPU)
-   **Exact command to reproduce**: 
 bazel build  --config=mkl --config=dbg --verbose_failures  -c opt --copt=-march=native --spawn_strategy=sandboxed --sandbox_debug //tensorflow/tools/pip_package:build_pip_package


### Describe the problem

Error while building Tensorflow 2.13 from source with clang 16.0.6 and bazel 5.3.0. I am using the versions that were tested compatible  from this link: https://www.tensorflow.org/install/source#tested_build_configurations.
Errors:
ERROR: /home/ubuntu/builds/tensorflow/tensorflow/BUILD:1134:21: declared output 'tensorflow/libtensorflow_framework.so.2' is a dangling symbolic link
ERROR: /home/ubuntu/builds/tensorflow/tensorflow/BUILD:1134:21: Executing genrule //tensorflow:libtensorflow_framework.so.2_sym [for host] failed: not all outputs were created or valid

### Source code / logs

Output from above command mentioned:

Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=121
INFO: Reading rc options for 'build' from /home/ubuntu/builds/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /home/ubuntu/builds/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 /home/ubuntu/builds/tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/home/ubuntu/anaconda3/envs/tf_build/bin/python --action_env PYTHON_LIB_PATH=/home/ubuntu/anaconda3/envs/tf_build/lib/python3.10/site-packages --python_path=/home/ubuntu/anaconda3/envs/tf_build/bin/python
INFO: Reading rc options for 'build' from /home/ubuntu/builds/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,tensorflow/core/tfrt/utils/debug
INFO: Found applicable config definition build:short_logs in file /home/ubuntu/builds/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /home/ubuntu/builds/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:mkl in file /home/ubuntu/builds/tensorflow/.bazelrc: --define=build_with_mkl=true --define=enable_mkl=true --define=tensorflow_mkldnn_contraction_kernel=0 --define=build_with_openmp=true -c opt
INFO: Found applicable config definition build:dbg in file /home/ubuntu/builds/tensorflow/.bazelrc: -c dbg --per_file_copt=+.*,-tensorflow.*@-g0 --per_file_copt=+tensorflow/core/kernels.*@-g0 --cxxopt -DTF_LITE_DISABLE_X86_NEON --copt -DDEBUG_BUILD
INFO: Found applicable config definition build:linux in file /home/ubuntu/builds/tensorflow/.bazelrc: --define=build_with_onednn_v3=true --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 /home/ubuntu/builds/tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (614 packages loaded, 38324 targets configured).
INFO: Found 1 target...
ERROR: /home/ubuntu/builds/tensorflow/tensorflow/BUILD:1134:21: declared output 'tensorflow/libtensorflow_framework.so.2' is a dangling symbolic link
ERROR: /home/ubuntu/builds/tensorflow/tensorflow/BUILD:1134:21: Executing genrule //tensorflow:libtensorflow_framework.so.2_sym [for host] failed: not all outputs were created or valid
1690366816.573675378: src/main/tools/linux-sandbox.cc:152: calling pipe(2)...
1690366816.573706039: src/main/tools/linux-sandbox.cc:171: calling clone(2)...
1690366816.573936717: src/main/tools/linux-sandbox.cc:180: linux-sandbox-pid1 has PID 52399
1690366816.573986443: src/main/tools/linux-sandbox-pid1.cc:650: Pid1Main started
1690366816.574047951: src/main/tools/linux-sandbox.cc:197: done manipulating pipes
1690366816.574187327: src/main/tools/linux-sandbox-pid1.cc:269: working dir: /home/ubuntu/.cache/bazel/_bazel_ubuntu/e773aae8e1619280c7c65ec2bcc4c4c5/sandbox/linux-sandbox/2934/execroot/org_tensorflow
1690366816.574204103: src/main/tools/linux-sandbox-pid1.cc:301: writable: /home/ubuntu/.cache/bazel/_bazel_ubuntu/e773aae8e1619280c7c65ec2bcc4c4c5/sandbox/linux-sandbox/2934/execroot/org_tensorflow
1690366816.574210697: src/main/tools/linux-sandbox-pid1.cc:301: writable: /tmp
1690366816.574216986: src/main/tools/linux-sandbox-pid1.cc:301: writable: /dev/shm
1690366816.574277494: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /
1690366816.574284725: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /dev
1690366816.574289479: src/main/tools/linux-sandbox-pid1.cc:371: remount rw: /dev/shm
1690366816.574294383: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /dev/pts
1690366816.574298736: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /dev/hugepages
1690366816.574303348: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /dev/mqueue
1690366816.574307631: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys
1690366816.574312050: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/kernel/security
1690366816.574318166: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup
1690366816.574323186: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/unified
1690366816.574328198: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/systemd
1690366816.574333290: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/hugetlb
1690366816.574337803: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/freezer
1690366816.574342520: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/misc
1690366816.574370614: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/cpu,cpuacct
1690366816.574376364: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/perf_event
1690366816.574380879: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/blkio
1690366816.574385348: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/devices
1690366816.574389735: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/memory
1690366816.574394055: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/cpuset
1690366816.574398740: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/net_cls,net_prio
1690366816.574403141: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/pids
1690366816.574407626: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/cgroup/rdma
1690366816.574412563: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/pstore
1690366816.574417748: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/bpf
1690366816.574422147: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/kernel/debug
1690366816.574427574: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/kernel/tracing
1690366816.574453517: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/fs/fuse/connections
1690366816.574459675: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /sys/kernel/config
1690366816.574464740: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /proc
1690366816.574469467: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /proc/sys/fs/binfmt_misc
1690366816.574478344: src/main/tools/linux-sandbox-pid1.cc:391: remount(nullptr, /proc/sys/fs/binfmt_misc, nullptr, 2101281, nullptr) failure (Operation not permitted) ignored
1690366816.574487890: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /proc/sys/fs/binfmt_misc
1690366816.574499308: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /run
1690366816.574503860: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /run/lock
1690366816.574508265: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /run/snapd/ns
1690366816.574513396: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /run/user/1000
1690366816.574518358: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /snap/amazon-ssm-agent/6563
1690366816.574523566: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /boot/efi
1690366816.574528274: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /snap/amazon-ssm-agent/7497
1690366816.574547267: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /snap/snapd/19361
1690366816.574553038: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /snap/core18/2785
1690366816.574557467: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /snap/core20/1950
1690366816.574562111: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /snap/snapd/19457
1690366816.574566323: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /snap/core18/2751
1690366816.574570473: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /snap/core20/1974
1690366816.574574374: src/main/tools/linux-sandbox-pid1.cc:371: remount ro: /snap/lxd/24061
1690366816.574579365: src/main/tools/linux-sandbox-pid1.cc:371: remount rw: /home/ubuntu/.cache/bazel/_bazel_ubuntu/e773aae8e1619280c7c65ec2bcc4c4c5/sandbox/linux-sandbox/2934/execroot/org_tensorflow
1690366816.574585138: src/main/tools/linux-sandbox-pid1.cc:371: remount rw: /home/ubuntu/.cache/bazel/_bazel_ubuntu/e773aae8e1619280c7c65ec2bcc4c4c5/sandbox/linux-sandbox/2934/execroot/org_tensorflow
1690366816.574589762: src/main/tools/linux-sandbox-pid1.cc:371: remount rw: /tmp
1690366816.574594138: src/main/tools/linux-sandbox-pid1.cc:371: remount rw: /dev/shm
1690366816.574636966: src/main/tools/linux-sandbox-pid1.cc:460: calling fork...
1690366816.574760311: src/main/tools/linux-sandbox-pid1.cc:490: child started with PID 2
1690366816.583691390: src/main/tools/linux-sandbox-pid1.cc:507: wait returned pid=2, status=0x00
1690366816.583704145: src/main/tools/linux-sandbox-pid1.cc:525: child exited normally with code 0
1690366816.583952036: src/main/tools/linux-sandbox.cc:233: child exited normally with code 0
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 849.711s, Critical Path: 79.72s
INFO: 4142 processes: 1215 internal, 2927 linux-sandbox.
FAILED: Build did NOT complete successfully