{"record":{"id":"26897d9b5f6d6c0a","repo":"tauri-apps/tauri","slug":"no-rlib-files-found-for-prefix-prefix-in","errorCode":null,"errorMessage":"no rlib files found for prefix {prefix} in {}","messagePattern":"no rlib files found for prefix (.+?) in (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"bench/src/run_benchmark.rs","lineNumber":174,"sourceCode":"        out_path.display()\n      )\n    })? {\n      let file = file.context(\"failed to read build output directory entry\")?;\n      let name = file.file_name().to_string_lossy().to_string();\n      if name.starts_with(&prefix) && name.ends_with(\".rlib\") {\n        let start = name.split('-').next().unwrap();\n        if seen.insert(start.to_string()) {\n          size += file\n            .metadata()\n            .context(\"failed to read file metadata\")?\n            .len();\n        }\n      }\n    }\n  }\n\n  if size == 0 {\n    anyhow::bail!(\n      \"no rlib files found for prefix {prefix} in {}\",\n      build_dir.display()\n    );\n  }\n\n  Ok(size)\n}\n\nfn get_binary_sizes(target_dir: &Path, target: &str) -> Result<HashMap<String, u64>> {\n  let mut sizes = HashMap::<String, u64>::new();\n\n  let wry_size = rlib_size(target_dir, \"wry\")?;\n  sizes.insert(\"wry_rlib\".to_string(), wry_size);\n\n  for (name, example_exe) in get_all_benchmarks(target) {\n    let exe_path = utils::bench_root_path().join(&example_exe);\n    let meta = std::fs::metadata(&exe_path)\n      .with_context(|| format!(\"failed to read metadata for {}\", exe_path.display()))?;","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/tauri-apps/tauri/blob/2f1cd75b0f3fb72e6870d719bbfeadedcf8ca884/bench/src/run_benchmark.rs#L156-L192","documentation":"The Tauri benchmark harness measures native library footprint via rlib_size, which scans <target_dir>/build/<library>/*/out for files named lib<library>*.rlib and sums their sizes (deduplicating by file-name stem). If the accumulated size stays zero, the directory structure was readable but no rlib matched the prefix, and the run aborts with this error naming the prefix and build directory it searched.","triggerScenarios":"Running the binary-sizes benchmark (run_benchmark with the sizes benchmark) for a library such as wry, tao or tauri when target/<triple>/build/<library>/*/out contains no file starting with lib<library> and ending in .rlib - because the library was never compiled into that target dir, artifacts were cleaned, or the passed target_dir/library name is wrong.","commonSituations":"Fresh clone where the bench binary was run without building the measured crates; `cargo clean` between build and measurement; passing a --target-dir or CARGO_TARGET_DIR that differs from where the rlibs landed; misspelled library name argument.","solutions":["Build the workspace first so build-script output rlibs exist: cargo build --release (or cargo bench --no-run) before running run_benchmark","Verify the library name passed to the size step - it must match the crate name (files must start with lib<name>, e.g. libwry)","Confirm the target_dir argument points at the cargo target directory that actually contains build/<library>/ (watch CARGO_TARGET_DIR and --target triples)","If artifacts were partially cleaned, cargo clean once and rebuild fully"],"exampleFix":"# before\ncargo run --release --bin run_benchmark -- sizes  # -> no rlib files found for prefix libwry\n\n# after\ncargo build --release\ncargo run --release --bin run_benchmark -- sizes","handlingStrategy":"validation","validationCode":"# run before the size benchmark\ntest -n \"$(find target/release/build/wry -name 'libwry*.rlib' 2>/dev/null)\" \\\n  || cargo build --release","typeGuard":null,"tryCatchPattern":"match rlib_size(&target_dir, \"wry\") {\n  Err(e) if e.to_string().contains(\"no rlib files\") => {\n    // run `cargo build --release` and retry once; otherwise report\n    Err(e)\n  }\n  other => other,\n}","preventionTips":["Always cargo build --release before running the binary-sizes benchmark","Do not cargo clean between building and benchmarking","Pass the same target directory/triple to cargo and the benchmark binary"],"tags":["benchmark","rlib","cargo","build-artifacts","tauri"],"backgroundTag":null,"analyzedSha":"2f1cd75b0f3fb72e6870d719bbfeadedcf8ca884","analyzedAt":"2026-08-16T04:18:42.486Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}