{"record":{"id":"7d5bd5989bcca27e","repo":"tauri-apps/tauri","slug":"library-not-found-at-make-sure-your-cargo-toml","errorCode":null,"errorMessage":"Library not found at {}. Make sure your Cargo.toml file has a [lib] block with `crate-type = [\"staticlib\", \"cdylib\", \"lib\"]`","messagePattern":"Library not found at (.+?)\\. Make sure your Cargo\\.toml file has a \\[lib\\] block with `crate-type = \\[\"staticlib\", \"cdylib\", \"lib\"\\]`","errorType":"exception","errorClass":"tauri_cli::error::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/mobile/ios/xcode_script.rs","lineNumber":281,"sourceCode":"        true,\n        profile,\n        &env,\n        target_env,\n      )\n      .context(\"failed to compile iOS app\")?;\n\n    let out_dir = interface.app_settings().out_dir(\n      &InterfaceOptions {\n        debug: matches!(profile, Profile::Debug),\n        target: Some(rust_triple.into()),\n        ..Default::default()\n      },\n      dirs.tauri,\n    )?;\n\n    let lib_path = out_dir.join(format!(\"lib{}.a\", config.app().lib_name()));\n    if !lib_path.exists() {\n      crate::error::bail!(\"Library not found at {}. Make sure your Cargo.toml file has a [lib] block with `crate-type = [\\\"staticlib\\\", \\\"cdylib\\\", \\\"lib\\\"]`\", lib_path.display());\n    }\n\n    validate_lib(&lib_path)?;\n\n    let project_dir = config.project_dir();\n    let externals_lib_dir = project_dir.join(format!(\"Externals/{arch}/{}\", profile.as_str()));\n    std::fs::create_dir_all(&externals_lib_dir).fs_context(\n      \"failed to create externals lib directory\",\n      externals_lib_dir.clone(),\n    )?;\n\n    // backwards compatible lib output file name\n    let uses_new_lib_output_file_name = {\n      let pbxproj_path = project_dir\n        .join(format!(\"{}.xcodeproj\", config.app().name()))\n        .join(\"project.pbxproj\");\n      let pbxproj_contents = read_to_string(&pbxproj_path)\n        .fs_context(\"failed to read project.pbxproj file\", pbxproj_path)?;","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/ios/xcode_script.rs#L263-L299","documentation":"After the Xcode script helper compiles the Rust library, it expects a static library at `<target/<triple>/<profile>/debug|release>/lib{lib.name}.a` (from the `[lib] name` in Cargo.toml). If that file does not exist, it tells you the Cargo.toml is missing the mobile crate-types — without `crate-type = [\"staticlib\", ...]` cargo never produces the .a that gets linked into the app.","triggerScenarios":"The Xcode build phase runs `tauri ios xcode-script`, cargo finishes (or was skipped), and `lib<name>.a` is absent from out_dir. Direct triggers: no `[lib] crate-type` including `staticlib`/`cdylib`; `[lib] name` renamed after `tauri ios init` so the generated project looks for a different name; an earlier cargo failure swallowed by logs; CARGO_TARGET_DIR redirected.","commonSituations":"Hand-migrating a desktop-only Tauri app to iOS without adding the lib crate-types; renaming the crate or lib.name and not re-running `tauri ios init`; custom target directories in .cargo/config.toml.","solutions":["Add the required crate-types in src-tauri/Cargo.toml under `[lib]`: `crate-type = [\"staticlib\", \"cdylib\", \"lib\"]`.","Re-run `tauri ios init` after changing `[lib] name` or `package.name` so the Xcode project matches.","Scroll the Xcode report navigator for the real cargo error — a failed build also leaves no .a.","Check out_dir manually: `ls target/aarch64-apple-ios/debug/lib*.a` (or release) to confirm where cargo wrote it."],"exampleFix":"# before (src-tauri/Cargo.toml)\n[lib]\nname = \"myapp_lib\"\n\n# after\n[lib]\nname = \"myapp_lib\"\ncrate-type = [\"staticlib\", \"cdylib\", \"lib\"]","handlingStrategy":"validation","validationCode":"# Verify the mobile static lib exists where Xcode expects it\nTRIPLE=aarch64-apple-ios\ntest -f \"src-tauri/target/$TRIPLE/debug/lib$(grep -m1 '^name' src-tauri/Cargo.toml | cut -d'\"' -f2).a\" \\\n  || cargo build --manifest-path src-tauri/Cargo.toml --target $TRIPLE","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep `crate-type = [\"staticlib\", \"cdylib\", \"lib\"]` in [lib] from day one.","Re-run `tauri ios init` immediately after renaming package/lib name.","Build once with cargo for the ios triple to confirm the .a is produced before opening Xcode."],"tags":["tauri-cli","ios","cargo","staticlib","crate-type","xcode"],"backgroundTag":"missing-build-artifact","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}