-
Notifications
You must be signed in to change notification settings - Fork 222
Description
Description
Hi, I just installed the newest dev version of rive (0.14.0-dev.12). I used 0.13.20 before.
I experienced failing builds due to the rive_native setup.dart script not being automatically executed in the Xcode build step. The console gave me the following output:
[rive_native] Setup marker not found. Running setup script...
[rive_native] If this fails, make sure you have Dart installed and available in your PATH.
[rive_native] You can run the setup manually with:
dart run rive_native:setup --verbose --platform ios
[rive_native] Using dart from FLUTTER_ROOT: /Users/[MY_USER]/fvm/versions/3.32.7
Could not find a file named "pubspec.yaml" in "[PATH_TO_PROJECT_ROOT]/ios/Pods".
Note: I manually added the brackets to shorten the paths and keep relevant information. Especially the last line of the output is important.
I already read different issues here about people having similar problems and the solution to run the setup script manually. This indeed fixes the issue for my local environment but CI/CD jobs still fail and I didn't wanted to edit all build jobs to pre-run the setup script. So I tried tracking down the issue.
Steps To Reproduce
Steps to reproduce the behavior:
- Install rive version
0.14.0-dev.12(internally uses rive_native version:0.0.15) - Since the binaries are saved in the .pub-cache in the rive_native directory make sure to delete them first. I just cleaned the complete pub-cache for this:
dart pub cache clean - Install project dependencies again:
flutter pub get - Run the app or build it
- Xcode build step will crash
Device & Versions
- Device: iOS Simulator & iOS Device
- OS: iOS 18.6
- Flutter Version:
Flutter 3.32.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d7b523b356 (3 months ago) • 2025-07-15 17:03:46 -0700
Engine • revision 39d6d6e699 (3 months ago) • 2025-07-15 15:39:12 -0700
Tools • Dart 3.8.1 • DevTools 2.45.1
Potential fix
I tracked down the script which tries to run the setup.dart script of rive_native.
I ended up under the .pub-cache-directory in the installed rive_native-0.0.15 package directory and it's ios/rive_native.podspec.
I then modified the script to print the working directory before trying to execute the setup.dart using echo $(pwd). This gave me the hint that we're in the wrong directory for the execution of the setup script ([PATH_TO_PROJECT_ROOT]/ios/Pods). So I added the following before the setup.dart execution:
# [...]
# Check if current path contains ios/Pods before changing directory
if echo "$(pwd)" | grep -q "ios/Pods"; then
cd ../..
fi
if [ -n "$FLUTTER_ROOT" ] && [ -x "$FLUTTER_ROOT/bin/dart" ]; then
echo "[rive_native] Using dart from FLUTTER_ROOT: $FLUTTER_ROOT"
"$FLUTTER_ROOT/bin/dart" run rive_native:setup --verbose --platform ios
else
echo "[rive_native] FLUTTER_ROOT not set or dart not found in FLUTTER_ROOT. Using system dart..."
dart run rive_native:setup --verbose --platform ios
fi
# [...]After adding the check if we are in ios/Pods and navigate back to the project root directory the setup.dart was able to run automatically and download the binaries.
But this leads to another issue:
Error (Xcode): Build input file cannot be found: '[PATH_TO_PROJECT_ROOT]/ios/.symlinks/plugins/rive_native/native/build/iphoneos/bin/release/librive_native.a'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
This error only occurs in the same build step the binaries are downloaded too. I assume this is a Xcode caching problem. In any future build attempts after the binaries were already downloaded the build succeeds. A fix for the second issue was still crucial for my CI/CD jobs to run so I ended up adding the librive_native.a files to the :output_files in the rive_native.podspec:
s.script_phases = [
{
:name => 'Rive Native Compile',
:script => script,
:execution_position => :before_compile,
:output_files => [
'${PODS_TARGET_SRCROOT}/rive_marker_ios_setup_complete',
'$(PODS_TARGET_SRCROOT)/../native/build/iphoneos/bin/release/librive_native.a',
'$(PODS_TARGET_SRCROOT)/../native/build/iphoneos/bin/emulator/librive_native.a'
]
}
]
After adding these 2 lines I cleaned everything and reinstalled the dependencies. The build succeeded then on the first attempt.