cycle in dependency graph (self-edge)

1,448 views
Skip to first unread message

Matt

unread,
Jun 18, 2021, 9:46:09 AM6/18/21
to bazel-discuss
hi,

I have a "cycle in dependency (self-edge)" error and not sure what it's wrong
=====
bazel run '@buildlib//ide-tools:bazel-hie-bios' --override_repository
buildlib=/home/teto/project/buildlib --verbose_explanations
--explain=toto.txt --discard_analysis_cache
INFO: Invocation ID: 8ab2bdde-6a06-478e-9661-58b8e3787125
ERROR: /home/teto/.cache/bazel/_bazel_teto/5ecc33ff651f3346fb162deaee54ab82/external/buildlib/ide-tools/BUILD.bazel:5:10:
in sh_binary rule @buildlib//ide-tools:bazel-hie-bios: cycle in
dependency graph:
.-> @buildlib//ide-tools:bazel-hie-bios [self-edge]
`--
This cycle occurred because of a configuration option
ERROR: Analysis of target '@buildlib//ide-tools:bazel-hie-bios'
failed; build aborted
INFO: Elapsed time: 0.079s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0
targets configured)
======

There is a project (i.e. with a WORKSPACE file) A that references two
others: B and @buildlib. From A, I try to run the shell script
@buildlib//ide-tools:bazel-hie-bios defined in
buildlib/ide-tools/BUILD.bazel via (that's the whole file).
```
sh_binary( name = "bazel-hie-bios", srcs = ["bazel-hie-bios"],
visibility = ["//visibility:public"], )
```

I dont get what's the cycle here ?

Cheers,
Matt

Daniel Halperin

unread,
Jun 18, 2021, 1:16:25 PM6/18/21
to Matt, bazel-discuss
sh_binary( name = "bazel-hie-bios",  srcs = ["bazel-hie-bios"],

The issue is that name == srcs.

Are you missing an extension on your srcs? Like .sh?

Dan

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CADHp1NzwwgGzS%3D1WVMGP2Z7EAGAZbCg3xJ7Vd3KK7K5vHOpf%2Bg%40mail.gmail.com.

Matt

unread,
Jun 21, 2021, 11:27:19 AM6/21/21
to Daniel Halperin, bazel-discuss
thanks for the answers, you are all right, having the same name for
the target as a source name was the issue. I was told that there are
implicit rules for files so a file A/B/X is available via //A/B:X
hence the clash in names. Renaming the source file solved it. Thanks a
lot !
Reply all
Reply to author
Forward
0 new messages