bazel-contrib / bazel-contrib/rules_cuda
Any possible way to set the host_compiler explicitly instead of inferring from current toolchain?
- Dominant language
- Starlark
- Stars
- 122
- Forks
- 73
- Avg merge
- 7h 34m
- Merged PRs (30d)
- 7
Description
This sounds like a weird request, and here's my use case.
I use a customized C++ toolchain in my project. In order to use ccache, I wrap the actually compiling command into a script, and put the script path as tool_path in the toolchain definition.
```
tool_path(
name = "gcc",
path = "/path/to/wrap-script",
),
```
When using `cuda_library`, `/path/to/wrap-script` appears as the parameter after `nvcc -ccbin`, this will cause nvcc hangs forever. The correct way of using ccache for cuda libraries is to wrap the nvcc call with ccache, not gcc. This is why I want to set the host_compiler explicitly.
I'm not sure whether I'm using it correctly, or there's an existing way to bypass it. Thanks in advance for any suggestion.
Contributor guide
Research direction
Start by tracing how cuda_library derives the value passed to nvcc -ccbin from the toolchain's tool_path("gcc") setting. Reproduce the wrapper-script case described in the issue and determine how an explicit host compiler should bypass that inference. Done means the configured host compiler is passed to nvcc without causing the wrapper script to be used as -ccbin.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system, compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100