after executing cargo build --release I got the following error:
error: could not rename dep info: "/home/yaa110/Projects/aaa/target/release/deps/encoding_index_tests-6a08ce72af4801d1.d"
Caused by:
Permission denied (os error 13)
warning: build failed, waiting for other jobs to finish...
error: could not rename dep info: "/home/yaa110/Projects/aaa/target/release/deps/lazy_static-41dddc66c4a9078e.d"
Caused by:
Permission denied (os error 13)
warning: build failed, waiting for other jobs to finish...
error: could not rename dep info: "/home/yaa110/Projects/aaa/target/release/deps/quote-b0341732fb2262ed.d"
Caused by:
Permission denied (os error 13)
warning: build failed, waiting for other jobs to finish...
error: An unknown error occurred
Caused by:
Permission denied (os error 13)
To learn more, run the command again with --verbose.
make: *** [Makefile:12: generate] Error 101
I deleted target folder but it did not help. However, cargo run works fine and compiles the project.
Do you know why these permission denied errors might be happening? Are you running inside of docker or something like that for example? Any other nonstandard filesystem things going on?
Also check SELinux, which might feel compelled to deny for some reason
@alexcrichton project files are mounted as a volume in a docker container (via -v) and cargo build --release works fine in the container (Ubuntu 16.04 64bit with the same rust versions as host OS). However, I couldn't build the project in host OS.
@lukaslueg SELinux is not enabled
Removing both Cargo.lock and target folder solved the problem.
The problem could be repeated using the following commands:
#!/bin/bash -l
cargo new testp --bin
cd testp
echo 'lazy_static = "1.0.0"' >> Cargo.toml
echo '#!/bin/bash -l' > build-in-docker.sh
echo 'cd /prg && cargo build --release' >> build-in-docker.sh
chmod +x build-in-docker.sh
docker run --rm -v $(pwd):/prg --name="prg-make" --entrypoint /prg/build-in-docker.sh -it yaa110/ubuntu-rustup
cargo build --release
After running build command in docker, the user and group of Cargo.lock and target folder is changed to root, so a permission denied error is expected. The problem is not related to Cargo.
This is a known problem with docker: you have to coordinate UIDs inside and outside the container, otherwise everything done by the daemon ends up being owned by root
Ah ok, thanks for the diagnosis @lukaslueg!
I also get the same error when using flatpak-builder and than running cargo build. Removing all the builder files (.flatpak-builder/ and buildDir) fixes the issue.
Most helpful comment
This is a known problem with docker: you have to coordinate UIDs inside and outside the container, otherwise everything done by the daemon ends up being owned by root