Skip to content

No ports reported on macos ventura 13.1 apple silicon arduino 2.0.3 unless rosetta is installed #1818

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

Closed
3 tasks done
nickdesaulniers opened this issue Jan 15, 2023 · 13 comments · Fixed by arduino/help-center-content#172
Assignees
Labels
architecture: arm Specific to ARM host architecture conclusion: resolved Issue was resolved os: macos Specific to macOS operating system topic: documentation Related to documentation for the project type: imperfection Perceived defect in any part of project

Comments

@nickdesaulniers
Copy link

nickdesaulniers commented Jan 15, 2023

Describe the problem

Apple Silicon-based machines (M1, M2 CPUs) are able to run applications built for x86 host thanks to the Rosetta 2 binary translator.

Rosetta 2 is not installed by default, but when an x86 application is started on an Apple Silicon-based machine, macOS displays a dialog offering the installation to the user:

https://support.apple.com/en-us/HT211861

Since native Apple Silicon builds have better performance, Arduino produced the first Arduino IDE 2.x build for this target and published it in December. Unlike the x86 build of Arduino IDE 2.x, starting the Apple Silicon build does not result in the Rosetta 2 installation dialog. Even though Rosetta 2 is not needed by the Arduino IDE application itself, the IDE uses a wide array of additional tools. Many of these are not available in an Apple Silicon build:

🐛 These tools produce an error when Arduino IDE attempts to execute them:

bad CPU type in executable

This produces an array of symptoms. For example, no serial ports are discovered (due to not having a functional serial-discovery tool).

To reproduce

  1. Download the Apple Silicon build of Arduino IDE:
    https://www.arduino.cc/en/software
  2. Start Arduino IDE on an Apple Silicon machine that does not have Rosetta 2 installed.

🐛 No Rosetta 2 installation prompt is shown.
🐛 All x86 targeted tools fail to execute.
🐛 The IDE displays a variety of symptoms, including no ports listed, failed compilation ...

Expected behavior

The dependency on Rosetta 2 is communicated to the user.

Arduino IDE version

2.0.3

Operating system

macOS

Operating system version

Ventura

Additional context

Fix

  1. Open your Applications folder in Finder.
  2. Open the Utilities folder.
  3. Double-click on "Terminal".
  4. Type the following command in the Terminal window:
    softwareupdate --install-rosetta
    
  5. Accept the license agreement.
  6. Wait for the installation to finish.

Additional reports

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@nickdesaulniers
Copy link
Author

I've also played with System Settings (macos) > Privacy & Security > Allow Accessories to Connect.

For "Ask Every Time" I do get a promt each time I plug in my device. If I accept then open Arduino IDE it makes no difference. The option "Always" doesn't seem to make a difference either.

@per1234 per1234 transferred this issue from arduino/Arduino Jan 15, 2023
@per1234 per1234 self-assigned this Jan 15, 2023
@per1234 per1234 added topic: documentation Related to documentation for the project architecture: arm Specific to ARM host architecture os: macos Specific to macOS operating system type: imperfection Perceived defect in any part of project labels Jan 15, 2023
@nickdesaulniers
Copy link
Author

Ok, so we were able to resolve the forum thread (at least my issue). So it looks like if you run a binary compiled for x86_64-apple-darwin on apple silicon which expects aarch64-apple-darwin (err, maybe aarch64e, which is their own ABI for BTI/PAC IIRC), then you will not get a prompt to install rosetta. You need to manually install rosetta, which can be done from the command line via softwareupdate --install-rosetta.

So I guess it's a matter of contacting expressif or whomever to provide cross compilers for aarch64e-apple-darwin hosts in their board manager files. Not sure how pervasive this is, but perhaps the arduino ide could trigger the rosetta install for the time being? That would have been nice.

@nickdesaulniers
Copy link
Author

Sorry, it's arduino-fwuploader that's first failing (see the forum post for the stack trace) which is a node.js app, IIUC.

