Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails when updating gazelle from 0.25 to 0.26 #1290

Closed
shlomi-dr opened this issue Jun 30, 2022 · 4 comments · Fixed by #1367
Closed

Build fails when updating gazelle from 0.25 to 0.26 #1290

shlomi-dr opened this issue Jun 30, 2022 · 4 comments · Fixed by #1367

Comments

@shlomi-dr
Copy link

What version of gazelle are you using?

0.25, trying to upgrade to 0.26

What version of rules_go are you using?

0.33

What version of Bazel are you using?

5.0.0-homebrew

Does this issue reproduce with the latest releases of all the above?

When building with 0.25 (nogo disabled), it all works fine. Trying with 0.26 (also nogo disabled), running

bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies -prune

returns:

every rule of type _gazelle_runner implicitly depends upon the target '@bazel_gazelle//internal:gazelle.bash.in', but this target could not be found because of: no such target '@bazel_gazelle//internal:gazelle.bash.in': target 'gazelle.bash.in' not declared in package 'internal'; however, a source file of this name exists. (Perhaps add 'exports_files(["gazelle.bash.in"])' to internal/BUILD?) defined by /private/var/tmp/_bazel_shlomi/377fe1abf71cc2dfc5e9b7dce9e70639/external/bazel_gazelle/internal/BUILD.bazel

What operating system and processor architecture are you using?

Mac M1, Big Sur

What did you do?

Tried to upgrade gazelle, ultimately to resolve another problem related to nogo and go1.18 (see bazel-contrib/rules_go#3212)

What did you expect to see?

Success

What did you see instead?

Failure 🤷‍♂️

@illicitonion
Copy link
Contributor

Was there any error printed before this?

I ran into the same issue, and the full error was:

ERROR: Traceback (most recent call last):
	File "/private/var/tmp/_bazel_dwagnerhall/7d9293ff1db4a8b7a6f59c6e2546b3e0/external/bazel_gazelle/internal/BUILD.bazel", line 19, column 26, in <toplevel>
		gazelle_binary_test_suite()
	File "/private/var/tmp/_bazel_dwagnerhall/7d9293ff1db4a8b7a6f59c6e2546b3e0/external/bazel_gazelle/internal/gazelle_binary_test.bzl", line 27, column 19, in gazelle_binary_test_suite
		unittest.suite(
	File "/private/var/tmp/_bazel_dwagnerhall/7d9293ff1db4a8b7a6f59c6e2546b3e0/external/bazel_skylib/lib/unittest.bzl", line 269, column 18, in _suite
		test_rule(name = test_name)
Error: 'struct' object is not callable
ERROR: /path/to/BUILD.bazel:21:8: every rule of type _gazelle_runner implicitly depends upon the target '@bazel_gazelle//internal:gazelle.bash.in', but this target could not be found because of: no such target '@bazel_gazelle//internal:gazelle.bash.in': target 'gazelle.bash.in' not declared in package 'internal'; however, a source file of this name exists.  (Perhaps add 'exports_files(["gazelle.bash.in"])' to internal/BUILD?) defined by /private/var/tmp/_bazel_dwagnerhall/7d9293ff1db4a8b7a6f59c6e2546b3e0/external/bazel_gazelle/internal/BUILD.bazel

which I resolved by updating skylib.

@asv
Copy link
Contributor

asv commented Sep 19, 2022

Fix from @illicitonion solved problem, but maybe we'are should update skylib in gazelle itself?

@MewX
Copy link

MewX commented Nov 13, 2022

Same issue from 0.25 -> 0.27

@morozov
Copy link

morozov commented Nov 13, 2022

In my understanding, this issue cannot be resolved in Gazelle since it's just a victim of how Bazel handles (in this case, transient) dependencies.

Gazelle 0.25.0 and newer requires bazelbuild/bazel-skylib@df3c9e2 (a commit prior to the 1.1.0 release) but some of the dependencies declared in the workspace prior to Gazelle may make Bazel use an older version of Skylib.

In my case, it's Protobuf v3.14.0 which requires Skylib 1.0.2.

You can check the actual Skylib version by running this:

cat "$(bazel info output_base)/external/bazel_skylib/version.bzl"

If it's not what Gazelle expects, then it's the problem.

There are three ways to solve this problem on the affected project's side:

  1. Reorder dependencies in the WORKSPACE file to make Gazelle require the proper version of Skylib prior to having some other dependency require an older version.
  2. If possible, update other dependencies to the versions that require a newer version of Skylib.
  3. Introduce an explicit dependency on Skylib 1.1.x in the WORKSPACE File prior to all other dependencies.

katexochen added a commit to edgelesssys/constellation that referenced this issue Feb 1, 2023
malt3 pushed a commit to edgelesssys/constellation that referenced this issue Feb 14, 2023
malt3 pushed a commit to edgelesssys/constellation that referenced this issue Feb 14, 2023
malt3 pushed a commit to edgelesssys/constellation that referenced this issue Mar 1, 2023
malt3 pushed a commit to edgelesssys/constellation that referenced this issue Mar 1, 2023
malt3 pushed a commit to edgelesssys/constellation that referenced this issue Mar 3, 2023
malt3 pushed a commit to edgelesssys/constellation that referenced this issue Mar 8, 2023
malt3 pushed a commit to edgelesssys/constellation that referenced this issue Mar 9, 2023
malt3 pushed a commit to edgelesssys/constellation that referenced this issue Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants