Running unittests src/lib.rs [...] error: test failed, [...] No such file or directory (os error 2)
Checklist
- I've looked through the issues and pull requests for similar reports
Describe your issue
I don't know how to configure cross to find files that exist related to src/lib.rs.
Fails with:
>cargo clean
Removed 48 files, 6.2MiB total
>cross test
Compiling os_error_two v0.1.0 (/project)
Finished `test` profile [unoptimized + debuginfo] target(s) in 11.00s
Running unittests src/lib.rs (/target/x86_64-unknown-freebsd/debug/deps/os_error_two-6fa6df29c49827d7)
error: test failed, to rerun pass `--lib`
Caused by:
could not execute process `/target/x86_64-unknown-freebsd/debug/deps/os_error_two-6fa6df29c49827d7` (never executed)
Caused by:
No such file or directory (os error 2)The file is actually there, besides its .d file.
Passing --lib does not change the output.
This is for testing an issue with the cycle_ptr crate on stable rust v1.94 on FreeBSD, different issue from this one. It is supposed to compile (which eventually it did) and run the tests.
The whole project builds on the host architecture with cargo test -F single_generation_mt -F defer_gc -F weak_pointer
edit, link: https://codeberg.org/nahratzah/cycle_ptr/src/commit/c8ceb72811962218fb99941ad223b378bf2a7dc4
What target(s) are you cross-compiling for?
x86_64-unknown-freebsd
Which operating system is the host (e.g computer cross is on) running?
- macOS
- Windows
- Linux / BSD
- other OS (specify in description)
What architecture is the host?
- x86_64 / AMD64
- arm32
- arm64 (including Mac M1)
What container engine is cross using?
- docker
- podman
- other container engine (specify in description)
cross version
cross 0.2.5
Example
I don't know if the "warning: LF will be replaced by CRLF in {files}" when commiting is relevant.
git clone https://github.com/JorgeCepeda/os_error_2.git
cross testIt's basically an empty project with an empty lib.rs.
Also reproduces with a simple doctest in src/lib.rs:
//!```
//!println!("Hello World!");
//!```
pub fn huh() {
()
}Also reproduces with empty config.toml.
Additional information / notes
rustc --version -v:
rustc 1.94.0 (4a4ef493e 2026-03-02)
binary: rustc
commit-hash: 4a4ef493e3a1488c6e321570238084b38948f6db
commit-date: 2026-03-02
host: x86_64-pc-windows-msvc
release: 1.94.0
LLVM version: 21.1.8cargo --version:
cargo 1.94.0 (85eff7c80 2026-01-15)
docker ps -a:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
rustup show:
Default host: x86_64-pc-windows-msvc
installed toolchains
stable-x86_64-pc-windows-msvc
1.94.0-x86_64-pc-windows-msvc (active, default)
1.94.0-x86_64-unknown-linux-gnu
1.96.0-x86_64-pc-windows-msvc
installed targets:
x86_64-pc-windows-msvc
x86_64-unknown-freebsdThe target shows in rustc --print target-list.
The docker image was added by following the docs, with a stub project.
The toolchain suggested by the commands for freebsd was linux-gnu.
I am a noob, I don't know if I missed anything.
Source: cross-rs/cross