TF 2.15 fails to build on Ubuntu 23.10
I faced the same issue and managed to work around it by adding the ``--copt=-Wno-gnu-offsetof-extensions`` flag. Added the --copt=-Wno-gnu-offsetof-extensions flag.
Now it tries to compile all to the end, instead of failing midway. And then it fails at the last moment, just at the last step.

```
ERROR: /home/masum/Desktop/Dev-Enviornment/tensorflow/tensorflow/python/platform/BUILD:388:17: Linking tensorflow/python/platform/_pywrap_tf2.so failed: (Exit 1): clang failed: error executing command (from target //tensorflow/python/platform:_pywrap_tf2.so) /usr/lib/llvm-17/bin/clang @bazel-out/k8-opt/bin/tensorflow/python/platform/_pywrap_tf2.so-2.params
ld.lld: error: version script assignment of 'global' to symbol 'init_pywrap_tf2' failed: symbol not defined
ld.lld: error: version script assignment of 'global' to symbol 'init__pywrap_tf2' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
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: 3962.530s, Critical Path: 167.04s
INFO: 11472 processes: 14 internal, 11458 local.
FAILED: Build did NOT complete successfully

``` Running with the -k flag in bazel build:

```
ERROR: /home/masum/Desktop/Dev-Enviornment/tensorflow/tensorflow/python/platform/BUILD:388:17: Linking tensorflow/python/platform/_pywrap_tf2.so failed: (Exit 1): clang failed: error executing command (from target //tensorflow/python/platform:_pywrap_tf2.so) /usr/lib/llvm-17/bin/clang @bazel-out/k8-opt/bin/tensorflow/python/platform/_pywrap_tf2.so-2.params
ld.lld: error: version script assignment of 'global' to symbol 'init_pywrap_tf2' failed: symbol not defined
ld.lld: error: version script assignment of 'global' to symbol 'init__pywrap_tf2' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: /home/masum/Desktop/Dev-Enviornment/tensorflow/tensorflow/compiler/tf2tensorrt/BUILD:1012:17: Linking tensorflow/compiler/tf2tensorrt/_pywrap_py_utils.so failed: (Exit 1): clang failed: error executing command (from target //tensorflow/compiler/tf2tensorrt:_pywrap_py_utils.so) /usr/lib/llvm-17/bin/clang @bazel-out/k8-opt/bin/tensorflow/compiler/tf2tensorrt/_pywrap_py_utils.so-2.params
ld.lld: error: version script assignment of 'global' to symbol 'init_pywrap_py_utils' failed: symbol not defined
ld.lld: error: version script assignment of 'global' to symbol 'init__pywrap_py_utils' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: /home/masum/Desktop/Dev-Enviornment/tensorflow/tensorflow/python/autograph/impl/testing/BUILD:9:17: Linking tensorflow/python/autograph/impl/testing/pybind_for_testing.so failed: (Exit 1): clang failed: error executing command (from target //tensorflow/python/autograph/impl/testing:pybind_for_testing.so) /usr/lib/llvm-17/bin/clang @bazel-out/k8-opt/bin/tensorflow/python/autograph/impl/testing/pybind_for_testing.so-2.params
ld.lld: error: version script assignment of 'global' to symbol 'initpybind_for_testing' failed: symbol not defined
ld.lld: error: version script assignment of 'global' to symbol 'init_pybind_for_testing' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: /home/masum/Desktop/Dev-Enviornment/tensorflow/tensorflow/lite/python/metrics/BUILD:35:17: Linking tensorflow/lite/python/metrics/_pywrap_tensorflow_lite_metrics_wrapper.so failed: (Exit 1): clang failed: error executing command (from target //tensorflow/lite/python/metrics:_pywrap_tensorflow_lite_metrics_wrapper.so) /usr/lib/llvm-17/bin/clang @bazel-out/k8-opt/bin/tensorflow/lite/python/metrics/_pywrap_tensorflow_lite_metrics_wrapper.so-2.params
ld.lld: error: version script assignment of 'global' to symbol 'init_pywrap_tensorflow_lite_metrics_wrapper' failed: symbol not defined
ld.lld: error: version script assignment of 'global' to symbol 'init__pywrap_tensorflow_lite_metrics_wrapper' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: /home/masum/Desktop/Dev-Enviornment/tensorflow/tensorflow/lite/python/interpreter_wrapper/BUILD:79:17: Linking tensorflow/lite/python/interpreter_wrapper/_pywrap_tensorflow_interpreter_wrapper.so failed: (Exit 1): clang failed: error executing command (from target //tensorflow/lite/python/interpreter_wrapper:_pywrap_tensorflow_interpreter_wrapper.so) /usr/lib/llvm-17/bin/clang @bazel-out/k8-opt/bin/tensorflow/lite/python/interpreter_wrapper/_pywrap_tensorflow_interpreter_wrapper.so-2.params
ld.lld: error: version script assignment of 'global' to symbol 'init_pywrap_tensorflow_interpreter_wrapper' failed: symbol not defined
ld.lld: error: version script assignment of 'global' to symbol 'init__pywrap_tensorflow_interpreter_wrapper' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: /home/masum/Desktop/Dev-Enviornment/tensorflow/tensorflow/compiler/mlir/stablehlo/BUILD:20:21: Linking tensorflow/compiler/mlir/stablehlo/stablehlo_extension.so failed: (Exit 1): clang failed: error executing command (from target //tensorflow/compiler/mlir/stablehlo:stablehlo_extension.so) /usr/lib/llvm-17/bin/clang @bazel-out/k8-opt/bin/tensorflow/compiler/mlir/stablehlo/stablehlo_extension.so-2.params
ld.lld: error: version script assignment of 'global' to symbol 'initstablehlo_extension' failed: symbol not defined
ld.lld: error: version script assignment of 'global' to symbol 'init_stablehlo_extension' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: /home/masum/Desktop/Dev-Enviornment/tensorflow/tensorflow/lite/python/optimize/BUILD:38:17: Linking tensorflow/lite/python/optimize/_pywrap_tensorflow_lite_calibration_wrapper.so failed: (Exit 1): clang failed: error executing command (from target //tensorflow/lite/python/optimize:_pywrap_tensorflow_lite_calibration_wrapper.so) /usr/lib/llvm-17/bin/clang @bazel-out/k8-opt/bin/tensorflow/lite/python/optimize/_pywrap_tensorflow_lite_calibration_wrapper.so-2.params
ld.lld: error: version script assignment of 'global' to symbol 'init_pywrap_tensorflow_lite_calibration_wrapper' failed: symbol not defined
ld.lld: error: version script assignment of 'global' to symbol 'init__pywrap_tensorflow_lite_calibration_wrapper' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: /home/masum/Desktop/Dev-Enviornment/tensorflow/tensorflow/lite/python/analyzer_wrapper/BUILD:9:17: Linking tensorflow/lite/python/analyzer_wrapper/_pywrap_analyzer_wrapper.so failed: (Exit 1): clang failed: error executing command (from target //tensorflow/lite/python/analyzer_wrapper:_pywrap_analyzer_wrapper.so) /usr/lib/llvm-17/bin/clang @bazel-out/k8-opt/bin/tensorflow/lite/python/analyzer_wrapper/_pywrap_analyzer_wrapper.so-2.params
ld.lld: error: version script assignment of 'global' to symbol 'init_pywrap_analyzer_wrapper' failed: symbol not defined
ld.lld: error: version script assignment of 'global' to symbol 'init__pywrap_analyzer_wrapper' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: /home/masum/Desktop/Dev-Enviornment/tensorflow/tensorflow/python/BUILD:646:24: Linking tensorflow/python/_pywrap_tensorflow_internal.so failed: (Exit 1): clang failed: error executing command (from target //tensorflow/python:_pywrap_tensorflow_internal.so) /usr/lib/llvm-17/bin/clang @bazel-out/k8-opt/bin/tensorflow/python/_pywrap_tensorflow_internal.so-2.params
ld.lld: error: version script assignment of 'tensorflow' to symbol 'init_pywrap_tensorflow_internal' failed: symbol not defined
ld.lld: error: version script assignment of 'tensorflow' to symbol '_init_pywrap_tensorflow_internal' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
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: 131.887s, Critical Path: 130.84s
INFO: 555 processes: 76 internal, 479 local.
FAILED: Build did NOT complete successfully

``` Quick note since this is the first google result for this error -- this happens when running with clang 17 or 18, so if you're just trying to build tensorflow then follow the [documentation](https://www.tensorflow.org/install/source#install_clang_recommended_linux_only) and use LLVM 16 / clang 16. Does using clang 16 builds it completely without error? In my case, both were installed. But the configure script preferred clang-17 for some reason for r2.15. For 2.14 and below it prefers clang-14.


