bazelbuild / rules_cc

C++ Rules for Bazel
https://bazel.build
Apache License 2.0
181 stars 89 forks source link

Extension file 'tensorflow/core/platform/default/rules_cc.bzl' has errors when install tflite-support-0.4.2 using Bazel 4.2.2 #150

Closed febrifahmi closed 8 months ago

febrifahmi commented 1 year ago

Description of the problem / feature request:

(I also open new issue in tensorflow repository here since I'm not sure whether it is Bazel or Tensorflow/tflite-support related issue.)

I tried to install tflite-support-0.4.2 using bazel on my Raspberry Pi (Raspbian Buster) since I can't install it directly using pip3. I expected that installing from bazel (build pip wheel with Bazel) will result in complete installation of tflite-support. However when I try to build the package it gives me this error. I tried several time but the result is still the same.

This is the ERROR message when I try to build tflite-support-0.4.2 on Bazel 4.2.2:

ERROR: Traceback (most recent call last):
        File "/home/pi/.cache/bazel/_bazel_pi/e377461fba63f25ab8757a7080bd56fe/external/org_tensorflow/tensorflow/core/platform/default/rules_cc.bzl", line 6, column 28, in <toplevel>
                _cc_shared_library = native.cc_shared_library
Error: no native function or rule 'cc_shared_library'
Available attributes: aar_import, action_listener, alias, android_binary, android_device, android_device_script_fixture, android_host_service_fixture, android_instrumentation_test, android_library, android_local_test, android_sdk, android_tools_defaults_jar, apple_binary, apple_cc_toolchain, apple_static_library, available_xcodes, cc_binary, cc_host_toolchain_alias, cc_import, cc_libc_top_alias, cc_library, cc_proto_library, cc_test, cc_toolchain, cc_toolchain_alias, cc_toolchain_suite, config_feature_flag, config_setting, constraint_setting, constraint_value, environment, existing_rule, existing_rules, exports_files, extra_action, fdo_prefetch_hints, fdo_profile, filegroup, genquery, genrule, glob, j2objc_library, java_binary, java_import, java_library, java_lite_proto_library, java_package_configuration, java_plugin, java_proto_library, java_runtime, java_runtime_alias, java_test, java_toolchain, java_toolchain_alias, label_flag, label_setting, ninja_build, ninja_graph, objc_import, objc_library, package, package_group, package_name, platform, propeller_optimize, proto_lang_toolchain, proto_library, py_binary, py_library, py_runtime, py_test, repository_name, sh_binary, sh_library, sh_test, test_suite, toolchain, toolchain_type, xcode_config, xcode_config_alias, xcode_version
ERROR: Analysis of target '//tensorflow_lite_support/tools/pip_package:build_pip_package' failed; build aborted: error loading package '@org_tensorflow//tensorflow': in /home/pi/.cache/bazel/_bazel_pi/e377461fba63f25ab8757a7080bd56fe/external/org_tensorflow/tensorflow/tensorflow.bzl: in /home/pi/.cache/bazel/_bazel_pi/e377461fba63f25ab8757a7080bd56fe/external/org_tensorflow/tensorflow/core/platform/rules_cc.bzl: Extension file 'tensorflow/core/platform/default/rules_cc.bzl' has errors
INFO: Elapsed time: 100.397s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)

When I try to look at org_tensorflow/tensorflow/core/platform/default/rules_cc.bzl and org_tensorflow/tensorflow/tensorflow.bzl it seems that cc_shared_library is there.

Is there any solution to this issue?

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Run bazel build -c opt tensorflow_lite_support/tools/pip_package:build_pip_package to build tflite-support-0.4.2 from source on Raspberry Pi (Raspbian Buster) with Bazel 4.2.2

What operating system are you running Bazel on?

Raspbian Buster

What's the output of bazel info release?

pi@raspberrypi:~/tflite-support-0.4.2 $ bazel info release WARNING: Ignoring JAVA_HOME, because it must point to a JDK, not a JRE. WARNING: Ignoring JAVA_HOME, because it must point to a JDK, not a JRE. INFO: Options provided by the client: Inherited 'common' options: --isatty=1 --terminal_columns=93 INFO: Reading rc options for 'info' from /home/pi/tflite-support-0.4.2/.bazelrc: Inherited 'common' options: --experimental_repo_remote_exec INFO: Reading rc options for 'info' from /home/pi/tflite-support-0.4.2/.bazelrc: Inherited 'build' options: --java_toolchain=//third_party/toolchains/java:tf_java_toolchain --host_java_toolchain=//third_party/toolchains/java:tf_java_toolchain --action_env ANDROID_NDK_HOME --action_env ANDROID_NDK_API_LEVEL --action_env ANDROID_BUILD_TOOLS_VERSION --action_env ANDROID_SDK_API_LEVEL --action_env ANDROID_SDK_HOME --define framework_shared_object=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=local -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --config=short_logs --config=v2 INFO: Found applicable config definition build:short_logs in file /home/pi/tflite-support-0.4.2/.bazelrc: --output_filter=DONT_MATCH_ANYTHING INFO: Found applicable config definition build:v2 in file /home/pi/tflite-support-0.4.2/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1 INFO: Found applicable config definition build:linux in file /home/pi/tflite-support-0.4.2/.bazelrc: --copt=-w --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 release 4.2.2- (@non-git)

If bazel info release returns "development version" or "(@non-git)", tell us how you built Bazel.

I install Bazel using instruction on this page: https://github.com/koenvervloesem/bazel-on-arm

Have you found anything relevant by searching the web?

Not really.

comius commented 8 months ago

This is likely stale. Please reopen if it still makes sense.