tensorflow: Windows build fails with "pywrap_tensorflow_import_lib_file: variable '$<' : no input file"

Click to expand!

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?

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

/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

+ /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:

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

@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 😃