Repository: tensorflow
Issue: Issues on trying to compile TensorFlow C API for JETSON AGX Xavier using Bazel
Labels: stat:awaiting response,type:build/install,subtype:bazel,TF 2.11

On my JETSON AGX Xavier, with:

cuda: 11.4.315
cuDNN: 8.6.0
tensorrt: 8.5.2.2
jetpack: 5.1.3
python3 -c “import tensorflow as tf; print(‘TensorFlow version:’, tf.version)”
TensorFlow version: 2.11.0

I can’t compile tf with bazel ( bazel --version: bazel 5.3.0 ) , error:

~/tensorflow$ bazel build --config=opt --config=cuda //tensorflow:libtensorflow.so

Starting local Bazel server and connecting to it…
WARNING: The following configs were expanded more than once: [cuda]. For repeatable flags, repeats are counted twice and may lead to unexpected behavior.
INFO: Reading ‘startup’ options from /home/redans/tensorflow/.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
Inherited ‘common’ options: --isatty=1 --terminal_columns=237
INFO: Reading rc options for ‘build’ from /home/redans/tensorflow/.bazelrc:
Inherited ‘common’ options: --experimental_repo_remote_exec
INFO: Reading rc options for ‘build’ from /home/redans/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 --features=-force_no_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for ‘build’ from /home/redans/tensorflow/.tf_configure.bazelrc:
‘build’ options: --action_env PYTHON_BIN_PATH=/usr/bin/python3.9 --action_env PYTHON_LIB_PATH=/usr/local/lib/python3.9/dist-packages --python_path=/usr/bin/python3.9 --action_env PYTHONPATH=/usr/local/lib/python3.9/dist-packages:/usr/local/lib/python3.9/dist-packages:/home/redans/ros2_ws/install/yolov8_ros/lib/python3.9/site-packages:/home/redans/ros2_ws/install/yolov8_msgs/lib/python3.9/site-packages:/home/redans/ros2_ws/install/realsense2_camera_msgs/lib/python3.9/site-packages:/opt/ros/humble/lib/python3.9/site-packages --action_env LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64:/home/redans/local/lib/python3.8/dist-packages/tensorflow:/home/redans/ros2_ws/install/yolov8_msgs/lib:/home/redans/ros2_ws/install/realsense2_camera/lib:/home/redans/ros2_ws/install/realsense2_camera_msgs/lib:/opt/ros/humble/opt/rviz_ogre_vendor/lib:/opt/ros/humble/lib/aarch64-linux-gnu:/opt/ros/humble/lib:/usr/local/cuda-11.4/lib64: --action_env GCC_HOST_COMPILER_PATH=/usr/bin/aarch64-linux-gnu-gcc-9 --config=cuda
INFO: Found applicable config definition build:short_logs in file /home/redans/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /home/redans/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:cuda in file /home/redans/tensorflow/.bazelrc: --repo_env TF_NEED_CUDA=1 --crosstool_top=@local_config_cuda//crosstool:toolchain --@local_config_cuda//:enable_cuda --repo_env=HERMETIC_CUDA_VERSION=12.5.1 --repo_env=HERMETIC_CUDNN_VERSION=9.3.0 --@local_config_cuda//cuda:include_cuda_libs=true
INFO: Found applicable config definition build:cuda in file /home/redans/tensorflow/.tf_configure.bazelrc: --repo_env HERMETIC_CUDA_COMPUTE_CAPABILITIES=7.2
INFO: Found applicable config definition build:opt in file /home/redans/tensorflow/.tf_configure.bazelrc: --copt=-Wno-sign-compare --host_copt=-Wno-sign-compare
INFO: Found applicable config definition build:cuda in file /home/redans/tensorflow/.bazelrc: --repo_env TF_NEED_CUDA=1 --crosstool_top=@local_config_cuda//crosstool:toolchain --@local_config_cuda//:enable_cuda --repo_env=HERMETIC_CUDA_VERSION=12.5.1 --repo_env=HERMETIC_CUDNN_VERSION=9.3.0 --@local_config_cuda//cuda:include_cuda_libs=true
INFO: Found applicable config definition build:cuda in file /home/redans/tensorflow/.tf_configure.bazelrc: --repo_env HERMETIC_CUDA_COMPUTE_CAPABILITIES=7.2
INFO: Found applicable config definition build:linux in file /home/redans/tensorflow/.bazelrc: --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 --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/redans/tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
ERROR: Traceback (most recent call last):
File “/home/redans/.cache/bazel/_bazel_redans/e3bb405f92452fe8b27464d0b3fdd1a7/external/rules_python/python/versions.bzl”, line 734, column 32, in
PLATFORMS = _generate_platforms()
File “/home/redans/.cache/bazel/_bazel_redans/e3bb405f92452fe8b27464d0b3fdd1a7/external/rules_python/python/versions.bzl”, line 723, column 15, in _generate_platforms
} | v.flag_values,
Error: unsupported binary operation: dict | dict
INFO: Found applicable config definition build:cuda in file /home/redans/tensorflow/.bazelrc: --repo_env TF_NEED_CUDA=1 --crosstool_top=@local_config_cuda//crosstool:toolchain --@local_config_cuda//:enable_cuda --repo_env=HERMETIC_CUDA_VERSION=12.5.1 --repo_env=HERMETIC_CUDNN_VERSION=9.3.0 --@local_config_cuda//cuda:include_cuda_libs=true
INFO: Found applicable config definition build:cuda in file /home/redans/tensorflow/.bazelrc: --repo_env TF_NEED_CUDA=1 --crosstool_top=@local_config_cuda//crosstool:toolchain --@local_config_cuda//:enable_cuda --repo_env=HERMETIC_CUDA_VERSION=12.5.1 --repo_env=HERMETIC_CUDNN_VERSION=9.3.0 --@local_config_cuda//cuda:include_cuda_libs=true
WARNING: The following configs were expanded more than once: [cuda]. For repeatable flags, repeats are counted twice and may lead to unexpected behavior.
ERROR: @local_config_cuda//:enable_cuda :: Error loading option @local_config_cuda//:enable_cuda: error loading package ‘’: at /home/redans/.cache/bazel/_bazel_redans/e3bb405f92452fe8b27464d0b3fdd1a7/external/local_tsl/third_party/py/python_init_repositories.bzl:3:6: at /home/redans/.cache/bazel/_bazel_redans/e3bb405f92452fe8b27464d0b3fdd1a7/external/rules_python/python/repositories.bzl:24:6: at /home/redans/.cache/bazel/_bazel_redans/e3bb405f92452fe8b27464d0b3fdd1a7/external/rules_python/python/private/python_register_multi_toolchains.bzl:22:6: initialization of module ‘python/versions.bzl’ failed

Do you have any suggestions?