Original issue.
I'm trying to add iOS support to a Tauri plugin AdMob to no avail, but works fine when running the Swift package from Xcode. This is the Package.swift file:
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "tauri-plugin-admob",
platforms: [
.macOS(.v10_13),
.iOS(.v13),
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "tauri-plugin-admob",
type: .static,
targets: ["tauri-plugin-admob"])
],
dependencies: [
.package(name: "Tauri", path: "../.tauri/tauri-api"),
.package(
url: "https://github.com/googleads/swift-package-manager-google-mobile-ads.git",
from: "12.14.0"
),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "tauri-plugin-admob",
dependencies: [
.byName(name: "Tauri"),
.product(
name: "GoogleMobileAds", package: "swift-package-manager-google-mobile-ads"),
],
path: "Sources")
]
)
This is the error:
Compiling tauri-plugin-admob v0.0.4 (/Users/setoelkahfi/Repositories/tauri-plugin-admob)
Compiling tauri-macros v2.5.1
Compiling tauri-app v0.0.0 (/Users/setoelkahfi/Repositories/tauri-plugin-admob/examples/tauri-app/src-tauri)
error: failed to run custom build command for `tauri-plugin-admob v0.0.4 (/Users/setoelkahfi/Repositories/tauri-plugin-admob)`
Caused by:
process didn't exit successfully: `/Users/setoelkahfi/Repositories/tauri-plugin-admob/examples/tauri-app/src-tauri/target/debug/build/tauri-plugin-admob-4a2939bc6545f557/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-changed=permissions
cargo:PERMISSION_FILES_PATH=/Users/setoelkahfi/Repositories/tauri-plugin-admob/examples/tauri-app/src-tauri/target/aarch64-apple-ios-sim/debug/build/tauri-plugin-admob-f27d046634e407b0/out/tauri-plugin-admob-permission-files
cargo:rerun-if-env-changed=REMOVE_UNUSED_COMMANDS
cargo:rustc-check-cfg=cfg(mobile)
cargo:rustc-cfg=mobile
cargo:rustc-check-cfg=cfg(desktop)
cargo:rerun-if-changed=/Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.9.3/mobile/ios-api/README.md
cargo:rerun-if-changed=/Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.9.3/mobile/ios-api/.gitignore
cargo:rerun-if-changed=/Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.9.3/mobile/ios-api/Package.swift
cargo:rerun-if-changed=/Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.9.3/mobile/ios-api/Sources/Tauri/UiUtils.swift
cargo:rerun-if-changed=/Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.9.3/mobile/ios-api/Sources/Tauri/JsonValue.swift
cargo:rerun-if-changed=/Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.9.3/mobile/ios-api/Sources/Tauri/Invoke.swift
cargo:rerun-if-changed=/Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.9.3/mobile/ios-api/Sources/Tauri/Logger.swift
cargo:rerun-if-changed=/Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.9.3/mobile/ios-api/Sources/Tauri/Plugin/Plugin.swift
cargo:rerun-if-changed=/Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.9.3/mobile/ios-api/Sources/Tauri/Channel.swift
cargo:rerun-if-changed=/Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.9.3/mobile/ios-api/Sources/Tauri/JSTypes.swift
cargo:rerun-if-changed=/Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.9.3/mobile/ios-api/Sources/Tauri/Tauri.swift
cargo:rustc-link-search=native=/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator
cargo:rustc-link-search=native=/usr/lib/swift
cargo:rustc-link-lib=clang_rt.iossim
cargo:rustc-link-search=/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/lib/darwin
Building for debugging...
[0/10] Write sources
[4/10] Compiling UserMessagingPlatformTarget placeholder.m
[5/10] Write swift-version-49B95AFC49DCD68C.txt
[7/14] Compiling GoogleMobileAdsTarget placeholder.swift
[8/14] Emitting module GoogleMobileAdsTarget
[9/14] Compiling SwiftRs lib.swift
[10/14] Emitting module SwiftRs
[11/23] Compiling Tauri Invoke.swift
[12/23] Compiling Tauri Plugin.swift
[13/23] Compiling Tauri JsonValue.swift
/Users/setoelkahfi/Repositories/tauri-plugin-admob/.tauri/tauri-api/Sources/Tauri/JsonValue.swift:42:11: warning: expression implicitly coerced from 'Any?' to 'Any'
40 | return prepare(array: anArray)
41 | }
42 | return value
| |- warning: expression implicitly coerced from 'Any?' to 'Any'
| |- note: provide a default value to avoid this warning
| |- note: force-unwrap the value to avoid this warning
| `- note: explicitly cast to 'Any' with 'as Any' to silence this warning
43 | }
44 | }
[14/23] Compiling Tauri UiUtils.swift
[15/23] Compiling Tauri Logger.swift
[16/23] Compiling Tauri JSTypes.swift
[17/23] Compiling Tauri Channel.swift
[18/23] Emitting module Tauri
[19/23] Compiling Tauri Tauri.swift
[19/23] Write Objects.LinkFileList
[20/23] Archiving libTauri.a
error: emit-module command failed with exit code 1 (use -v to see invocation)
[22/27] Emitting module tauri_plugin_admob
/Users/setoelkahfi/Repositories/tauri-plugin-admob/ios/Sources/AdmobPlugin.swift:5:8: error: no such module 'GoogleMobileAds'
3 | import UIKit
4 | import WebKit
5 | import GoogleMobileAds
| `- error: no such module 'GoogleMobileAds'
6 |
7 | class PingArgs: Decodable {
[23/27] Compiling tauri_plugin_admob Context.swift
/Users/setoelkahfi/Repositories/tauri-plugin-admob/ios/Sources/AdmobPlugin.swift:5:8: error: no such module 'GoogleMobileAds'
3 | import UIKit
4 | import WebKit
5 | import GoogleMobileAds
| `- error: no such module 'GoogleMobileAds'
6 |
7 | class PingArgs: Decodable {
[24/27] Compiling tauri_plugin_admob ExecuteContext.swift
/Users/setoelkahfi/Repositories/tauri-plugin-admob/ios/Sources/AdmobPlugin.swift:5:8: error: no such module 'GoogleMobileAds'
3 | import UIKit
4 | import WebKit
5 | import GoogleMobileAds
| `- error: no such module 'GoogleMobileAds'
6 |
7 | class PingArgs: Decodable {
[25/27] Compiling tauri_plugin_admob AdmobPlugin.swift
/Users/setoelkahfi/Repositories/tauri-plugin-admob/ios/Sources/AdmobPlugin.swift:5:8: error: no such module 'GoogleMobileAds'
3 | import UIKit
4 | import WebKit
5 | import GoogleMobileAds
| `- error: no such module 'GoogleMobileAds'
6 |
7 | class PingArgs: Decodable {
--- stderr
Fetching https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git from cache
Fetching https://github.com/googleads/swift-package-manager-google-mobile-ads.git from cache
Fetching https://github.com/Brendonovich/swift-rs from cache
Fetched https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git from cache (0.42s)
Fetched https://github.com/googleads/swift-package-manager-google-mobile-ads.git from cache (0.42s)
Fetched https://github.com/Brendonovich/swift-rs from cache (0.59s)
Computing version for https://github.com/Brendonovich/swift-rs
Computed https://github.com/Brendonovich/swift-rs at 1.0.7 (1.08s)
Computing version for https://github.com/googleads/swift-package-manager-google-mobile-ads.git
Computed https://github.com/googleads/swift-package-manager-google-mobile-ads.git at 12.14.0 (0.36s)
Computing version for https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git
Computed https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git at 3.1.0 (0.40s)
Creating working copy for https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git
Working copy of https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git resolved at 3.1.0
Creating working copy for https://github.com/googleads/swift-package-manager-google-mobile-ads.git
Working copy of https://github.com/googleads/swift-package-manager-google-mobile-ads.git resolved at 12.14.0
Creating working copy for https://github.com/Brendonovich/swift-rs
Working copy of https://github.com/Brendonovich/swift-rs resolved at 1.0.7
Fetching binary artifact https://dl.google.com/googleadmobadssdk/90fe6bf3b0f4ce0d/googleusermessagingplatformios-spm-3.1.0.zip from cache
Fetching binary artifact https://dl.google.com/googleadmobadssdk/c8c5523373ed76aa/googlemobileadsios-spm-12.14.0.zip from cache
Fetched https://dl.google.com/googleadmobadssdk/90fe6bf3b0f4ce0d/googleusermessagingplatformios-spm-3.1.0.zip from cache (0.23s)
Fetched https://dl.google.com/googleadmobadssdk/c8c5523373ed76aa/googlemobileadsios-spm-12.14.0.zip from cache (0.56s)
thread 'main' panicked at /Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/swift-rs-1.0.7/src-rs/build.rs:281:17:
Failed to compile swift package tauri-plugin-admob
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:697:5
1: core::panicking::panic_fmt
at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/panicking.rs:75:14
2: swift_rs::build::SwiftLinker::link
at /Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/swift-rs-1.0.7/src-rs/build.rs:281:17
3: tauri_utils::build::link_swift_library
at /Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-utils-2.8.0/src/build.rs:30:4
4: tauri_utils::build::link_apple_library
at /Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-utils-2.8.0/src/build.rs:11:5
5: tauri_plugin::build::mobile::setup
at /Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-plugin-2.5.1/src/build/mobile.rs:110:9
6: tauri_plugin::build::Builder::try_build
at /Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-plugin-2.5.1/src/build/mod.rs:150:5
7: tauri_plugin::build::Builder::build
at /Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-plugin-2.5.1/src/build/mod.rs:83:30
8: build_script_build::main
at ./build.rs:20:10
9: core::ops::function::FnOnce::call_once
at /Users/setoelkahfi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:253:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Error failed to compile iOS app: Failed to run `cargo build`: command ["cargo", "build", "--package", "tauri-app", "--manifest-path", "/Users/setoelkahfi/Repositories/tauri-plugin-admob/examples/tauri-app/src-tauri/Cargo.toml", "--target", "aarch64-apple-ios-sim", "--lib", "--no-default-features"] exited with code 101
note: Run script build phase 'Build Rust Code' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'tauri-app_iOS' from project 'tauri-app')
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Build\ Rust\ Code /Users/setoelkahfi/Library/Developer/Xcode/DerivedData/tauri-app-glpbgfzyojduwyfgbsjitbunblxa/Build/Intermediates.noindex/tauri-app.build/debug-iphonesimulator/tauri-app_iOS.build/Script-4CFF21EFA1FFE4D2AB9D6998.sh (in target 'tauri-app_iOS' from project 'tauri-app')
Building workspace tauri-app with scheme tauri-app_iOS and configuration debug
(2 failures)
Error failed to run iOS app: failed to build with xcodebuild: command ["xcodebuild"] exited with code 65
I've updated the Rust deps to the latest based on the suggestion, but still no succeed. Any clue? Or is it unrelated to swift-rs?
Original issue.
I'm trying to add iOS support to a Tauri plugin AdMob to no avail, but works fine when running the Swift package from Xcode. This is the
Package.swiftfile:This is the error:
I've updated the Rust deps to the latest based on the suggestion, but still no succeed. Any clue? Or is it unrelated to
swift-rs?