Set config=dbg environment variable when building grpc as bazel external http_archive dependenct

86 views
Skip to first unread message

nicolo

unread,
Oct 10, 2022, 8:56:12 PM10/10/22
to grpc.io
I'm currently building grpc as an external http_archive dependency in a bazel project. To debug grpc issues, I would like to build grpc with special tracing enabled as described here. This requires the config=dbg environment variable to be set when running make.

I'm using bazel, and working with grpc as an external repo. How might I set this environment variable?

To be specific, I'm currently loading a .bzl file with the following text:

 http_archive(
        name = "com_github_grpc_grpc",
        urls = [
            "https://github.com/grpc/grpc/archive/v1.27.3.tar.gz",
        ]
...

My impression is that I can copy the repo locally and directly modify its BUILD file, setting package specific environment variable with a bazel action, but I'm hoping there's a simpler approach here.

nicolo

unread,
Oct 11, 2022, 3:27:02 AM10/11/22
to grpc.io
D'oh, didn't realize that:
1) Setting the config=dbg environment variable as described in the docs is just the cmake way of doing things. One can alternatively set compilation_mode=dbg in bazel to set the DEBUG preprocessor macro and enable debug tracing, perhaps the tracing environment variables docs can be updated to reflect this alternative mode of enabling debug tracing?
2) Bazel propogates command line arguments and build options through to external dependencies.

Thanks for reading, leaving this post up in case it's helpful to anyone.
Reply all
Reply to author
Forward
0 new messages