-
Notifications
You must be signed in to change notification settings - Fork 377
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
Imports of headers not handled inside inline assembly files (.s or .h) #1393
Comments
I'm seeing the same error with go-git. @esprehn were you able to find a solution? |
Same issue here |
same here |
I'm having the same issue on the latest version |
FYI: if you are using bzlmod there is another workaround described in this comment on bazelbuild/rules_go#3799 |
What version of gazelle are you using?
v0.26.0
What version of rules_go are you using?
v0.35.0
What version of Bazel are you using?
5.1.10
Does this issue reproduce with the latest releases of all the above?
yes.
What operating system and processor architecture are you using?
Mac OS M1 and Linux Intel.
What did you do?
We're trying to use
github.com/go-git/go-git/v5
which depends on
github.com/cloudflare/circl
which contains a number of inline assembly files
which contain relative imports of includes across package boundaries, for example:
https://github.com/cloudflare/circl/blob/c56c51d2526f71be07939782d59d1a98744e062c/dh/x448/curve_amd64.s#L6
#include "../../math/fp448/fp_amd64.h"
which fails the build because the headers cannot be found at build time.
What did you expect to see?
Build passes.
What did you see instead?
gazelle does not appear to handle import statements in header files for assembly, which breaks popular libraries like the go-git library.
Gazelle should probably generate go_source() targets inside packages that contain .h files, ex. here:
https://github.com/cloudflare/circl/tree/main/math/fp448
and gazelle should also take a dependency on other packages when a cross project important statement appears in a .h or .s file.
In particular the dependency parser here:
https://github.com/bazelbuild/bazel-gazelle/blob/ec1c643571ece7bb5cac359b96c17b3641638c5d/language/go/fileinfo.go
should parse .s files and resolve relative import statements to absolute paths within the repo. And then produce cross project deps based on those just like import statements in .go code.
gazelle should also produce go_source() rules whenever there's a .h file within a package.
We fixed this in our repo with a series of patches like below, but ideally this would be generated by gazelle itself.
patches/com_github_cloudflare_circl/math_fp25519_BUILD_bazel.patch
patches/com_github_cloudflare_circl/source/dh_x25519_BUILD_bazel.new
cc/ @skevy @indygreg
The text was updated successfully, but these errors were encountered: