tink icon indicating copy to clipboard operation
tink copied to clipboard

Project that uses google/tink cannot be built with bazel

Open brownoxford opened this issue 2 years ago • 2 comments

I've got a project that uses https://github.com/hyperledger/aries-framework-go, which in turn uses https://github.com/google/tink. I'm trying to build my project with Bazel, but am running into the following error:

ERROR: /private/var/tmp/_bazel_cabernet/f52a3d470efd0f5dfdffb7f8715565db/external/com_github_hyperledger_aries_framework_go/pkg/kms/localkms/BUILD.bazel:3:11: no such package '@com_github_google_tink_go//proto/ed25519_go_proto': BUILD file not found in directory 'proto/ed25519_go_proto' of external repository @com_github_google_tink_go. Add a BUILD file to a directory to mark it as a package. and referenced by '@com_github_hyperledger_aries_framework_go//pkg/kms/localkms:localkms'

This appears to have been addressed in 66d9baf, but has not yet been released.

By default, tink is included in go.mod indirectly as a pseudo version when adding aries-framework-go:

github.com/google/tink/go v1.6.1-0.20210519071714-58be99b3c4d0 // indirect

I tried using a pseudo version that pointed to 66d9baf but that did not work either.

brownoxford avatar May 20 '22 14:05 brownoxford

Hi brownoxford, are you still having issues with the build with Bazel? I am not sure I have enough context, but I noticed you've mentioned pinning 66d9baf in your go.mod file, but not in your Bazel WORKSPACE/deps.bzl. Have you updated the Bazel files?

For Go we use Bazel Gazelle for generating Bazel deps and BUILD.bazel files from go.mod

morambro avatar Jul 08 '22 20:07 morambro

Hi @morambro! Yes, I also use Gazelle to generate Bazel deps from go.mod. I don't have access to change the way the third-party project (the one actually including tink) works, so I've implemented the following workaround patch (this is in my WORKSPACE file:

# @com_github_google_tink_go uses Bazel internally for builds, but there are
# some issues in the version we are pulling which must be patched before local
# Bazel builds will work properly.
go_repository(
    name = "com_github_google_tink_go",
    # Do not modify existing BUILD.bazel files
    build_file_generation = "off",
    build_file_proto_mode = "disable_global",
    # Specify non-default build naming convention
    build_naming_convention = "go_default_library",
    importpath = "github.com/google/tink/go",
    patches = ["//:com_github_google_tink_go.patch"],
    sum = "h1:M1kxKye//XPsRJs+DaWPeDgMWK2zuZHWx/easVWhcVc=",
    version = "v1.6.1-0.20210519071714-58be99b3c4d0",
)

com_github_google_tink_go.patch.zip

brownoxford avatar Jul 11 '22 14:07 brownoxford

Closing this issue. If this is still an issue and/or if a feature request or fix is required please open a new issue in https://github.com/tink-crypto/tink-go/issues

morambro avatar Jan 04 '24 10:01 morambro