bytecodealliance / bytecodealliance/cargo-component
Error: Unable to create cache directory
- Dominant language
- Rust
- Stars
- 593
- Forks
- 68
- PR merge metrics
- No merged PRs in 30d
Description
## Description
I build my repository in CI/CD by checking out the repository, and then mounting it into a docker container in which I execute the build using CMake/Make.
The image for the container used to have cargo-component `v0.15.0`, and everything worked fine.
I am in the process of trying to upgrade my build image to use cargo-component `v0.21.1`, and I suddenly started getting the following error:
```
[ 50%] Performing build step for 'MyComponent'
cd /home/.../src/MyComponent-build && cargo component build -r --target wasm32-unknown-unknown --manifest-path /home/.../my-component/Cargo.toml --target-dir /home/.../build/MyComponent
Error: Unable to create cache directory
Caused by:
Permission denied (os error 13)
```
### Root cause
Presumably this is because I am running the build as a non-root user within the docker container and code was added that attempts to create a cache directory in a permissioned space.
### Workaround
For anyone else experiencing this issue, I've found the following workaround:
Manually set a value for the `CARGO_COMPONENT_CACHE_DIR` environment variable. e.g. `export CARGO_COMPONENT_CACHE_DIR=.cargo-component-cache`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.