Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after upgrading to 3.7.3 on Intel Mac: This binary was built with the incorrect architecture to run on this machine. #120697

Closed
nausharipov opened this issue Feb 14, 2023 · 14 comments
Labels
c: crash Stack traces logged to the console c: regression It was better in the past than it is now needs repro info Automated crash report whose cause isn't yet known platform-mac Building on or for macOS specifically t: flutter doctor Problem related to the "flutter doctor" tool tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@nausharipov
Copy link

nausharipov commented Feb 14, 2023

Flutter doesn't work on my 2019 Intel MacBook Pro after upgrading to version 3.7.3. Version 3.7.0 doesn't work either.

Steps to Reproduce

  1. Choose stable channel
  2. flutter upgrade
  3. flutter doctor

MacBook specs:
2,6 GHz 6-Core Intel Core i7
MacOS Ventura 13.0.1 (22A400)

flutter upgrade:

Flutter is already up to date on channel stable
Flutter 3.7.3 
• channel stable
• https://github.com/flutter/flutter.git

Logs

Logs

flutter doctor -v:

null
This binary was built with the incorrect architecture to run on this machine.
Flutter requires the Rosetta translation environment. If you are on an ARM Mac, try running:
  sudo softwareupdate --install-rosetta --agree-to-license


#0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1      _throwFileSystemException (package:flutter_tools/src/base/error_handling_io.dart:840:3)
#2      _handleMacOSException (package:flutter_tools/src/base/error_handling_io.dart:779:5)
#3      _runSync (package:flutter_tools/src/base/error_handling_io.dart:619:7)
#4      ErrorHandlingProcessManager.runSync (package:flutter_tools/src/base/error_handling_io.dart:717:12)
#5      _DefaultProcessUtils.runSync (package:flutter_tools/src/base/process.dart:376:51)
#6      AndroidStudio._init (package:flutter_tools/src/android/android_studio.dart:458:39)
#7      new AndroidStudio (package:flutter_tools/src/android/android_studio.dart:40:5)
#8      AndroidStudio.fromMacOSBundle (package:flutter_tools/src/android/android_studio.dart:90:12)
#9      AndroidStudio._allMacOS.<anonymous closure> (package:flutter_tools/src/android/android_studio.dart:316:68)
#10     MappedListIterable.elementAt (dart:_internal/iterable.dart:415:31)
#11     ListIterator.moveNext (dart:_internal/iterable.dart:344:26)
#12     WhereTypeIterator.moveNext (dart:_internal/iterable.dart:871:20)
#13     new _GrowableList._ofOther (dart:core-patch/growable_array.dart:202:26)
#14     new _GrowableList.of (dart:core-patch/growable_array.dart:152:26)
#15     new List.of (dart:core-patch/array_patch.dart:52:28)
#16     Iterable.toList (dart:core/iterable.dart:470:12)
#17     AndroidStudio._allMacOS (package:flutter_tools/src/android/android_studio.dart:318:10)
#18     AndroidStudio.allInstalled (package:flutter_tools/src/android/android_studio.dart:247:34)
#19     AndroidStudio.latestValid (package:flutter_tools/src/android/android_studio.dart:232:41)
#20     AppContext._generateIfNecessary.<anonymous closure> (package:flutter_tools/src/base/context.dart:104:42)
#21     _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:535:23)
#22     AppContext._generateIfNecessary (package:flutter_tools/src/base/context.dart:92:20)
#23     AppContext.get (package:flutter_tools/src/base/context.dart:121:32)
#24     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#25     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#26     androidStudio (package:flutter_tools/src/globals.dart:62:45)
#27     runInContext.<anonymous closure> (package:flutter_tools/src/context_runner.dart:103:32)
#28     AppContext._generateIfNecessary.<anonymous closure> (package:flutter_tools/src/base/context.dart:104:42)
#29     _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:535:23)
#30     AppContext._generateIfNecessary (package:flutter_tools/src/base/context.dart:92:20)
#31     AppContext.get (package:flutter_tools/src/base/context.dart:121:32)
#32     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#33     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#34     androidLicenseValidator (package:flutter_tools/src/android/android_workflow.dart:30:65)
#35     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:53:32)
#36     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1426:12)
<asynchronous suspension>
#37     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1257:27)
<asynchronous suspension>
#38     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#39     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#40     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:283:9)
<asynchronous suspension>
#41     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#42     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#43     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
<asynchronous suspension>
#44     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#45     main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
@kbot
Copy link

kbot commented Feb 15, 2023

Same here. Seeing all versions 3.7.0+ on stable channel fail flutter doctor -v command with:

This binary was built with the incorrect architecture to run on this machine.
Flutter requires the Rosetta translation environment. If you are on an ARM Mac, try running:
  sudo softwareupdate --install-rosetta --agree-to-license



#0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1      _throwFileSystemException (package:flutter_tools/src/base/error_handling_io.dart:840:3)
#2      _handleMacOSException (package:flutter_tools/src/base/error_handling_io.dart:779:5)
#3      _runSync (package:flutter_tools/src/base/error_handling_io.dart:619:7)
#4      ErrorHandlingProcessManager.runSync (package:flutter_tools/src/base/error_handling_io.dart:717:12)
#5      _DefaultProcessUtils.runSync (package:flutter_tools/src/base/process.dart:376:51)
#6      AndroidStudio._init (package:flutter_tools/src/android/android_studio.dart:458:39)
#7      new AndroidStudio (package:flutter_tools/src/android/android_studio.dart:40:5)
#8      AndroidStudio.fromMacOSBundle (package:flutter_tools/src/android/android_studio.dart:90:12)
#9      AndroidStudio._allMacOS.<anonymous closure> (package:flutter_tools/src/android/android_studio.dart:316:68)
#10     MappedListIterable.elementAt (dart:_internal/iterable.dart:415:31)
#11     ListIterator.moveNext (dart:_internal/iterable.dart:344:26)
#12     WhereTypeIterator.moveNext (dart:_internal/iterable.dart:871:20)
#13     new _GrowableList._ofOther (dart:core-patch/growable_array.dart:202:26)
#14     new _GrowableList.of (dart:core-patch/growable_array.dart:152:26)
#15     new List.of (dart:core-patch/array_patch.dart:52:28)
#16     Iterable.toList (dart:core/iterable.dart:470:12)
#17     AndroidStudio._allMacOS (package:flutter_tools/src/android/android_studio.dart:318:10)
#18     AndroidStudio.allInstalled (package:flutter_tools/src/android/android_studio.dart:247:34)
#19     AndroidStudio.latestValid (package:flutter_tools/src/android/android_studio.dart:232:41)
#20     AppContext._generateIfNecessary.<anonymous closure> (package:flutter_tools/src/base/context.dart:104:42)
#21     _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:535:23)
#22     AppContext._generateIfNecessary (package:flutter_tools/src/base/context.dart:92:20)
#23     AppContext.get (package:flutter_tools/src/base/context.dart:121:32)
#24     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#25     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#26     androidStudio (package:flutter_tools/src/globals.dart:62:45)
#27     runInContext.<anonymous closure> (package:flutter_tools/src/context_runner.dart:103:32)
#28     AppContext._generateIfNecessary.<anonymous closure> (package:flutter_tools/src/base/context.dart:104:42)
#29     _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:535:23)
#30     AppContext._generateIfNecessary (package:flutter_tools/src/base/context.dart:92:20)
#31     AppContext.get (package:flutter_tools/src/base/context.dart:121:32)
#32     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#33     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#34     androidLicenseValidator (package:flutter_tools/src/android/android_workflow.dart:30:65)
#35     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:53:32)
#36     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1426:12)
<asynchronous suspension>
#37     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1257:27)
<asynchronous suspension>
#38     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#39     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#40     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:283:9)
<asynchronous suspension>
#41     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#42     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#43     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
<asynchronous suspension>
#44     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#45     main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>

running the same with the arm package correctly produces:

Bad CPU type in executable

@nausharipov nausharipov changed the title After upgrading to 3.7.3: This binary was built with the incorrect architecture to run on this machine. Error after upgrading to 3.7.3 on Intel Mac: This binary was built with the incorrect architecture to run on this machine. Feb 15, 2023
@huycozy huycozy added the in triage Presently being triaged by the triage team label Feb 15, 2023
@huycozy
Copy link
Member

huycozy commented Feb 15, 2023

Hi @nausharipov, @kbot
Which previous version was it working? And does the error disappear after running the comment in the output message (sudo softwareupdate --install-rosetta --agree-to-license)?

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 15, 2023
@nausharipov
Copy link
Author

nausharipov commented Feb 15, 2023

Hi @huycozy

v3.3.2 was the previous working version for me.

Running the command returns the error below, because I'm using an Intel Mac, and not Apple Silicon:
Installing Rosetta 2 on this system is not supported.

Version 3.7.0 doesn't work either. I also tried to download the zip file with stable v3.7.3 for Intel Mac from flutter.dev and it returns the same error.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 15, 2023
@kbot
Copy link

kbot commented Feb 15, 2023

Hi @nausharipov, @kbot Which previous version was it working? And does the error disappear after running the comment in the output message (sudo softwareupdate --install-rosetta --agree-to-license)?

3.3.10 works for me. And same, I'm on an Intel mac so I can't install rosetta.

@huycozy
Copy link
Member

huycozy commented Feb 16, 2023

Thanks for the responses. But I can't reproduce this issue from my end with Mac Intel (also tried downgrading and upgrading again).

Labeling the issue for further investigation!

Kindly /cc @jmagman for thoughts.

@huycozy huycozy added tool Affects the "flutter" command-line tool. See also t: labels. platform-mac Building on or for macOS specifically t: flutter doctor Problem related to the "flutter doctor" tool needs repro info Automated crash report whose cause isn't yet known c: regression It was better in the past than it is now c: crash Stack traces logged to the console and removed in triage Presently being triaged by the triage team labels Feb 16, 2023
@jmagman
Copy link
Member

jmagman commented Feb 16, 2023

@kbot how did you install Flutter? Is it possible you downloaded the arm64 version of Flutter (to run on Apple Silicon, not Intel Macs) from https://docs.flutter.dev/get-started/install/macos or https://docs.flutter.dev/development/tools/sdk/releases?tab=macos?

@jmagman jmagman added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 16, 2023
@kbot
Copy link

kbot commented Feb 17, 2023

I had originally thought that is what I might have done, so I tested that as well. If I download the arm64 version on an intel I get a simple Bad CPU type in executable, not the large stack trace.

Can't remember how I originally installed Flutter, but I had been on 2.10.5 for a while. Decided it was time to move to 3+ and ran flutter upgrade. After seeing the error on 3.7.3 I tried rolling back by downloading the x64 versions all the way back to 3.3.10, replacing the flutter folder each time until I didn't get the error.

However, this morning I realized I had vs code & android studio open while I was doing this. So I closed both and tried manually grabbing the latest stable from https://docs.flutter.dev/get-started/install/macos again. Now I'm not seeing the error when running flutter doctor -v. Possibly having a flutter deamon running while doing all this was causing the error?

@jmagman
Copy link
Member

jmagman commented Feb 17, 2023

Guess it would help to look at the stacktrace 🙂

#5 _DefaultProcessUtils.runSync (package:flutter_tools/src/base/process.dart:376:51)
#6 AndroidStudio._init (package:flutter_tools/src/android/android_studio.dart:458:39)
#7 new AndroidStudio (package:flutter_tools/src/android/android_studio.dart:40:5)

In @kbot's case it's not complaining about flutter not having the right architecture, but that java isn't built with the right architecture when it runs java -version.

