question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unable to run app on mac via VSC ssh remote

See original GitHub issue

I’m attempting to use a M1 Macmini (on my desk) to do Flutter dev using VSC’s ssh remote functionality from my Linux laptop (also on my desk). The idea being I can use VSCode on my laptop with all my familiar keyboard shortcuts vs using a KVM or remote desktop to connect to the mini.

I am also using a iphone se connected directly to the mini to run the Flutter apps on.

Its mostly working BUT for the fact that I get errors when actually doing “debug app” from VSC or flutter run from within VSC terminal:

unching lib/main.dart on Maksim’s iPhone in debug mode...
lib/main.dart:1
Automatically signing iOS for device deployment using specified development team in Xcode project: XXXXXXXXXXX
Xcode build done.                                            3.7s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[33352]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1f3b01160) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x115e102b8). One of the two will be used. Which one is undefined.
    objc[33352]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1f3b011b0) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x115e10308). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **
Xcode's output:
↳
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete

The above is for a brand new flutter create project.

Note I can run the app just fine from within VSC if I run VSC directly on the macmini.

My suspicion is this may in part or whole be upstream bugs in VSC and/or Flutter tooling in regards to mistmatch between VSC locally being on my Linux-x86 laptop vs the arm64 of the M1 mini. The mini is running latest MacOS (11.3.1)

Versions (please complete the following information):

  • VS Code version: 1.56.2
  • Dart extension version: 3.22.0
  • Dart/Flutter SDK version: 2.2.1

Also here is the snipped and id-removed error output when running with flutter run --verbose:

 [  +41 ms] debug_unpack_ios: Starting due to {InvalidatedReasonKind.inputChanged: The following
inputs have
               updated contents:

/Users/maks/flutter/packages/flutter_tools/lib/src/build_system/targets/ios.dart,/Users/maks/flutter/bin/in
               ternal/engine.version}
               [ +846 ms] Skipping target: gen_localizations
               [  +16 ms] kernel_snapshot: Starting due to {}
               [  +19 ms] /Users/maks/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
               /Users/maks/flutter/bin/cache/artifacts/engine/darwin-x64/frontend_server.dart.snapshot
--sdk-root
               /Users/maks/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --target=flutter
               --no-print-incremental-dependencies -DFLUTTER_WEB_AUTO_DETECT=true -Ddart.vm.profile=false
               -Ddart.vm.product=false --enable-asserts --track-widget-creation --no-link-platform --packages
               /Users/maks/work/remote_sandbox/.dart_tool/package_config.json --output-dill

/Users/maks/work/remote_sandbox/.dart_tool/flutter_build/c0de518ed1511f855b949df1fd820290/app.dill
               --depfile

/Users/maks/work/remote_sandbox/.dart_tool/flutter_build/c0de518ed1511f855b949df1fd820290/kernel_snapshot.d
               package:remote_sandbox/main.dart
               [+6326 ms] kernel_snapshot: Complete
               [ +329 ms] Persisting file store
               [   +7 ms] Done persisting file store
               [   +7 ms] Target debug_unpack_ios failed: Exception: Failed to codesign
               /Users/maks/work/remote_sandbox/build/ios/Debug-iphoneos/Flutter.framework/Flutter with identity
               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
                          /Users/maks/work/remote_sandbox/build/ios/Debug-iphoneos/Flutter.framework/Flutter:
                          errSecInternalComponent
           
                          #0      _signFramework
(package:flutter_tools/src/build_system/targets/ios.dart:641:5)
                          #1      UnpackIOS.build
(package:flutter_tools/src/build_system/targets/ios.dart:291:5)
                          #2      _BuildInstance._invokeInternal
                          (package:flutter_tools/src/build_system/build_system.dart:828:27)
                          <asynchronous suspension>
                          #3      Future.wait.<anonymous closure> (dart:async/future.dart)
                          <asynchronous suspension>
                          #4      _BuildInstance.invokeTarget
                          (package:flutter_tools/src/build_system/build_system.dart:766:32)
                          <asynchronous suspension>
                          #5      Future.wait.<anonymous closure> (dart:async/future.dart)
                          <asynchronous suspension>
                          #6      _BuildInstance.invokeTarget
                          (package:flutter_tools/src/build_system/build_system.dart:766:32)
                          <asynchronous suspension>
                          #7      FlutterBuildSystem.build
                          (package:flutter_tools/src/build_system/build_system.dart:595:16)
                          <asynchronous suspension>
                          #8      AssembleCommand.runCommand
(package:flutter_tools/src/commands/assemble.dart:318:32)
                          <asynchronous suspension>
                          #9      FlutterCommand.run.<anonymous closure>
                          (package:flutter_tools/src/runner/flutter_command.dart:1043:27)
                          <asynchronous suspension>
                          #10     AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:150:19)
                          <asynchronous suspension>
                          #11     CommandRunner.runCommand (package:args/command_runner.dart:196:13)
                          <asynchronous suspension>
                          #12     FlutterCommandRunner.runCommand.<anonymous closure>
                          (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)
                          <asynchronous suspension>
                          #13     AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:150:19)
                          <asynchronous suspension>
                          #14     FlutterCommandRunner.runCommand
                          (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)
                          <asynchronous suspension>
                          #15     run.<anonymous closure>.<anonymous closure>
(package:flutter_tools/runner.dart:62:9)
                          <asynchronous suspension>
                          #16     AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:150:19)
                          <asynchronous suspension>
                          #17     main (package:flutter_tools/executable.dart:91:3)
                          <asynchronous suspension>
           
               [  +20 ms] "flutter assemble" took 7,802ms.
               [   +5 ms] 
                          #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
                          #1      AssembleCommand.runCommand
(package:flutter_tools/src/commands/assemble.dart:335:7)
                          <asynchronous suspension>
                          #2      FlutterCommand.run.<anonymous closure>
                          (package:flutter_tools/src/runner/flutter_command.dart:1043:27)
                          <asynchronous suspension>
                          #3      AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:150:19)
                          <asynchronous suspension>
                          #4      CommandRunner.runCommand (package:args/command_runner.dart:196:13)
                          <asynchronous suspension>
                          #5      FlutterCommandRunner.runCommand.<anonymous closure>
                          (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)
                          <asynchronous suspension>
                          #6      AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:150:19)
                          <asynchronous suspension>
                          #7      FlutterCommandRunner.runCommand
                          (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)
                          <asynchronous suspension>
                          #8      run.<anonymous closure>.<anonymous closure>
(package:flutter_tools/runner.dart:62:9)
                          <asynchronous suspension>
                          #9      AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:150:19)
                          <asynchronous suspension>
                          #10     main (package:flutter_tools/executable.dart:91:3)
                          <asynchronous suspension>
           
           
               [   +4 ms] ensureAnalyticsSent: 1ms
               [   +1 ms] Running shutdown hooks
               [        ] Shutdown hooks complete
               [   +3 ms] exiting with code 1
               Command PhaseScriptExecution failed with a nonzero exit code
           
           
[  +21 ms] Could not build the precompiled application for the device.
[  +16 ms] Error launching application on Maksim’s iPhone.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
makscommented, Jun 9, 2021

Turns out this was due to keychain needing to be unlocked in a ssh session. Essentially security unlock-keychain needs to be run in the ssh session to unlock the keychain.

I’m not sure whats available via VSCodes remote session support, it seems this is along the same lines as what is causing this issue too. If that gets resolved, perhaps Dartcode could use whatever comes out of it to do the same thing for running Flutter apps in remote sessions too?

1reaction
DanTupcommented, Jun 9, 2021

If that gets resolved, perhaps Dartcode could use whatever comes out of it to do the same thing for running Flutter apps in remote sessions too?

If there’s a reasonably clean fix, I don’t see why not - although I think it could probably be better solved by VS Code (or their SSH extension) more generally. Extensions generally shouldn’t need to understand the specifics of specific types of remotes, but if it’s all we have, it’s better fixed than not.

It may also be worth filing an issue with Flutter that the error is hard to track down. In the verbose output it seems like there was a more useful error message:

               [   +7 ms] Target debug_unpack_ios failed: Exception: Failed to codesign
               /Users/maks/work/remote_sandbox/build/ios/Debug-iphoneos/Flutter.framework/Flutter with identity
               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
                          /Users/maks/work/remote_sandbox/build/ios/Debug-iphoneos/Flutter.framework/Flutter:
                          errSecInternalComponent

But when run in non-verbose mode, the error seemed different and much less obvious what’s wrong. I would have expected that “Failed to codesign” message to be clearer in non-verbose output.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remote Development Tips and Tricks - Visual Studio Code
Visual Studio Code Remote Development troubleshooting tips and tricks for SSH, Containers, and the Windows Subsystem for Linux (WSL)
Read more >
Remote Development using SSH - Visual Studio Code
The Visual Studio Code Remote - SSH extension allows you to open a remote folder on any remote machine, virtual machine, or container...
Read more >
Remote SSH access with Visual Studio Code
Remotely editing files using SSH and Vim means you're no longer in ... To run the app, press F5, and select the Flask...
Read more >
Connect over SSH with Visual Studio Code
Before connecting in Remote - SSH, you can verify you're able to connect to your VM via a command prompt using ssh user@hostname...
Read more >
Working over SSH with Visual Studio Code
VS Code Remote SSH. What is SSH? SSH, or the secure shell protocol, lets you access a remote computer or virtual machine securely...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found