@nickdesaulniers
Copy link
Author

Not sure where the source for arduino-ide-extension are to report the issue to.

"arduino-ide-extension": "2.0.4"

https://www.npmjs.com/search?q=arduino-ide-extension

@nickdesaulniers
Copy link
Author

(The forum is blocking me from responding on thread: An error occurred: We're sorry, but new users are temporarily limited to 3 replies in the same topic.)

Perhaps if the Arduino IDE is looking at stderr of the subprocesses it invokes, it might be able to notice the bad CPU type in executable string (or 214 return code) and prompt the user to install rosetta.

man errno shows that 86 EBADARCH is used on macos. I forgot to check $? when running, but I'd guess the return code would have been 128+86==214?

I've also "contacted my vendor" to ask about macos support.
espressif/crosstool-NG#39

@nickdesaulniers nickdesaulniers changed the title No ports reported on macos ventura 13.1 apple silicon arduino 2.0.3 No ports reported on macos ventura 13.1 apple silicon arduino 2.0.3 unless rosetta is installed Jan 15, 2023
@nickdesaulniers
Copy link
Author

Looks like a dup of #1796.

@army11b1980
Copy link

Very much looking forward to a resolution for this issue.
Apple M1
OS Ventura
IDE 2.0.3 for Mac
Rosetta 2 installed
!!Bad CPU Type!!

@per1234
Copy link
Contributor

per1234 commented Jan 18, 2023

@army11b1980 resolve the issue by installing Rosetta 2:

  1. Open your Applications folder in Finder.
  2. Open the Utilities folder.
  3. Double-click on "Terminal".
  4. Type the following command in the Terminal window:
    softwareupdate --install-rosetta
    
  5. Accept the license agreement.
  6. Wait for the installation to finish.

The error will no longer occur.

@army11b1980
Copy link

@per1234 I have Rosetta 2 installed. I still have this error.

@per1234
Copy link
Contributor

per1234 commented Jan 19, 2023

@army11b1980 please post the full and exact output that contains the "Bad CPU Type" error.

@army11b1980
Copy link

@per1234
Failed uploading: cannot execute upload tool: fork/exec /Users/michaelsmacstudio/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/bin/avrdude: bad CPU type in executable

@per1234
Copy link
Contributor

per1234 commented Jan 23, 2023

/Users/michaelsmacstudio/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/bin/avrdude: bad CPU type in executable

OK, this is a completely different problem that happens to produce the same error message. The problem here is you are using a very old version of AVRDUDE from when Arduino only distributed 32-bit macOS builds of that tool. Support for 32-bit applications was dropped in macOS 10.15 Catalina:

https://support.apple.com/en-us/HT208436

So when you attempt to run a 32-bit application you get this "bad CPU type in executable" error.

Since your problem is unrelated to the subject of this bug report, and is also not related to the codebase hosted in this repository, it will not be appropriate to continue the discussion here. But if you make a post on the Arduino Forum, I'll be happy to provide you with assistance in solving the problem:

https://forum.arduino.cc/c/using-arduino/installation-troubleshooting/18

@per1234
Copy link
Contributor

per1234 commented Feb 19, 2023

Closing as resolved to the extent that is feasible through the addition of a dedicated article in the Arduino Help Center:

https://support.arduino.cc/hc/en-us/articles/7765785712156-Error-bad-CPU-type-in-executable-on-macOS

I have been closely monitoring GitHub and Arduino Forum for reports and fortunately it seems to not affect many users. So hopefully that will be sufficient. I also hope that Apple might eventually enhance the user experience under these conditions with something similar to the Rosetta installation offer dialog that shows when starting an x86 application.

@per1234 per1234 closed this as completed Feb 19, 2023
@per1234 per1234 added the conclusion: resolved Issue was resolved label Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture: arm Specific to ARM host architecture conclusion: resolved Issue was resolved os: macos Specific to macOS operating system topic: documentation Related to documentation for the project type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants