Windows build fails with "pywrap_tensorflow_import_lib_file: variable '$<' : no input file"
@AndrewVallette I was getting a similar error and I resolved it by creating a fresh virtual environment and cloning TensorFlow. Please let us know if this helps. @mraunak Thank you, but this did not solve my issue. Today I tried another build in a fresh environment, just in case, but no luck. @AndrewVallette try the command:   "bazel clean --expunge" to clean the bazel cache and then re-rerun the build. I observed you are using --config=mkl, https://github.com/tensorflow/tensorflow/blob/master/.bazelrc#L222 as per the documentation it is yet to be supported on windows. you may need to remove --config=mkl.  Hi, @AndrewVallette 

Could you please check above workaround from @mraunak which may help you to resolve your issue ?

@sachinprasadhs, Could you please look into this issue ? Thank you! @AndrewVallette , Thanks for your time and effort on reporting and investigating on this issue. 
We will look into this issue, meanwhile, can you check the above suggestion and check if that works.
Also, TensorFlow 2.12 is released, could you please give it a try and let us know the outcome. Thanks!

@nitins17 , Do you have any pointers regarding this issue.
cc: @learning-to-play 
 Thank you all for the responses. I don't believe my issue is related to `mkl`, since I know that this is supported (the referenced comment is out of date).

I'll try a build of `2.12`, and I will let you know how that goes! `2.12` still has the same issue. @AndrewVallette please try the command: "bazel clean --expunge" to clean the bazel cache and then re-
run the build Thank you, but I have tried that and it does not resolve the issue. Hi @AndrewVallette and @sachinprasadhs, I ran the bazel build command with all the arguments mentioned in the code to reproduce but was not able to reproduce the error. The build was successful on my end. In such cases, we recommend users start with the basic build command("bazel build --config=opt  //tensorflow/tools/pip_package:build_pip_package") and then add the arguments one by one. Also can you please change the location of TensorFlow folder, (as it will create a new bazel output folder and will refresh the third-party dependency files download)
  @mraunak , Thanks for verifying from your end. 
@AndrewVallette , Could you please follow the above comment and try from your side with the latest stable branch as well as Master branch.
For detailed guide on installing from source on Windows machine, you can follow this link https://www.tensorflow.org/install/source_windows @mraunak Thanks for trying out the build yourself. I can make another attempt next week, where I will start with pruning down the arguments. I still think something is funky with the recent changes to the `bazel` script.. I'll let you know what I find :)  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. The issue is still present when building with just `bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package`.

I still think the problem lies with the empty `"//tensorflow:windows"` field found in `tensorflow/python/BUILD`, which was shown in my original report: https://github.com/tensorflow/tensorflow/blob/d5b57ca93e506df258271ea00fc29cf98383a374/tensorflow/python/BUILD#L369) @learning-to-play , Looks like it is related to the changes you have authored in the change list here https://github.com/tensorflow/tensorflow/commit/4ac2641eadd1d190196f1bcd26b5efdc616d90a3, Could you please take a look into this. Thanks Can you update the Bazel version? Thanks for mentioning that, I did just notice the docs say `5.3.0` for Windows **CPU** builds, but, `5.2.0` is the latest version I've been able to use at this time. I'll look into updating that, and will provide another update soon. I updated to `bazel 5.4.1` and the issue is no longer present, so we can consider this resolved.  It looks like Windows (and only Windows) really does need `5.3.0+`. Thanks again for the help everyone! 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/59938">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/59938">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Build/Install

### Have you reproduced the bug with TF nightly?

Yes

### Source

source

### Tensorflow Version

2.11

### Custom Code

Yes

### OS Platform and Distribution

Windows 10

### Mobile device

_No response_

### Python version

3.10.9

### Bazel version

5.2.0

### GCC/Compiler version

MSVC 2019

### CUDA/cuDNN version

_No response_

### GPU model and memory

CPU build

### Current Behaviour?

```shell
When building `tensorflow 2.11` (and nightly) for Windows (CPU), the bazel build step fails.

`ERROR: C:/tensorflow211/tensorflow/python/BUILD:3776:8: in cmd attribute of genrule rule
//tensorflow/python:pywrap_tensorflow_import_lib_file: variable '$<' : no input file
ERROR: C:/tensorflow211/tensorflow/python/BUILD:3776:8: Analysis of target '//tensorflow/python:pywrap_tensorflow_import_lib_file'
failed
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted:`

The failure occurs at this genrule in python/BUILD:

`tensorflow/python/BUILD:3633`
`genrule(
    name = "pywrap_tensorflow_import_lib_file",
    srcs = [":get_pywrap_tensorflow_import_lib_file"],
    outs = ["_pywrap_tensorflow_internal.lib"],
    cmd = select({
        "//tensorflow:windows": "cp -f $< $@",
        "//conditions:default": "touch $@",  # Just a placeholder for Unix platforms
    }),
    visibility = ["//visibility:public"],
)`

My knowledge of bazel is limited, but it seems that "$<" is blank due to the empty array for //tensorflow:windows here:

`tensorflow/python/BUILD:366`
`dynamic_deps = [":_pywrap_tensorflow_internal.so"] + select({
        "//tensorflow:macos": ["//tensorflow:libtensorflow_framework.%s.dylib" % VERSION],
        "//conditions:default": ["//tensorflow:libtensorflow_framework.so.%s" % VERSION],
        "//tensorflow:windows": [],
    }),`

Any help getting this to build is appreciated. Thanks!
```


### Standalone code to reproduce the issue

```shell
/c/tf211/tensorflow-base/_h_env/Library/bin/bazel build --config=mkl --define=no_tensorflow_py_deps=true --verbose_failures --config=opt 
--copt=-D_copysign=copysign --host_copt=-D_copysign=copysign --cxxopt=-D_copysign=copysign --host_cxxopt=-D_copysign=copysign 
--python_path=/c/tf211/tensorflow-base/_h_env/python.exe 
--action_env=PYTHON_BIN_PATH=/c/tf211/tensorflow-base/_h_env/python.exe 
--action_env=PYTHON_LIB_PATH=/c/tf211/tensorflow-base/_h_env/Lib/site-packages 
'--linkopt=-LC:\tf211\tensorflow-base\_h_env\Library' --strip=always --experimental_cc_shared_library //tensorflow/tools/pip_package:build_pip_package
```


### Relevant log output

```shell
+ /c/tf211/tensorflow-base/_h_env/Library/bin/bazel build --config=mkl --define=no_tensorflow_py_deps=true --verbose_failures --config=opt 
--copt=-D_copysign=copysign --host_copt=-D_copysign=copysign --cxxopt=-D_copysign=copysign --host_cxxopt=-D_copysign=copysign 
--python_path=/c/tf211/tensorflow-base/_h_env/python.exe 
--action_env=PYTHON_BIN_PATH=/c/tf211/tensorflow-base/_h_env/python.exe 
--action_env=PYTHON_LIB_PATH=/c/tf211/tensorflow-base/_h_env/Lib/site-packages 
'--linkopt=-LC:\tf211\tensorflow-base\_h_env\Library' --strip=always --experimental_cc_shared_library //tensorflow/tools/pip_package:build_pip_package
Starting local Bazel server and connecting to it...
WARNING: Option 'java_toolchain' is deprecated
WARNING: Option 'host_java_toolchain' is deprecated
WARNING: Option 'experimental_strict_action_env' is deprecated: Use --incompatible_strict_action_env instead
INFO: Reading 'startup' options from c:\tf211\tensorflow-base\work\.bazelrc: --output_user_root=C:/tmp
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'build' from c:\tf211\tensorflow-base\work\.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Options provided by the client:
  'build' options: --python_path=C:/tf211/tensorflow-base/_h_env/python.exe
INFO: Reading rc options for 'build' from c:\tf211\tensorflow-base\work\.bazelrc:
  'build' options: --define framework_shared_object=true --java_toolchain=@tf_toolchains//toolchains/java:tf_java_toolchain 
--host_java_toolchain=@tf_toolchains//toolchains/java:tf_java_toolchain --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 --config=short_logs --config=v2
INFO: Reading rc options for 'build' from c:\tf211\tensorflow-base\work\.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=C:/tf211/tensorflow-base/_h_env/python.exe --action_env 
PYTHON_LIB_PATH=C:/tf211/tensorflow-base/_h_env/Lib/site-packages 
--python_path=C:/tf211/tensorflow-base/_h_env/python.exe --define=with_xla_support=false 
--define=PREFIX=C:/tf211/tensorflow-base/_h_env --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions 
--define=override_eigen_strong_inline=true
INFO: Found applicable config definition build:short_logs in file c:\tf211\tensorflow-base\work\.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file c:\tf211\tensorflow-base\work\.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:mkl in file c:\tf211\tensorflow-base\work\.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:opt in file c:\tf211\tensorflow-base\work\.tf_configure.bazelrc: --copt=/arch:AVX --host_copt=/arch:AVX
INFO: Found applicable config definition build:windows in file c:\tf211\tensorflow-base\work\.bazelrc: --copt=/W0 --copt=/D_USE_MATH_DEFINES 
--host_copt=/D_USE_MATH_DEFINES --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 --config=monolithic --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI 
--host_copt=-DNOGDI --copt=/experimental:preprocessor --host_copt=/experimental:preprocessor --linkopt=/DEBUG --host_linkopt=/DEBUG --linkopt=/OPT:REF --host_linkopt=/OPT:REF 
--linkopt=/OPT:ICF --host_linkopt=/OPT:ICF --experimental_strict_action_env=true --verbose_failures --distinct_host_configuration=false --copt=/Zc:__cplusplus
INFO: Found applicable config definition build:monolithic in file c:\tf211\tensorflow-base\work\.bazelrc: --define framework_shared_object=false
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (1 packages loaded, 0 targets configured)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (285 packages loaded, 4132 targets configured)
ERROR: C:/tf211/tensorflow-base/work/tensorflow/python/BUILD:3633:8: in cmd attribute of genrule rule 
//tensorflow/python:pywrap_tensorflow_import_lib_file: variable '$<' : no input file
ERROR: C:/tf211/tensorflow-base/work/tensorflow/python/BUILD:3633:8: Analysis of target '//tensorflow/python:pywrap_tensorflow_import_lib_file' failed
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted:
```
</details>