How do I provide a py_binary’s runfiles to a C toolchain in Bazel

I am trying to write a compiler, well, a Python wrapper for Clang that does some platform specific stuff in Bazel. I have created a MRE where I can reproduce my problem here: https://github.com/allsey87/custom_cc_toolchain

The workspace is supposed to be built using the following command:

bazel build --platforms=//:custom_platform //:test

Based on the following output from Bazel, I think my py_binary has been created and is found, however, there is a failing assertion from the Bazel’s Python wrapper code as follows:

$ bazel clean --expunge
INFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes.
$ bazel build --verbose_failures --sandbox_debug --platforms=//:custom_platform //:test 
Starting local Bazel server and connecting to it...
WARNING: --enable_bzlmod is set, but no MODULE.bazel file was found at the workspace root. Bazel will create an empty MODULE.bazel file. Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. For more details, please refer to https://github.com/bazelbuild/bazel/issues/18958.
INFO: Analyzed target //:test (87 packages loaded, 754 targets configured).
ERROR: /workspaces/bazel_test/BUILD:23:10: Compiling empty.c failed: (Exit 1): process-wrapper failed: error executing CppCompile command 
  (cd /home/developer/.cache/bazel/_bazel_developer/e4895a8da4e216f782d166038e1bbca2/sandbox/processwrapper-sandbox/1/execroot/_main && 
  exec env - 
    PATH=/vscode/vscode-server/bin/linux-x64/5437499feb04f7a586f677b155b039bc2b3669eb/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 
    PWD=/proc/self/cwd 
    TMPDIR=/tmp 
  /home/developer/.cache/bazel/_bazel_developer/install/937e6e0d806e40997135c14c1d61532a/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/home/developer/.cache/bazel/_bazel_developer/e4895a8da4e216f782d166038e1bbca2/sandbox/processwrapper-sandbox/1/stats.out' bazel-out/k8-opt-exec-ST-d57f47055a04/bin/clang_wrapper -MD -MF bazel-out/k8-fastbuild/bin/_objs/test/empty.d '-frandom-seed=bazel-out/k8-fastbuild/bin/_objs/test/empty.o' -iquote . -iquote bazel-out/k8-fastbuild/bin -iquote external/bazel_tools -iquote bazel-out/k8-fastbuild/bin/external/bazel_tools -c empty.c -o bazel-out/k8-fastbuild/bin/_objs/test/empty.o)
Traceback (most recent call last):
  File "/home/developer/.cache/bazel/_bazel_developer/e4895a8da4e216f782d166038e1bbca2/sandbox/processwrapper-sandbox/1/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/clang_wrapper", line 559, in <module>
    Main()
  File "/home/developer/.cache/bazel/_bazel_developer/e4895a8da4e216f782d166038e1bbca2/sandbox/processwrapper-sandbox/1/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/clang_wrapper", line 457, in Main
    module_space = FindModuleSpace(main_rel_path)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/developer/.cache/bazel/_bazel_developer/e4895a8da4e216f782d166038e1bbca2/sandbox/processwrapper-sandbox/1/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/clang_wrapper", line 172, in FindModuleSpace
    raise AssertionError('Cannot find .runfiles directory for %s' % sys.argv[0])
AssertionError: Cannot find .runfiles directory for bazel-out/k8-opt-exec-ST-d57f47055a04/bin/clang_wrapper
Target //:test failed to build
INFO: Elapsed time: 5.067s, Critical Path: 0.05s
INFO: 7 processes: 7 internal.
ERROR: Build did NOT complete successfully

How can I provide this .runfiles directory to the toolchain?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật