tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] Error white running `bun run tauri ios dev`: Arch specified by Xcode was invalid

Open ruby-ist opened this issue 1 year ago • 6 comments

Describe the bug

I couldn't run bun run tauri ios dev command. Android is working fine. I have tried updating everything. I'm currently using the latest rc version.

Reproduction

I'm using Tauri + Nuxt + Bun

Expected behavior

App should get installed on emulator

Full tauri info output

$ tauri info

[✔] Environment
    - OS: Mac OS 14.0.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06)
    ✔ cargo: 1.80.1 (376290515 2024-07-16)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 20.11.0
    - yarn: 1.22.11
    - npm: 10.2.4
    - bun: 1.1.8

[-] Packages
    - tauri [RUST]: 2.0.0-rc.6
    - tauri-build [RUST]: 2.0.0-rc.6
    - wry [RUST]: 0.42.0
    - tao [RUST]: 0.29.1
    - tauri-cli [RUST]: 2.0.0-rc.2
    - @tauri-apps/api [NPM]: 2.0.0-rc.3
    - @tauri-apps/cli [NPM]: 2.0.0-rc.6

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:3000/
    - framework: Vue.js (Nuxt)
    - bundler: Webpack

[-] iOS
    - Developer Teams: None

Stack trace

Debug [jsonrpsee-client] Connection established to target: Target { host: "127.0.0.1", host_header: "127.0.0.1:64886", _mode: Plain, path_and_query: "/", basic_auth: None }
    Warn [tauri_cli::mobile::ios] No code signing certificates found. You must add one and set the certificate development team ID on the `bundle > iOS > developmentTeam` config value or the `APPLE_DEVELOPMENT_TEAM` environment variable. To list the available certificates, run `tauri info`.
expense_analyser_lib
    Error [tauri_cli_node] Arch specified by Xcode was invalid. . isn't a known arch
error: script "tauri" exited with code 1

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 'expense-analyser_iOS' from project 'expense-analyser')
** BUILD FAILED **


The following build commands failed:
	PhaseScriptExecution Build\ Rust\ Code /Users/srira/Library/Developer/Xcode/DerivedData/expense-analyser-chprbcixnxsdchglnulwvajommyi/Build/Intermediates.noindex/expense-analyser.build/debug-iphonesimulator/expense-analyser_iOS.build/Script-DF84B63C26B38700BC2383A3.sh (in target 'expense-analyser_iOS' from project 'expense-analyser')
(1 failure)
    Error command ["xcodebuild"] exited with code 65
error: script "tauri" exited with code 1

Additional context

Previously I was getting the lib not found in the 2.0.0-rc.2 version due to how bun process arguments, I've updated the tauri-cli to 2.0.0-rc.6 and now I'm getting the error Arch specified by Xcode was invalid. . isn't a known arch

ruby-ist avatar Aug 22 '24 16:08 ruby-ist

Hi.

No code signing certificates found. You must add one and set the certificate development team ID on the bundle > iOS > developmentTeam config value or the APPLE_DEVELOPMENT_TEAM environment variable. To list the available certificates, run tauri info.

This is not all, but cannot run tauri ios dev without setting a development team ID.

rdlabo avatar Aug 25 '24 12:08 rdlabo

@rdlabo I'm running into the same issue, setting up certificates didn't help.

    Debug [ignore::walk] ignoring /Users/rafal/Code/notes/src-tauri/gen/apple/.gitignore: Ignore(IgnoreMatch(Hidden))
    Debug [ignore::walk] ignoring /Users/rafal/Code/notes/src-tauri/gen/schemas: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/Users/rafal/Code/notes/src-tauri/.gitignore"), original: "/gen/schemas", actual: "gen/schemas", is_whitelist: false, is_only_dir: false })))
    Debug [ignore::walk] ignoring /Users/rafal/Code/notes/src-tauri/.cargo: Ignore(IgnoreMatch(Hidden))
    Debug [ignore::walk] ignoring /Users/rafal/Code/notes/src-tauri/.gitignore: Ignore(IgnoreMatch(Hidden))
    Debug [jsonrpsee-client] Connecting to target: Target { host: "127.0.0.1", host_header: "127.0.0.1:54402", _mode: Plain, path_and_query: "/", basic_auth: None }
    Debug [jsonrpsee-client] Connection established to target: Target { host: "127.0.0.1", host_header: "127.0.0.1:54402", _mode: Plain, path_and_query: "/", basic_auth: None }
    Debug [cargo_mobile2::apple::teams] found cert "Apple Development: [email protected] (XXX)" with organization "Rafal XXX"
notes_lib
    Error [tauri_cli_node] Arch specified by Xcode was invalid. . isn't a known arch
error: script "tauri" exited with code 1

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 'notes_iOS' from project 'notes')
** BUILD FAILED **


The following build commands failed:
	PhaseScriptExecution Build\ Rust\ Code /Users/rafal/Library/Developer/Xcode/DerivedData/notes-dhakwzcvrpldezdawnqjqzychoyu/Build/Intermediates.noindex/notes.build/debug-iphonesimulator/notes_iOS.build/Script-AA73BCC48C1B27A9C441DC1C.sh (in target 'notes_iOS' from project 'notes')
(1 failure)
    Error command ["xcodebuild"] exited with code 65
error: script "tauri" exited with code 1

