-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permission denied (os error 13) when cargo build #6757
Comments
It sounds like there are some permission issues in your home directory. You may have better luck asking on one of the forums (like https://users.rust-lang.org/) or maybe one of the chat platforms (like Discord). |
@yyh1102 Have you tried changing permissions of your cargo home dir. i.e $ sudo chown -R $(whoami) /Users/lowesyang/.cargo/ |
I'm going to close this, this does not seem to be a cargo issue. |
I've started getting the same recently, I ran it with RUST_LOG=debug and got:
I've added anything that's chowned by root or any other user to the My Not sure how to fix this now. The backtrace is a bit obscur. This is using the rust 1.34 pre-release, but also on 1.33. Edit: If I remove a folder chowned by root, this works fine. Even though the folder is in my exclude list. |
Better error if PathSource::walk can't access something. Reported at #6757 (comment).
I've run into this a couple of times. The |
@chanks answer worked for me. Thanks! |
I am running into this issue with VSCode Remote Try Rust. Cargo prints |
To me also nothing did work. I ran |
I was using VSCode aswell, running |
I just installed rustup and cargo through The system in Ubuntu 20.04 in WSL 2.0. Executing "cargo build" results in:
|
I'm having a similar issue: when using the rustup install command from the rust homepage
I'm running Pop! OS 20.04. |
Running Fedora 32 after time, I've decided to come back after some time to play with Rust:
EDIT: |
I was able to fix this this issue on WSL 2.0 by running.
The Linux Rust installer doesn't check for a compiler toolchain, but seems to assume that you've already got a C linker installed. Hopefully this helps someone else in the future. |
Also on WSL 2.0, the os error 13 doesn't seem to differentiate between being unable to write to a file, failing to execute due to permissions or a missing executable. To fix my problems, |
I'm having this problem on my WSL, installing build-essential, clang and cmake did not worked for me. Tried with sudo, that did not work too. Please advise. [UPDATE]: After installing the mentioned apps, closing and re-openning the WSL command line seems to do the trick. |
close vscode , carcgo clean , cargo run |
it works,but why? How does vscode affect this? |
In some weird way closing vscode and running cargo works as expected. But when vscode is open in a remote session I get |
These are the steps i followed to solve this on WSL 2 with Arch:
I hope this is useful for someone. |
I have the same issue under Arch Linux. I installed EDIT: I just setup rustup for root and tried |
I fixed it by following steps: sudo apt install build-essential |
Tried all of the approaches above :
on WSL 2 with Ubuntu, no luck. Cannot run cargo as sudo as I've used rustup to install cargo. |
This error is also triggered when running things inside This is happening on Mac OS version:
When I tested in my local folder |
I has to do following steps
|
Can reproduce on Arch.
To me, this issue would have been much easier to fix, if the default output included the file which caused the issue. |
macOS fixed by this answer |
i am trying to build vendor in nix and getsame error. knowing where permission denied would help a lot. thank you. |
I also encountered this problem on the $ sudo curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh |
I had this issue yesterday, and running with sudo with the clang and gcc toolchains installed didn't help. I ended up telling cargo to build targets in ~/.cargo/config: [build]
target-dir = "/tmp/cargo-target" I did this so it would be on the tmpfs filesystem instead of my git f2fs one. |
fwiw, running |
I had the same problem. When I reinstalled my os, I downloaded my directories to the cloud. After reinstalling returned my data to home and found this problem. I solved this by recoping code to similar directory which created from scratch. |
Just run |
@huongnguyenduc Aside from this being recommended more than 5 times in just this thread, it doesn’t work for everyone. |
thank you, this very useful. |
For me it's not having permission to write to target dir, then the solution becomes sudo chown -R $(whoami) <project-dir> |
Hi, my issue is
I've tried all the methods here but doesn't work. I am in Ubuntu 22 not WSL but a real OS. |
On unix-like systems like Ubuntu, |
In my case, I was using a Linux system but my project folder was on a mounted hard drive with FAT file system. I formatted the hard drive with Ext4 file system (the same as my Linux system drive), copied over my project folder again, and everything worked okay. |
Closed issue, 50+ upvotes, 0 fix. This issue makes tauri unusable |
Had this issue on Ubuntu WSL2 under Windows 11. Fixed it by installing gcc and clang which were missing, not sure which of the two was actually required |
Problem
After i install rust and cargo using
curl https://sh.rustup.rs -sSf | sh
, and try to build a new project, An error threw:And if i use
sudo cargo build
, it fix.But at some situation i have to use just
cargo build
, how can i solve the problem?Notes
OS: mac OS Mojave 10.14.3
Output of
cargo version
: cargo 1.33.0 (f099fe9 2019-02-12)The text was updated successfully, but these errors were encountered: