Replies: 1 comment 4 replies
-
Ah, you're going to be pretty deep into defining a custom toolchain. I don't have time right now to post in detail about how to go about doing this. Have a look at python/private/py_toolchain_suite.bzl for how the hermetic and local toolchains are defined. It'll show the toolchain types you need to define and what needs to be specified on them. In short, to satisfy current_py_cc_headers, the python/cc:toolchain_type toolchain needs to be configured with the headers. Switching based on copts won't be possible. You could try to detect the global I wouldn't worry about activating based on flags at this early step. Just leave target_compatible_with blank and target_settings blank, register your toolchain first, and get that working. Good luck! |
Beta Was this translation helpful? Give feedback.
-
Hello here, I'm new to bazel, I have a codebase with python extension written in C, currently it use rules_python pre-built interpreter
and it also using pip.parse . now I'm building it with address sanitizer to check error, pre-build python can't load, I need to have a in source build python interpreter, so it use exactly same compiler and I can pass --with-address-sanitizer to configure command, I create following files:
MODULE.bazel
under third_party/python, I have python.BUILD
and configure_sanitizer.patch
and 3.10_tsan.patch
and BUILD
now in root MODULE.bazel,
now python target will use my in-source build python.
original part (I think I don't need them anymore, just keep them for easier reference):
if I replace
with
when I try to build some target, it said
then I try to add
to bazelrc
it gives another error:
how can I resolve it? thanks for advise.
basically I still want to use pre-build python from rules_python for default build, only switch the python runtime to in source build python when detect -fsanitize=xxx in copts, is it possible ?
Beta Was this translation helpful? Give feedback.
All reactions