rafales avatar Aug 27 '24 19:08 rafales

Issue seems to be here:

$ tauri ios xcode-script -v --platform iOS Simulator --sdk-root /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk --framework-search-paths /Users/rafal/Library/Developer/Xcode/DerivedData/notes-dhakwzcvrpldezdawnqjqzychoyu/Build/Products/debug-iphonesimulator  "." --header-search-paths /Users/rafal/Library/Developer/Xcode/DerivedData/notes-dhakwzcvrpldezdawnqjqzychoyu/Build/Products/debug-iphonesimulator/include  --gcc-preprocessor-definitions  DEBUG=1 --configuration debug arm64-sim

There is "." passed, probably without --framework-search-paths in front of it.

rafales avatar Aug 27 '24 19:08 rafales

Here are relevant parts of project.pbxproj:

shellScript = "bun tauri ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths \"${FRAMEWORK_SEARCH_PATHS:?}\" --header-search-paths \"${HEADER_SEARCH_PATHS:?}\" --gcc-preprocessor-definitions \"${GCC_PREPROCESSOR_DEFINITIONS:-}\" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}";
FRAMEWORK_SEARCH_PATHS = (
  "$(inherited)",
  "\".\"",
);

So it seems that either tauri ios xcode-script doesn't accept arguments properly or that the way xcode escapes FRAMEWORK_SEARCH_PATHS is somehow unexpected.

rafales avatar Aug 27 '24 19:08 rafales

@rdlabo I'm running into the same issue, setting up certificates didn't help.

No, this is same issue. Error [tauri_cli_node] Arch specified by Xcode was invalid. isn't a known arch is a common error if compile is failed, and you should look for an earlier Error or Warn. You will need to read the logs before this one.

rdlabo avatar Aug 28 '24 02:08 rdlabo

@rafales This is my success code cli generated:

tauri ios xcode-script -v --platform iOS Simulator --sdk-root /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk --framework-search-paths /Users/sakakibara/Library/Developer/Xcode/DerivedData/tauri-app-egcczscuegfsacgyuwfiwymzxmdu/Build/Products/debug-iphonesimulator "." --header-search-paths /Users/sakakibara/Library/Developer/Xcode/DerivedData/tauri-app-egcczscuegfsacgyuwfiwymzxmdu/Build/Products/debug-iphonesimulator/include --gcc-preprocessor-definitions DEBUG=1 --configuration debug arm64-sim

in Apple M2 Pro, and [email protected].

rdlabo avatar Aug 28 '24 02:08 rdlabo

I am also running into this issue. Are there any updates to this issue?

keehun avatar Sep 03 '24 00:09 keehun

Here are relevant parts of project.pbxproj:

shellScript = "bun tauri ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths \"${FRAMEWORK_SEARCH_PATHS:?}\" --header-search-paths \"${HEADER_SEARCH_PATHS:?}\" --gcc-preprocessor-definitions \"${GCC_PREPROCESSOR_DEFINITIONS:-}\" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}";
FRAMEWORK_SEARCH_PATHS = (
  "$(inherited)",
  "\".\"",
);

So it seems that either tauri ios xcode-script doesn't accept arguments properly or that the way xcode escapes FRAMEWORK_SEARCH_PATHS is somehow unexpected.

i removed the "\".\"" line in the project.pbxproj and it worked

Ripwords avatar Sep 17 '24 04:09 Ripwords

+1 Error [ ] 'Arch specified by Xcode was invalid. . isn't a known arch'

shellscript output: PLATFORM_DISPLAY_NAME: parameter not set

[✔] Environment
    - OS: Mac OS 14.6.1 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 20.10.0
    - pnpm: 9.10.0
    - yarn: 1.22.22
    - npm: 10.2.3
    - bun: 1.1.3

[-] Packages
    - tauri 🦀: 2.0.0-rc.14
    - tauri-build 🦀: 2.0.0-rc.11
    - wry 🦀: 0.43.1
    - tao 🦀: 0.30.0
    - @tauri-apps/api : 2.0.0-rc.4
    - @tauri-apps/cli : 2.0.0-rc.15

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.0-rc.3
    - @tauri-apps/plugin-shell : 2.0.0-rc.1

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

[-] iOS
    - Developer Teams: carlos bolanos (ID: XXXXXXXX)

https://github.com/brawneycom/brawney_app

bolanosdev avatar Sep 17 '24 04:09 bolanosdev

https://github.com/tauri-apps/tauri/blob/fbff6388ad6e3fcc450f262125823bdc3861ed6a/crates/tauri-cli/src/mobile/ios/xcode_script.rs#L166-L183

Tracked the error down to this section, which leads me to here. So I know that the arches is a command line argument, but I'm not sure where that's happening.

https://github.com/tauri-apps/tauri/blob/fbff6388ad6e3fcc450f262125823bdc3861ed6a/crates/tauri-cli/src/mobile/ios/mod.rs#L87

trippjoe avatar Sep 18 '24 21:09 trippjoe

@lucasfernog I'm still running into this on 2.0.2. I've updated tauri, removed the whole /gen/apple folder and run bun tauri ios init and bun tauri ios dev again. I don't see any issues in the generation etc. but I keep getting the Arch specified by Xcode was invalid error.

Is there anything else I need to do to fix this?

erskingardner avatar Oct 10 '24 14:10 erskingardner