Error: failed to recursively copy /tmp/xargo.… to ~/.xargo/lib/…
I get this error whenever xargo tries to rebuild the sysroot (e.g. on a rust update):
error: failed to recursively copy /tmp/xargo.qkh3QP6TAK4K/target/cortex-a8/release/deps to /home/philipp/.xargo/lib/rustlib/cortex-a8/lib
caused by: No such file or directory (os error 2)
stack backtrace:
0: 0x5627cc2b3701 - backtrace::backtrace::libunwind::trace
at /home/philipp/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.2.3/src/backtrace/mod.rs:82
- backtrace::backtrace::trace<closure>
at /home/philipp/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.2.3/src/backtrace/mod.rs:70
1: 0x5627cc2b4588 - backtrace::capture::{{impl}}::new
at /home/philipp/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.2.3/src/lib.rs:96
2: 0x5627cc245671 - error_chain::make_backtrace
at /home/philipp/.cargo/registry/src/github.com-1ecc6299db9ec823/error-chain-0.5.0/src/lib.rs:684
3: 0x5627cc23d57c - xargo::errors::{{impl}}::chain_err::{{closure}}::{{closure}}<(),std::io::error::Error,closure,collections::string::String>
at /home/philipp/Documents/xargo/src/errors.rs:1
4: 0x5627cc1c1eed - core::option::{{impl}}::unwrap_or_else<core::option::Option<alloc::arc::Arc<backtrace::capture::Backtrace>>,closure>
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/option.rs:358
5: 0x5627cc241a9e - xargo::errors::{{impl}}::chain_err::{{closure}}<(),std::io::error::Error,closure,collections::string::String>
at /home/philipp/Documents/xargo/src/errors.rs:1
6: 0x5627cc1d5723 - core::result::{{impl}}::map_err<(),std::io::error::Error,xargo::errors::Error,closure>
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/result.rs:494
7: 0x5627cc23d045 - xargo::errors::{{impl}}::chain_err<(),std::io::error::Error,closure,collections::string::String>
at /home/philipp/Documents/xargo/src/errors.rs:1
8: 0x5627cc226594 - xargo::fs::cp_r
at /home/philipp/Documents/xargo/src/fs.rs:33
9: 0x5627cc232c32 - xargo::sysroot::update_target_sysroot
at /home/philipp/Documents/xargo/src/sysroot.rs:230
10: 0x5627cc230555 - xargo::sysroot::update
at /home/philipp/Documents/xargo/src/sysroot.rs:118
11: 0x5627cc237733 - xargo::run
at /home/philipp/Documents/xargo/src/main.rs:88
12: 0x5627cc236016 - xargo::main
at /home/philipp/Documents/xargo/src/main.rs:38
13: 0x5627cc306d1a - panic_unwind::__rust_maybe_catch_panic
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libpanic_unwind/lib.rs:98
14: 0x5627cc3005c6 - std::panicking::try<(),fn()>
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:434
- std::panic::catch_unwind<fn(),()>
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panic.rs:351
- std::rt::lang_start
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/rt.rs:57
15: 0x5627cc243fd2 - main
16: 0x7f72c8a8082f - __libc_start_main
17: 0x5627cc1a4908 - _start
18: 0x0 - <unknown>
Doing a xargo clean doesn't help. However, it works if I copy the complete crate to a new location (e.g. to Desktop) and compile it there. Afterwards, the sysroot for the target exists and thus the crate at the old location compiles too.
I'm using the current master version (239c96936f8d9d95a5b6862e654d4939cecf846b), but the issue also occurs with the crates.io versions of xargo.
Rust/Cargo versions: rustc 1.15.0-nightly (8f02c429a 2016-12-15) cargo 0.16.0-nightly (ddb5c32 2016-12-16)
Could you please expand on your workaround? I'm running into this issue too, and copying my crate to another directory and then running xargo build --target foo still just causes the exact same error.
I found that making any new directory that only has the Cargo.toml/lock and target.json from the original crate and then running xargo build --target target works. It will obviously fail but it should build core and the other dependencies before attempting to build your crate.
I'm not sure if its other files in the directory messing things up or it might just be a different directory name that avoids the issue.