You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
flutter run crashes when running through a devenv shell if it tries to target IOS. The devenv file can be practically empty.
Inspired by a Nixos forum post, I suspect that using mkShellNoCC instead of mkShell somewhere within the devenv source or in a Nix flake would solve the problem: https://discourse.nixos.org/t/flutter-for-ios-setup-not-working/43130 I would be glad to check whether this solution worked, but I would need some assistance.
To reproduce
Install flutter using some non-devenv method (in my case, Homebrew).
$ flutter create flutter_demo
Developer identity "Apple Development: My Name (AOEUIDHTNS)" selected for iOS code signing
Creating project flutter_demo...
Resolving dependencies in flutter_demo...
Got dependencies in flutter_demo.
Wrote 129 files.
All done!
You can find general documentation for Flutter at: https://docs.flutter.dev/
Detailed API documentation is available at: https://api.flutter.dev/
If you prefer video documentation, consider: https://www.youtube.com/c/flutterdev
In order to run your application, type:
$ cd flutter_demo
$ flutter run
Your application code is in flutter_demo/lib/main.dart.
$ cd flutter_demo
$ flutter run ~/flutter_demo
Launching lib/main.dart on iPhone 15 Pro in debug mode...
Running Xcode build...
└─Compiling, linking and signing... 3,5s
Xcode build done. 14,9s
[ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.
Syncing files to device iPhone 15 Pro... 20ms
Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
A Dart VM Service on iPhone 15 Pro is available at: http://127.0.0.1:49858/DoPGZofTYIo=/
The Flutter DevTools debugger and profiler on iPhone 15 Pro is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:49858/DoPGZofTYIo=/
Lost connection to device.
But throw in a devenv init before flutter run, and Xcode will fail to find one or more header files:
$ flutter create flutter_demo
Developer identity "Apple Development: My Name (AOEUIDHTNS)" selected for
iOS code signing
Creating project flutter_demo...
Resolving dependencies in flutter_demo...
Got dependencies in flutter_demo.
Wrote 129 files.
All done!
You can find general documentation for Flutter at: https://docs.flutter.dev/
Detailed API documentation is available at: https://api.flutter.dev/
If you prefer video documentation, consider:
https://www.youtube.com/c/flutterdev
In order to run your application, type:
$ cd flutter_demo
$ flutter run
Your application code is in flutter_demo/lib/main.dart.
$ cd flutter_demo
$ devenv init
• Creating devenv.nix
• Creating devenv.yaml
• Creating .envrc
• Creating .gitignore
• Building shell ...
• Using Cachix: devenv
✖ You're not a trusted user of the Nix store. You have the following options:
a) Add yourself to the trusted-users list in /etc/nix/nix.conf for devenv to manage caches for you.
trusted-users = root my-name
Restart nix-daemon with:
$ sudo launchctl kickstart -k system/org.nixos.nix-daemon
b) Add binary caches to /etc/nix/nix.conf yourself:
extra-substituters = https://devenv.cachix.org
extra-trusted-public-keys = devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=
And disable automatic cache configuration in `devenv.nix`:
{
cachix.enable = false;
}
• Failed to get cachix caches due to evaluation error
$ devenv shell
✔ Building shell in 1.7s.
• Entering shell
Restored session: Mon Apr 29 13:54:22 CEST 2024
hello from devenv
git version 2.44.0
(nix:devenv-shell-env) (devenv) bash-5.2$ flutter run
Launching lib/main.dart on iPhone 15 Pro in debug mode...
Running Xcode build...
└─Compiling, linking and signing... 438ms
Xcode build done. 11,3s
Failed to build iOS app
Lexical or Preprocessor Issue (Xcode): 'UIKit/UIKit.h' file not found
/Users/my-name/flutter_demo/flutter_demo/build/ios/Debug-iphonesimulator/Flutter.framework/Headers/Flutter.h:7:8
Parse Issue (Xcode): Could not build module 'Flutter'
/Users/my-name/flutter_demo/flutter_demo/ios/Runner/GeneratedPluginRegistrant.h:9:8
Could not build the application for the simulator.
Error launching application on iPhone 15 Pro.
(nix:devenv-shell-env) (devenv) bash-5.2$
Version
$ devenv version
devenv 1.0.4 (aarch64-darwin)
The text was updated successfully, but these errors were encountered:
Well this solved the problem from the title for me, but now when trying to run the iOS Simulator I get the following error:
Error (Xcode): Target debug_unpack_ios failed: Error: Flutter failed to create a directory at "/nix/store/i32cnrvy0iv69hq5ljcff68v9zc9956q-flutter-3.22.2-unwrapped/bin/cache/artifacts".
I'm not sure how i can change the directory where artifacts will be added to by Xcode.
Describe the bug
flutter run
crashes when running through adevenv
shell if it tries to target IOS. The devenv file can be practically empty.Inspired by a Nixos forum post, I suspect that using
mkShellNoCC
instead ofmkShell
somewhere within thedevenv
source or in a Nix flake would solve the problem: https://discourse.nixos.org/t/flutter-for-ios-setup-not-working/43130 I would be glad to check whether this solution worked, but I would need some assistance.To reproduce
flutter
using some non-devenv method (in my case, Homebrew).Running Flutter without
devenv
works …But throw in a
devenv init
beforeflutter run
, and Xcode will fail to find one or more header files:Version
The text was updated successfully, but these errors were encountered: