Open tokongs opened 1 year ago
I am facing same issue in my setup. Is there a workaround to use this repo com_github_cloudflare_circl in bazel by making some manual changes?
encountered same issue +1
@aman-harness @wenpincui We solved this by patching the generated BUILD.bazel files.
go_repository(
name = "com_github_cloudflare_circl",
build_file_proto_mode = "disable_global",
importpath = "github.com/cloudflare/circl",
patches = [
"//third-party/go/com_github_cloudflare_circl:fp448.patch",
"//third-party/go/com_github_cloudflare_circl:fp25519.patch",
"//third-party/go/com_github_cloudflare_circl:x448.patch",
"//third-party/go/com_github_cloudflare_circl:x25519.patch",
],
sum = "h1:bZgT/A+cikZnKIwn7xL2OBj012Bmvho/o6RpRvv3GKY=",
version = "v1.1.0",
)
fp448.patch
--- math/fp448/BUILD.bazel
+++ math/fp448/BUILD.bazel
@@ -10,6 +10,7 @@ go_library(
"fp_generic.go",
"fp_noasm.go",
],
+ cgo = True,
importpath = "github.com/cloudflare/circl/math/fp448",
visibility = ["//visibility:public"],
deps = [
@@ -28,6 +29,8 @@ alias(
visibility = ["//visibility:public"],
)
+exports_files(["fp_amd64.h"], ["//visibility:public"])
+
go_test(
name = "fp448_test",
srcs = [
x448.patch
--- dh/x448/BUILD.bazel
+++ dh/x448/BUILD.bazel
@@ -12,7 +12,9 @@ go_library(
"doc.go",
"key.go",
"table.go",
+ "//math/fp448:fp_amd64.h",
],
+ cgo = True,
importpath = "github.com/cloudflare/circl/dh/x448",
visibility = ["//visibility:public"],
deps = [
With similar files for fp25519 and x25519
@tokongs thank you!
Thank you @tokongs!!!
Duplicate of #1393
FYI: if you are using bzlmod there is another workaround described in this comment on https://github.com/bazelbuild/rules_go/issues/3799
What version of gazelle are you using?
v0.28.0
What version of rules_go are you using?
v0.37.0
What version of Bazel are you using?
5.3.2
Does this issue reproduce with the latest releases of all the above?
What operating system and processor architecture are you using?
What did you do?
Have a dependency on github.com/cloudflare/circl
The issue occurs when you have a source with a Go assembly file which includes a header file, and the Go code is not CGO.
What did you expect to see?
Expect Gazelle to generate valid BUILD.bazel files for this.
What did you see instead?
The generated BUILD.bazel contains a
go_library
which fails to build because a header is ignored as the library is not marked withcgo=True