Open stijnfrishert opened 2 months ago
This is an oddity with Xcode, and as you said probably related to how PATH is resolved. You can link cargo to /usr/local/bin
so Xcode will pick it up. Don't ask me why. Something like ln -s $(which cargo) /usr/local/bin/cargo
.
I had a similar issue with pnpm and node, but not cargo which is odd. Did you install via rustup?
Wow, that's super weird. Thanks Xcode!
Linking to my cargo install works perfectly. I guess that resolves the issue, it's a problem in Xcode.
Yeah, I installed with rustup, the usual path.
Seems this can be done in a cleaner way by sourcing a shell profile in the prebuild scripts, e.g.
(src-tauri/gen/apple/project.yml
)
# ...
targets:
app_iOS:
type: application
platform: iOS
preBuildScripts:
+ - script: source ~/.zshrc && source ~/.profile
+ name: Load shell profile
- script: tauri ios xcode-script
name: Build Rust Code
basedOnDependencyAnalysis: false
This could be something that Tauri provides out of the box. Example above assumes zsh, but a more robust shell detection would be needed if this is built-in. Maybe just documenting this would be ok?
same problem
I changed it to this and it works:
/Users/<user>/.cargo/bin/cargo 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:?}
Yeah, that works for me as well, but:
a) As soon as you regenerate the XCode project that fix gets thrown away
b) I don't think we should hard-code the tool to assume cargo
is at /Users/<user>/.cargo/bin/cargo
, because people might have installed it elsewhere.
Still, happy to hear that solved it for you as well. At least you can continue work temporarily. :)
Describe the bug
I generate an Xcode project through
cargo tauri
. When I then open it and try to build in Xcode manually, the script execution phase fails with the following error (long line, scroll to the end):I looked at the script it tries to execute, which is only this:
That's weird, because
cargo
is obviously installed on my system. The shell listed is/bin/sh
, and when I manually open a terminal by running/bin/sh
, I can run e.g.cargo --version
just fine.Replacing
cargo
in the script with/Users/stijn/.cargo/bin/cargo
does the trick, so there's probably something wrong with thePATH
.Reproduction
pnpm
+ Svelte + TS, but I guess this fails with any combination.pnpm install
for good measurecargo tauri ios init
cargo tauri ios dev --open --host
Expected behavior
I expect the Xcode build to finish
Full
tauri info
outputAdditional context
N.A.