question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing file to .bazelrc using --action_env

See original GitHub issue

I have a file called lsan.supp that I want to pass to .bazelrc so that it is loaded every time bazel --config=asan is called.

It is in the same directory and means that some memory leak errors are ignored as test failures.

build:asan --copt=-fsanitize=address --copt=-fno-omit-frame-pointer --linkopt=-fsanitize=address --action_env=LSAN_OPTIONS=suppressions=lsan.supp

This gives me the error:

AddressSanitizer: failed to read suppressions file 'lsan.supp' when I call bazel --config=asan from another directory.

Is there a way to provide this path to .bazelrc in such a way that it is resolved correctly.

Thanks for your help

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kchodorowcommented, Jun 30, 2017

There are other options that resolve %workspace% to your project directory, but --action_env isn’t one of them. We might be able to add that capability to --action_env, looping in @aehlig for opinions on that.

I’m actually surprised it’s ever working for you, since lsan.supp wouldn’t exist in the execution root (never mind the sandbox) unless you’re specifying it as a dependency of your C++ rules. If you are, as a workaround, you could give the absolute path.

0reactions
garryqiancommented, Oct 10, 2022

I have the same issue. Use %workspace% as file path prefix does not work. Any progress on this FR?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Commands and Options | Bazel
This option takes an argument which is to be passed to the compiler for source files that are compiled in the host configuration....
Read more >
How to pass variables to Bazel target build? - Stack Overflow
The user manual page for bazel shows how to use these files, and the use of the --workspace_status_command to populate them. For setting ......
Read more >
bazelrc - Google Git
TensorFlow Bazel configuration file. # This file tries to group and simplify build options for TensorFlow. #. # ----CONFIG OPTIONS----. # Android options:....
Read more >
How to Bazel pass environment variables - Kevin Simper
You can pass environment variables with "--action_env", an example is here bazel build //:myproject --action_env=MYENV=myvalue.
Read more >
How to set xcode version for a project - Google Groups
Is there a way to avoid having to pass --xcode_version=7.3.1 --ios_sdk_version=9.3 to bazel ... You can probably put those commands in your ~/.bazelrc...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found