Skip to content

cgo=0 of github.com/cloudflare/circl does not compile #3799

@hugelgupf

Description

@hugelgupf

What version of rules_go are you using?

v0.43.0

What version of gazelle are you using?

v0.34.0

What version of Bazel are you using?

7.0.0

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

yes

What operating system and processor architecture are you using?

x86 / linux

What did you do?

I pulled in a go_repository that depended on github.com/cloudflare/circl
(CGO_ENABLED=0 go build ./... works in circl).

Compiling, I got:

ERROR: /usr/local/google/home/chrisko/.cache/bazel/_bazel_chrisko/9c6102c63dcce3ba37133cceee0f9e68/external/com_github_u-root_u-root/vendor/github.com/cloudflare/circl/dh/x25519/BUILD.bazel:3:11: GoCompilePkg external/com_github_u-root_u-root/vendor/github.com/cloudflare/circl/dh/x25519/x25519.a failed: (Exit 1): builder failed: error executing GoCompilePkg command (from target @@com_github_u-root_u-root//vendor/github.com/cloudflare/circl/dh/x25519:x25519) bazel-out/k8-opt-exec-ST-397274ff1547/bin/external/go_sdk/builder_reset/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src ... (remaining 41 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/com_github_u-root_u-root/vendor/github.com/cloudflare/circl/dh/x25519/curve_amd64.s:7: #include: open external/com_github_u-root_u-root/vendor/github.com/cloudflare/circl/math/fp25519/fp_amd64.h: no such file or directory
compilepkg: error running subcommand external/go_sdk/pkg/tool/linux_amd64/asm: exit status 1

So I tracked down the fact that assembly files in cgo packages are not included in pure compilation (#3798 -- though I don't think it's entirely correct), after which the following happens:

[...] Snip [...]
github.com/u-root/u-root/vendor/github.com/cloudflare/circl/sign/ed25519.(*pointR1).toAffine: relocation target github.com/u-root/u-root/vendor/github.com/cloudflare/circl/math/fp25519.modpAmd64 not defined
github.com/u-root/u-root/vendor/github.com/cloudflare/circl/sign/ed25519.(*pointR1).FromBytes: relocation target github.com/u-root/u-root/vendor/github.com/cloudflare/circl/math/fp25519.sqrAmd64 not defined
github.com/u-root/u-root/vendor/github.com/cloudflare/circl/sign/ed25519.(*pointR1).FromBytes: relocation target github.com/u-root/u-root/vendor/github.com/cloudflare/circl/math/fp25519.mulAmd64 not defined
github.com/u-root/u-root/vendor/github.com/cloudflare/circl/sign/ed25519.(*pointR1).FromBytes: relocation target github.com/u-root/u-root/vendor/github.com/cloudflare/circl/math/fp25519.subAmd64 not defined
github.com/u-root/u-root/vendor/github.com/cloudflare/circl/sign/ed25519.(*pointR1).FromBytes: relocation target github.com/u-root/u-root/vendor/github.com/cloudflare/circl/math/fp25519.addAmd64 not defined
github.com/u-root/u-root/vendor/github.com/cloudflare/circl/sign/ed25519.(*pointR1).FromBytes: relocation target github.com/u-root/u-root/vendor/github.com/cloudflare/circl/math/fp25519.modpAmd64 not defined
github.com/u-root/u-root/vendor/github.com/cloudflare/circl/sign/ed25519.(*pointR1).double: relocation target github.com/u-root/u-root/vendor/github.com/cloudflare/circl/math/fp25519.addAmd64 not defined
github.com/u-root/u-root/vendor/github.com/cloudflare/circl/sign/ed25519.(*pointR1).double: relocation target github.com/u-root/u-root/vendor/github.com/cloudflare/circl/math/fp25519.sqrAmd64 not defined
external/go_sdk/pkg/tool/linux_amd64/link: too many errors
link: error running subcommand external/go_sdk/pkg/tool/linux_amd64/link: exit status 2

Presumably because https://github.com/cloudflare/circl/blob/main/math/fp25519/fp_noasm.go is not included in compilation. (Which puzzles me actually, because I don't understand how it is included in regular CGO_ENABLED=0 compilation of the package. I haven't been able to track that down.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions