bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Bazel Query in Bazel 1.2.1 errors out due to bazel-internal code

Open bmzhao opened this issue 6 years ago • 10 comments

Description of the problem / feature request:

bazel query deps in bazel 1.2.1 on targets that use android trigger the following error:

ERROR: /usr/local/google/home/bmzhao/.cache/bazel/_bazel_bmzhao/5dcb290106c1a06f5bc5c8d08ceb177f/external/bazel_tools/tools/android/BUILD:39:1: no such target '//external:android/d8_jar_import': target 'android/d8_jar_import' not declared in package 'external' (did you mean 'android/dx_jar_import'?) defined by /usr/local/google/home/bmzhao/Code/tensorflow/WORKSPACE and referenced by '@bazel_tools//tools/android:d8_dexbuilder'

This error is caused by this line: https://github.com/bazelbuild/bazel/blame/master/tools/android/BUILD.tools#L44

This also breaks Tensorflow's CI, since we run 'bazel query "deps((//tensorflow/...))"`, and its picking up this internal bazel dep that errors out.

Feature requests: what underlying problem are you trying to solve with this feature?

We are migrating Tensorflow to bazel 1.2.1. This is part of the work for tensorflow's build refactoring (https://github.com/tensorflow/community/pull/179), which uses bazel's new cc_shared_library.

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

git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git checkout 1d41edaee62e27c8c1552b83fcb46dd45e5a64d4 # known-clean-commit
echo '1.2.1\n' > .bazelversion
bazelisk query "deps((//tensorflow/... - kind('android_*', //tensorflow/...)))"

What operating system are you running Bazel on?

Linux

What's the output of bazel info release?

release 1.2.1

bmzhao avatar Jan 08 '20 23:01 bmzhao

Looks like this is introduced by https://github.com/bazelbuild/bazel/commit/8d866f3259957b5cdda5d29c57fd8bdc3df85d8f /cc @gyias @jin

meteorcloudy avatar Jan 09 '20 09:01 meteorcloudy

I can reproduce this. The current workaround is to use --keep_going with query, or use cquery.

jin avatar Jan 09 '20 18:01 jin

@gyias has a fix for this. We'll probably want to cherry pick this into 1.2.2 and 2.1.

jin avatar Jan 09 '20 18:01 jin

I guess we need to cherry pick it into 1.2.2 and 2.0.1? 2.1 is not cut yet, but should include the fix. /cc @laurentlb @aehlig

meteorcloudy avatar Jan 10 '20 09:01 meteorcloudy

I can cherry-pick it in 2.1 (was cut yesterday).

1.2.1 was released in November. We usually don't do cherry-picks for older versions.

laurentlb avatar Jan 10 '20 11:01 laurentlb

The fix commit has been merged - 733ac0ff7ad1e13ab68ceb2fde694d7ab71b2366

gyias avatar Jan 10 '20 18:01 gyias

@laurentlb Please cherry-pick 733ac0f for 2.1

meteorcloudy avatar Jan 13 '20 09:01 meteorcloudy

@aehlig We probably also want to do a patch release for 2.0. @bmzhao What do you think of migrating TF to 2.0.1 once we have the patch release?

meteorcloudy avatar Jan 13 '20 09:01 meteorcloudy

@meteorcloudy I'm currently working on getting TF building with bazel 2.0, as part of the the cc_shared_library work! I'm still looking into on a few build failures, but once that's landed, it should make it easy to integrate with the bazel 2.0.1 patch release.

bmzhao avatar Jan 15 '20 02:01 bmzhao

Awesome, thanks!

meteorcloudy avatar Jan 15 '20 09:01 meteorcloudy