On another note, I managed to completely workaround this issue by using a container to build tensorflow instead of using packages and libraries from my host system.
I used Distrobox with Debian-Testing image, installed the necessary packages, used a Python virtual enviornment. And just followed the instructions. Built successfully without any library errors.  @azza-bazoo the documentation now says use Clang-17.... @JohnRTitor ,
Please use the below tested build configurations


Version | Python version | Compiler | Build tools
-- | -- | -- | --
tensorflow-2.16.1 | 3.9-3.12 | Clang 17.0.6 | Bazel 6.5.0

 I do not run Ubuntu 23.10 on my main system anymore and instead have switched to NixOS. Can other participants like @azza-bazoo @AIWintermuteAI test this with the above build tools on Ubuntu 23.10?

Note: to get a specific version of Clang you can use https://apt.llvm.org/ and as for Bazel, just use bazelisk.  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/62416">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/62416">No</a>
 It seems like unnecessary symbol ignores causing issues. At Solus this is how we fixed it with Clang 18: https://github.com/getsolus/packages/blob/dfc56ba57a8af8233a635e309b499ff5d27992f4/packages/t/tensorflow/files/fix-clang-18.diff
### Issue type

Build/Install

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

Yes

### Source

source

### TensorFlow version

2.15

### Custom code

No

