Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ Use justfile for all commands (`just --list` to see all):
- `just ios-dev-sim "iPhone 16 Pro"` - iOS specific simulator
- `just ios-dev-device "Your iPhone"` - iOS physical device
- `just android-build` - Android release build
- `just desktop-build` - Desktop release build
- `just desktop-build-no-cc` - Desktop build (with CC unset for compatibility)
- `just desktop-build` - Desktop release build (unsets Android NDK env vars)

### Rust (src-tauri)
- `just rust-fmt` - Format Rust code
Expand Down
8 changes: 5 additions & 3 deletions frontend/src-tauri/scripts/setup-ios-cargo-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ cat > "$CONFIG_FILE" << EOF
# Auto-generated cargo config for iOS ONNX Runtime linking
# Generated by: scripts/setup-ios-cargo-config.sh
# Regenerate with: ./scripts/setup-ios-cargo-config.sh
#
# NOTE: ORT_LIB_LOCATION is NOT set here because Cargo's [env] section applies
# globally to all targets, which breaks desktop builds (ort-sys links iOS objects
# for macOS). Instead, ORT_LIB_LOCATION is passed as an env var in the justfile
# iOS commands and in CI workflows.

[target.aarch64-apple-ios.onnxruntime]
rustc-link-search = ["${XCFRAMEWORK_DIR}/ios-arm64"]
Expand All @@ -39,9 +44,6 @@ rustc-link-lib = ["static=onnxruntime"]
[target.aarch64-apple-ios-sim.onnxruntime]
rustc-link-search = ["${XCFRAMEWORK_DIR}/ios-arm64-simulator"]
rustc-link-lib = ["static=onnxruntime"]

[env]
ORT_LIB_LOCATION = "${XCFRAMEWORK_DIR}/ios-arm64"
EOF

echo "Created: $CONFIG_FILE"
Expand Down
22 changes: 7 additions & 15 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ lint:

# Run Tauri iOS development build (default simulator)
ios-dev:
cd frontend && bun run tauri ios dev
cd frontend && ORT_LIB_LOCATION="$(pwd)/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64" bun run tauri ios dev

# Run Tauri iOS development build on specific simulator (e.g., "iPhone 16 Pro iOS 26")
ios-dev-sim simulator:
cd frontend && bun run tauri ios dev '{{simulator}}'
cd frontend && ORT_LIB_LOCATION="$(pwd)/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64" bun run tauri ios dev '{{simulator}}'

# Run Tauri iOS development build on physical device (e.g., "Your iPhone")
ios-dev-device device:
cd frontend && bun run tauri ios dev --device '{{device}}'
cd frontend && ORT_LIB_LOCATION="$(pwd)/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64" bun run tauri ios dev --device '{{device}}'

Comment on lines 27 to 37
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

ort-sys iOS ORT_LIB_LOCATION simulator ios-arm64 ios-arm64-simulator

💡 Result:

This looks like the Rust ort/ort-sys build script can’t find an ONNX Runtime static library slice that matches the iOS simulator ARM64 target.

What ORT_LIB_LOCATION must point to (for ort-sys)

ORT_LIB_LOCATION must be a directory that contains the compiled static ONNX Runtime libs (e.g. libonnxruntime.a, and the other libonnxruntime_* / libonnx.a libs), optionally inside a Release/Debug/... subfolder; ort-sys searches those patterns when linking. (ort.pyke.io)

The important target naming (Rust)

For Apple Silicon simulator you typically want:

  • device: aarch64-apple-ios
  • simulator (ARM64): aarch64-apple-ios-sim (doc.rust-lang.org)

Why you’re hitting ios-arm64-simulator

Many ONNX Runtime builds/packages only provide:

  • iOS device: arm64
  • iOS simulator: x86_64 (Intel simulator)

The ONNX Runtime iOS build docs still describe simulator as x86_64. (onnxruntime.ai)
So if your ORT build output only includes x86_64-simulator libs, linking will fail when Cargo is building aarch64-apple-ios-sim (Xcode slice name often shows up as ios-arm64-simulator / ios-arm64_x86_64-simulator).

Fix options

  1. Build ONNX Runtime with an ARM64-simulator slice and set ORT_LIB_LOCATION to the folder containing the resulting .a files for that slice.
    (If you build an Apple XCFramework, make sure it actually contains an arm64-simulator library slice; arm64 iPhone simulator support is possible in ORT’s iOS packaging. (newreleases.io))

  2. Instead build/run the simulator as x86_64 (Rosetta) and compile your Rust target as x86_64-apple-ios so it matches the simulator libs that ORT’s docs/build commonly produce. (onnxruntime.ai)

If you paste the exact ort-sys error text (the “could not find native static library …” line) and what files are inside your ORT_LIB_LOCATION directory, I can tell you which specific library/slice it’s missing and what directory layout ort-sys is expecting.

Citations:


🏁 Script executed:

# Search for ORT_LIB_LOCATION usage in codebase
rg "ORT_LIB_LOCATION" -A 3 -B 3

# Search for ort-sys or ort configuration related to iOS
rg "ort-sys|ort_sys" --type toml -A 3
rg "ios" --type toml | head -20

# Check for any build or simulator configuration
fd "Cargo.toml" | xargs grep -l "ort\|onnx"

Repository: OpenSecretCloud/Maple

Length of output: 2597


🏁 Script executed:

# Look for tauri iOS configuration
find . -name "*.json" -o -name "*.toml" | xargs grep -l "ios\|simulator" 2>/dev/null | head -20

Repository: OpenSecretCloud/Maple

Length of output: 226


🏁 Script executed:

# Check the build script for iOS ONNX Runtime to see what slices are actually created
cat -n frontend/src-tauri/scripts/build-ios-onnxruntime.sh | head -100

Repository: OpenSecretCloud/Maple

Length of output: 4024


🏁 Script executed:

# Look for tauri iOS configuration to understand what --simulator or lack thereof means
find . -path ./node_modules -prune -o -name "tauri.conf.json" -type f -print | xargs cat 2>/dev/null | grep -A 10 -B 10 "ios\|simulator" | head -50

Repository: OpenSecretCloud/Maple

Length of output: 47


🏁 Script executed:

# Check if there's a .cargo/config.toml or similar that shows iOS build target configuration
cat -n frontend/src-tauri/.cargo/config.toml 2>/dev/null || echo "File not found, checking for generated config..."
fd "config.toml" frontend/src-tauri/ -exec cat -n {} \;

Repository: OpenSecretCloud/Maple

Length of output: 361


🏁 Script executed:

# Check the build script more thoroughly to see what iOS targets it builds
sed -n '100,300p' frontend/src-tauri/scripts/build-ios-onnxruntime.sh

Repository: OpenSecretCloud/Maple

Length of output: 6579


🏁 Script executed:

# Look for the actual xcframework structure or any documentation about what slices it contains
find . -path ./node_modules -prune -o -name "*.xcframework" -type d -print
find . -path ./node_modules -prune -o -path "*/onnxruntime-ios/*" -type f -print 2>/dev/null | head -20

Repository: OpenSecretCloud/Maple

Length of output: 47


🏁 Script executed:

# Check if there's any documentation or README about iOS builds in the scripts directory
ls -la frontend/src-tauri/scripts/ | grep -i ios
cat frontend/src-tauri/scripts/README.md 2>/dev/null || echo "No README found"

Repository: OpenSecretCloud/Maple

Length of output: 307


🏁 Script executed:

# Search for references to ios-arm64-simulator or arm64-simulator in the codebase
rg "ios-arm64-simulator|arm64.*simulator|aarch64-apple-ios-sim" --type-list

Repository: OpenSecretCloud/Maple

Length of output: 454


🏁 Script executed:

# Search for references to tauri ios dev to understand how it handles simulator targets
rg "tauri ios dev" -B 5 -A 5

# Check if there's a build-all script that might build the simulator
cat -n frontend/src-tauri/scripts/build-ios-onnxruntime-all.sh | head -150

Repository: OpenSecretCloud/Maple

Length of output: 7367


🏁 Script executed:

# Look for any CI configuration that might build or use the simulator variant
fd "workflow\|action\|yml\|yaml" | xargs grep -l "ios\|simulator" 2>/dev/null | head -10

Repository: OpenSecretCloud/Maple

Length of output: 47


Use ios-arm64-simulator slice for simulator development recipes.

ios-dev and ios-dev-sim currently point to ios-arm64 (the device slice). The xcframework includes a separate ios-arm64-simulator slice built specifically for simulator targets (via build-ios-onnxruntime-all.sh). Update both simulator recipes to use the correct slice:

Required change
 ios-dev:
-    cd frontend && ORT_LIB_LOCATION="$(pwd)/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64" bun run tauri ios dev
+    cd frontend && ORT_LIB_LOCATION="$(pwd)/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64-simulator" bun run tauri ios dev

 ios-dev-sim simulator:
-    cd frontend && ORT_LIB_LOCATION="$(pwd)/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64" bun run tauri ios dev '{{simulator}}'
+    cd frontend && ORT_LIB_LOCATION="$(pwd)/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64-simulator" bun run tauri ios dev '{{simulator}}'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@justfile` around lines 27 - 37, The simulator recipes ios-dev and ios-dev-sim
are pointing to the device slice "ios-arm64"; update the ORT_LIB_LOCATION used
by simulator targets to reference the simulator slice "ios-arm64-simulator"
instead of "ios-arm64" (leave the device recipe ios-dev-device unchanged);
locate the ORT_LIB_LOCATION assignments in the ios-dev and ios-dev-sim target
definitions and replace the path segment "onnxruntime.xcframework/ios-arm64"
with "onnxruntime.xcframework/ios-arm64-simulator".

# Build ONNX Runtime for iOS (device + simulator) - required for TTS
ios-build-onnxruntime:
Expand All @@ -59,21 +59,13 @@ ios-fix-arch:
android-build:
cd frontend && bun run tauri android build

# Build Tauri desktop release
# Build Tauri desktop release (unsets Android NDK env vars that break macOS builds)
desktop-build:
cd frontend && bun tauri build
cd frontend && unset CC AR RANLIB && bun tauri build

# Build Tauri desktop debug
# Build Tauri desktop debug (unsets Android NDK env vars that break macOS builds)
desktop-build-debug:
cd frontend && bun tauri build --debug

# Build Tauri desktop release (with CC unset for compatibility)
desktop-build-no-cc:
cd frontend && unset CC && bun tauri build

# Build Tauri desktop debug (with CC unset for compatibility)
desktop-build-debug-no-cc:
cd frontend && unset CC && bun tauri build --debug
cd frontend && unset CC AR RANLIB && bun tauri build --debug

# Format Rust code
rust-fmt:
Expand Down
Loading