如何阻止/删除rustc编译Rust库时生成的rmeta文件及相关问题
问题描述
在Windows系统下构建Rust库时,每次执行rustc src/lib.rs --crate-type lib命令编译库,根目录都会生成无法删除的文件夹。
已尝试的解决方法
- 修改文件夹权限时提示:
You do not have permission to view or edit this object's permission settings. - 常规删除文件夹时提示:
You require permission from the computer's administrator to make changes to this folder(即使当前账号是管理员)。 - 通过WSL查看文件夹权限,输出如下:
COMPUTERNAME:/path/to/files$ ls -la ls: ./rmetav34fQE: No such file or directory ls: ./rmetaQoN7tZ: No such file or directory ls: ./rmetalnhtFb: No such file or directory ls: ./rmetapLSIJu: No such file or directory ls: ./rmetalAhWCV: No such file or directory ls: ./rmetay2oX6j: No such file or directory ls: ./rmeta5PoZrb: No such file or directory ls: ./rmetaynngfa: No such file or directory ls: ./rmetaXdgJbr: No such file or directory ls: ./rmetalxpcGH: No such file or directory ls: ./rmetavvYhBF: No such file or directory ls: ./rmetaV5MmHj: No such file or directory ls: ./rmetatO66wd: No such file or directory ls: ./rmetaAzjiVn: No such file or directory ls: ./rmetatl9WSy: No such file or directory total 640 drwxrwxrwx 1 username username 512 Apr 30 23:31 . drwxrwxrwx 1 username username 512 Jun 20 2023 .. drwxrwxrwx 1 username username 512 Apr 30 23:32 .git -rwxrwxrwx 1 username username 28 May 1 01:46 .gitignore -rwxrwxrwx 1 username username 153 Apr 30 23:58 Cargo.lock -rwxrwxrwx 1 username username 178 Apr 30 23:58 Cargo.toml -rwxrwxrwx 1 username username 16 Apr 30 23:34 README.md -rwxrwxrwx 1 username username 90406 May 1 02:01 liblib.rlib drwxrwxrwx 1 username username 512 Apr 30 23:33 src drwxrwxrwx 1 username username 512 Apr 30 23:35 target
疑问
- 有哪些
rustc参数可将编译输出转移至其他位置(如build文件夹)? - 如何删除这些无法删除的文件夹?
- 该情况是否需在rustc仓库提交issue?
文件存储于1TB exFAT格式外部SSD,不确定是否对问题有影响。
内容的提问来源于stack exchange,提问作者some1and2
相关产品推荐
相关产品推荐

