Skip to content
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

dev.boringcrypto: documentation related to Bazel #43117

Closed
HakanSunay opened this issue Dec 10, 2020 · 2 comments
Closed

dev.boringcrypto: documentation related to Bazel #43117

HakanSunay opened this issue Dec 10, 2020 · 2 comments
Labels
Documentation FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.

Comments

@HakanSunay
Copy link

Hello folks,

Apologies for not sticking to the template, but this is just a question and a kind request for some documentation updates.
I have a couple of questions related to the Bazel build when using dev.boringcrypto.

https://github.com/golang/go/tree/dev.boringcrypto/misc/boring#building-from-bazel
Here is the snippet:


Building from Bazel

Starting from bazelbuild/rules_go tag 0.7.1, simply download the BoringCrypto-enabled Go SDK using go_download_sdk() before calling go_register_toolchains().

For example, to use Go 1.9.3 with BoringCrypto on Linux, use the following lines in WORKSPACE:

load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_download_sdk", "go_register_toolchains")

go_rules_dependencies()

go_download_sdk(
    name = "go_sdk",
    sdks = {
       "linux_amd64": ("go1.9.3b4.linux-amd64.tar.gz", "db1997b2454a2f27669b849d2d2cafb247a55128d53da678f06cb409310d6660"),
    },
    urls = ["https://storage.googleapis.com/go-boringcrypto/{}"],
)

go_register_toolchains()

Note: you must not enable pure mode, since cgo must be enabled. To ensure that binaries are linked with BoringCrypto, you can set pure = "off" on all relevant go_binary rules.


Now that I have refreshed your cache, let me present the questions:

  1. Is this documentation up-to-date?
  2. I can't help but notice that in the Note section you have explicitly mentioned that the pure mode must be disabled. Looking into its default value I can see that it is set to auto https://github.com/bazelbuild/rules_go/blob/master/go/core.rst#attributes-2 If auto, pure mode is enabled when no C/C++ toolchain is configured or when cross-compiling. It is also suggested to control this on the command line --@io_bazel_rules_go//go/config:pure, where its default value is false. I just wanted someone to confirm that if nothing is done explicitly, it will be default to the first case and be set to auto, therefore rely on the C/C++ toolchain or cross-compilation.
  3. Since compiling binaries with dev.boringcrypto requires CGO to be enabled, does one need to set cgo=True in every go_binary and go_library or having this only in the main package's is sufficient?

Overall, I would love if someone could elaborate on the Bazel build process when consuming dev.boringcrypto and I personally feel like having a FAQ would greatly benefit the community.

@ALTree ALTree added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Dec 11, 2020
@ALTree
Copy link
Member

ALTree commented Dec 13, 2020

cc @FiloSottile @rolandshoemaker

@seankhliao seankhliao changed the title dev.boringcrypto documentation related to Bazel dev.boringcrypto: documentation related to Bazel Jun 18, 2021
@seankhliao
Copy link
Member

boringcrypto is now enabled by setting GOEXPERIMENT in a mainline release.
bazel should be able to handle this.

@golang golang locked and limited conversation to collaborators Aug 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

4 participants