### OS platform and distribution

Ubuntu 23.10

### Mobile device

_No response_

### Python version

3.11.5 Anaconda

### Bazel version

6.1.0

### GCC/compiler version

Clang 17.0.4

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

Hi, I was trying to build the release 2.15 myself with the flag march=native. But unfortunately it fails when just building the package builder program using bazel. 

I use a Ryzen 5 7600 CPU with no dedicated graphics (has integrated Radeon graphics). So I was trying to build a CPU only version. (no ROCM, no CUDA. The compiler used was Clang 17.0.4.

### Standalone code to reproduce the issue

```shell
git checkout r2.15
export TF_PYTHON_VERSION=3.11
./configure
# Use -march=native as compiler optimization flag
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
# It fails building here
```


### Relevant log output

```shell
ERROR: /home/masum/.cache/bazel/_bazel_masum/353a8711dbc9282a1a4f3a8a30dc5597/external/upb/BUILD:57:11: Compiling upb/upb.c failed: (Exit 1): clang failed: error executing command (from target @upb//:upb) /usr/lib/llvm-17/bin/clang -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer -g0 ... (remaining 41 arguments skipped)
external/upb/upb/upb.c:192:10: error: defining a type within 'offsetof' is a Clang extension [-Werror,-Wgnu-offsetof-extensions]
  192 |   n &= ~(upb_alignof(upb_arena) - 1);
      |          ^~~~~~~~~~~~~~~~~~~~~~
external/upb/upb/upb.c:183:37: note: expanded from macro 'upb_alignof'
  183 | #define upb_alignof(type) offsetof (struct { char c; type member; }, member)
      |                                     ^~~~~~
/usr/lib/llvm-17/lib/clang/17/include/stddef.h:116:43: note: expanded from macro 'offsetof'
  116 | #define offsetof(t, d) __builtin_offsetof(t, d)
      |                                           ^
1 error generated.
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: 10.105s, Critical Path: 2.83s
INFO: 23 processes: 13 internal, 10 local.
FAILED: Build did NOT complete successfully
```
