Tensorflow failed build due to ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.
Hi @Eva-An ,

Normally this type of error occurs if your CPU not supports AVX instruction sets.starting from TF1.6v and higher TF binaries are prebuilt with AVX instruction sets. This means on any CPU that do not have these instruction sets either CPU or GPU version of TF will fail to load with reported error.

Could you please cross check similar issues #19584 , #21977 and let us know if it helps.

Thanks! Hi @SuryanarayanaY , my machine is a virtual machine and the CPU is Intel(R) Xeon(R) Platinum 8168 CPU. I check on its official [website](https://www.intel.com/content/www/us/en/products/sku/120504/intel-xeon-platinum-8168-processor-33m-cache-2-70-ghz/specifications.html) that it seems to be supportive. Hi @Eva-An ,

I acknowledge that your CPU do support AVX instruction set. Thanks for confirmation.

Currently nightly versions are building using bazel 6.1.0 whereas you are using higher version which may some times cause incompatibility issues. Could you please try with bazel 6.1.0 and let us know outcome.

Thank you!

 Could you please confirm the compiler you are using. Also could you please check whether this flag `/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR` is compatible with clang ? 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/61887">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/61887">No</a>

### Issue type

Bug

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

No

### Source

source

### TensorFlow version

master branch, commit: a442440

### Custom code

No

### OS platform and distribution

Windows Server 2022

### Mobile device

_No response_

### Python version

3.9

### Bazel version

6.3.2

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\CPPTES~1\AppData\Local\Temp\2\Bazel.runfiles_pr3ptqbl\runfiles\org_tensorflow\tensorflow\python\tools\api\generator\create_python_api.py", line 22, in <module>
    from tensorflow.python.tools.api.generator import doc_srcs
  File "C:\Users\CPPTES~1\AppData\Local\Temp\2\Bazel.runfiles_pr3ptqbl\runfiles\org_tensorflow\tensorflow\python\__init__.py", line 37, in <module>
    from tensorflow.python.tpu import api
  File "C:\Users\CPPTES~1\AppData\Local\Temp\2\Bazel.runfiles_pr3ptqbl\runfiles\org_tensorflow\tensorflow\python\tpu\api.py", line 22, in <module>
    from tensorflow.python.tpu import bfloat16
  File "C:\Users\CPPTES~1\AppData\Local\Temp\2\Bazel.runfiles_pr3ptqbl\runfiles\org_tensorflow\tensorflow\python\tpu\bfloat16.py", line 20, in <module>
    from tensorflow.python.framework import dtypes
  File "C:\Users\CPPTES~1\AppData\Local\Temp\2\Bazel.runfiles_pr3ptqbl\runfiles\org_tensorflow\tensorflow\python\framework\dtypes.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\CPPTES~1\AppData\Local\Temp\2\Bazel.runfiles_pr3ptqbl\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow.py", line 77, in <module>
    raise ImportError(
ImportError: Traceback (most recent call last):
  File "C:\Users\CPPTES~1\AppData\Local\Temp\2\Bazel.runfiles_pr3ptqbl\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow.py", line 62, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.


Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors for some common causes and solutions.
If you need help, create an issue at https://github.com/tensorflow/tensorflow/issues and include the entire stack trace above this error message.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
ERROR: F:/tensorflow/tensorflow/tensorflow/tools/pip_package/BUILD:252:10 Middleman _middlemen/tensorflow_Stools_Spip_Upackage_Sbuild_Upip_Upackage.exe-runfiles failed: (Exit 1): bash.exe failed: error executing command (from target //tensorflow:tf_python_api_gen_v2)

### Standalone code to reproduce the issue

```shell
git clone https://github.com/tensorflow/tensorflow.git F:\Tensorflow\tensorflow
cd /d F:\Tensorflow\tensorflow
pip3 uninstall -r tensorflow/tools/ci_build/release/requirements_common.txt --yes
pip3 install -r tensorflow/tools/ci_build/release/requirements_common.txt --upgrade
set PATH=F:\Tensorflow\tensorflow\..\tools;%path%
set PATH=F:\Tensorflow\tensorflow\..\tools\msys64\usr\bin;%path%
yes "" 2>nul | python ./configure.py
C:\Python39\python.exe -m pip install --upgrade pip
set TF_PYTHON_VERSION=3.9
set BAZEL_VC=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC
set BAZEL_VC_FULL_VERSION=14.37.32822
set PATH=F:\Tensorflow\tensorflow\..\tools;%path%
set PATH=F:\Tensorflow\tensorflow\..\tools\msys64\usr\bin;%path%
bazel --output_user_root F:\bazelTemp build --jobs 8 --config=opt --local_ram_resources=4096 --host_cxxopt="/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" --subcommands //tensorflow/tools/pip_package:build_pip_package
```


### Relevant log output

_No response_