bazelbuild / bazelbuild/bazel

bazel6.5.0 for risc-v

Open
#23,162 1 comment 0 reactions 0 assignees View on GitHub
help wanted P3 team-OSS type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

Because I want to build tensorflow2.17.0, it is necessary to build bazel6.5.0.
I made some modifications to bazel6.5.0 and built the binaries using the following steps
```
wget https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-dist.zip
mkdir bazel-dist; cd bazel-dist
mv ../bazel-6.5.0-dist.zip .
unzip bazel-6.5.0-dist.zip
rm bazel-6.5.0-dist.zip
wget https://raw.githubusercontent.com/6eanut/NOTEBOOK/main/24-Q3/tensorflow/patch/bazel-6.5.0-dist.patch
patch -p1 < bazel-6.5.0-dist-riscv-v0.patch
tar -czhf remotejdk11_linux_riscv64.tar.gz -C /usr/lib/jvm java-11-openjdk
EMBED_LABEL="6.5.0" EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" ./compile.sh
```
more info
```
$ uname -a
Linux openeuler-riscv-4-2 6.6.0 #1 SMP Tue Jul 2 11:21:06 CST 2024 riscv64 riscv64 riscv64 GNU/Linux
$ bazel version
Build label: 6.5.0
Build target: bazel-out/riscv64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jul 30 08:20:13 2024 (1722327613)
Build timestamp: 1722327613
Build timestamp as int: 1722327613
```
Later, I had the following problem when building tensorflow
```
$ bazel build //tensorflow/tools/pip_package:wheel --repo_env=WHEEL_NAME=tensorflow
INFO: Reading 'startup' options from /home/tf2170/tensorflow/.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=121
INFO: Reading rc options for 'build' from /home/tf2170/tensorflow/.bazelrc:
Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /home/tf2170/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 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from /home/tf2170/tensorflow/.tf_configure.bazelrc:
'build' options: --action_env PYTHON_BIN_PATH=/home/tf2170/venv00/bin/python3 --action_env PYTHON_LIB_PATH=/home/tf2170/venv00/lib/python3.11/site-packages --python_path=/home/tf2170/venv00/bin/python3
INFO: Found applicable config definition build:short_logs in file /home/tf2170/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /home/tf2170/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:linux in file /home/tf2170/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 --copt=-Wno-error=unused-but-set-variable --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/tf2170/tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
ERROR: /DEFAULT.WORKSPACE.SUFFIX:80:31: syntax error at '}': expected :
ERROR: Error computing the main repository mapping: error loading package 'external': Failed to parse default WORKSPACE file suffix
Loading:
```
I'm not sure if this problem is caused by tensorflow or bazel
I wonder if there is a way to detect if bazel is successfully built complete

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the `bazel build //tensorflow/tools/pip_package:wheel` command with Bazel 6.5.0 and inspect `/DEFAULT.WORKSPACE.SUFFIX:80:31`, using the reported `bazel-6.5.0-dist.patch` and `compile.sh` context. Compare whether the parse failure comes from Bazel or TensorFlow, and document a reliable way to detect a complete Bazel build.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, tensorflow
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.