final String javaExecutable = globals.fs.path.join(javaPath, 'bin', 'java');
if (!globals.processManager.canRun(javaExecutable)) {
_validationMessages.add('Unable to find bundled Java version.');
} else {
RunResult? result;
try {
result = globals.processUtils.runSync(<String>[javaExecutable, '-version']);

@nausharipov I don't see your stack trace so I don't know what executable it was trying to run. That error message should specify it.

#114558

@nausharipov
Copy link
Author

@jmagman

flutter doctor -v:

null
This binary was built with the incorrect architecture to run on this machine.
Flutter requires the Rosetta translation environment. If you are on an ARM Mac, try running:
  sudo softwareupdate --install-rosetta --agree-to-license


#0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1      _throwFileSystemException (package:flutter_tools/src/base/error_handling_io.dart:840:3)
#2      _handleMacOSException (package:flutter_tools/src/base/error_handling_io.dart:779:5)
#3      _runSync (package:flutter_tools/src/base/error_handling_io.dart:619:7)
#4      ErrorHandlingProcessManager.runSync (package:flutter_tools/src/base/error_handling_io.dart:717:12)
#5      _DefaultProcessUtils.runSync (package:flutter_tools/src/base/process.dart:376:51)
#6      AndroidStudio._init (package:flutter_tools/src/android/android_studio.dart:458:39)
#7      new AndroidStudio (package:flutter_tools/src/android/android_studio.dart:40:5)
#8      AndroidStudio.fromMacOSBundle (package:flutter_tools/src/android/android_studio.dart:90:12)
#9      AndroidStudio._allMacOS.<anonymous closure> (package:flutter_tools/src/android/android_studio.dart:316:68)
#10     MappedListIterable.elementAt (dart:_internal/iterable.dart:415:31)
#11     ListIterator.moveNext (dart:_internal/iterable.dart:344:26)
#12     WhereTypeIterator.moveNext (dart:_internal/iterable.dart:871:20)
#13     new _GrowableList._ofOther (dart:core-patch/growable_array.dart:202:26)
#14     new _GrowableList.of (dart:core-patch/growable_array.dart:152:26)
#15     new List.of (dart:core-patch/array_patch.dart:52:28)
#16     Iterable.toList (dart:core/iterable.dart:470:12)
#17     AndroidStudio._allMacOS (package:flutter_tools/src/android/android_studio.dart:318:10)
#18     AndroidStudio.allInstalled (package:flutter_tools/src/android/android_studio.dart:247:34)
#19     AndroidStudio.latestValid (package:flutter_tools/src/android/android_studio.dart:232:41)
#20     AppContext._generateIfNecessary.<anonymous closure> (package:flutter_tools/src/base/context.dart:104:42)
#21     _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:535:23)
#22     AppContext._generateIfNecessary (package:flutter_tools/src/base/context.dart:92:20)
#23     AppContext.get (package:flutter_tools/src/base/context.dart:121:32)
#24     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#25     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#26     androidStudio (package:flutter_tools/src/globals.dart:62:45)
#27     runInContext.<anonymous closure> (package:flutter_tools/src/context_runner.dart:103:32)
#28     AppContext._generateIfNecessary.<anonymous closure> (package:flutter_tools/src/base/context.dart:104:42)
#29     _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:535:23)
#30     AppContext._generateIfNecessary (package:flutter_tools/src/base/context.dart:92:20)
#31     AppContext.get (package:flutter_tools/src/base/context.dart:121:32)
#32     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#33     AppContext.get (package:flutter_tools/src/base/context.dart:119:24)
#34     androidLicenseValidator (package:flutter_tools/src/android/android_workflow.dart:30:65)
#35     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:53:32)
#36     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1426:12)
<asynchronous suspension>
#37     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1257:27)
<asynchronous suspension>
#38     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#39     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#40     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:283:9)
<asynchronous suspension>
#41     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#42     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#43     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
<asynchronous suspension>
#44     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#45     main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 17, 2023
@jmagman
Copy link
Member

jmagman commented Feb 17, 2023

Ah same spot then, running java -version is the executable inside Android Studio that is built for the wrong architecture. I filed #120942 to make this error message more usable.

Is it possible you accidentally installed the Apple Silicon version of Android Studio (and therefore the java binary packaged with it)? Like Flutter, they ship the architecture installers separately:

Screenshot 2023-02-17 at 10 12 52 AM

https://developer.android.com/studio/archive

@nausharipov
Copy link
Author

It is possible. I'll check today.

@nausharipov
Copy link
Author

nausharipov commented Feb 20, 2023

My Android Studio version was Application (Universal) Android Studio 2021.1, build AI-211.7628.21.2111.8092744.

I reinstalled the recent version of Android Studio, and Flutter 3.7.3 works now. My problem is solved.

@jmagman
Copy link
Member

jmagman commented Feb 21, 2023

I think I'll close this with my fix to #120942, hopefully that error message is now more actionable and it's clearer that it's a problem running java (and the path it's being run), not with running the flutter tool itself.

@jmagman jmagman closed this as completed Feb 21, 2023
@github-actions
Copy link

github-actions bot commented Mar 7, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: crash Stack traces logged to the console c: regression It was better in the past than it is now needs repro info Automated crash report whose cause isn't yet known platform-mac Building on or for macOS specifically t: flutter doctor Problem related to the "flutter doctor" tool tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

No branches or pull requests

4 participants