Skip to content

Compilation fails on macOS machine: "ctags: bad CPU type in executable" #433

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
2 of 3 tasks
hgrecco opened this issue Jul 3, 2021 · 5 comments
Closed
2 of 3 tasks
Assignees
Labels
architecture: arm Specific to ARM host architecture conclusion: off topic Off topic for this repository os: macos Specific to macOS operating system topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@hgrecco
Copy link

hgrecco commented Jul 3, 2021

Describe the problem

Cannot Verify/Compile even simple examples (AnalogReadSerial.ino). ctags: bad CPU type in executable in macOS with

To reproduce

Just run the any example.

Using board 'uno' from platform in folder: /Users/grecco/Library/Arduino15/packages/arduino/hardware/avr/1.8.3
Using core 'arduino' from platform in folder: /Users/grecco/Library/Arduino15/packages/arduino/hardware/avr/1.8.3
Detecting libraries used...
/Users/grecco/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/grecco/Library/Arduino15/packages/arduino/hardware/avr/1.8.3/cores/arduino -I/Users/grecco/Library/Arduino15/packages/arduino/hardware/avr/1.8.3/variants/standard /var/folders/xj/xsrq0ml15_q98sq78466mbwr000bjr/T/arduino-sketch-ECD2946323C50FF71A5DD32C03F77EE8/sketch/AnalogReadSerial.ino.cpp -o /dev/null
Generating function prototypes...
/Users/grecco/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/grecco/Library/Arduino15/packages/arduino/hardware/avr/1.8.3/cores/arduino -I/Users/grecco/Library/Arduino15/packages/arduino/hardware/avr/1.8.3/variants/standard /var/folders/xj/xsrq0ml15_q98sq78466mbwr000bjr/T/arduino-sketch-ECD2946323C50FF71A5DD32C03F77EE8/sketch/AnalogReadSerial.ino.cpp -o /var/folders/xj/xsrq0ml15_q98sq78466mbwr000bjr/T/arduino-sketch-ECD2946323C50FF71A5DD32C03F77EE8/preproc/ctags_target_for_gcc_minus_e.cpp
/Users/grecco/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /var/folders/xj/xsrq0ml15_q98sq78466mbwr000bjr/T/arduino-sketch-ECD2946323C50FF71A5DD32C03F77EE8/preproc/ctags_target_for_gcc_minus_e.cpp
Compilation error: Error: 2 UNKNOWN: fork/exec /Users/grecco/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags: bad CPU type in executable

Expected behavior

It should compile.

Arduino IDE version

2.0.0-beta.7

Operating system

macOS

Operating system version

Big Sur (11.4)

Additional context

I also have Arduino 1.8.13 installed and there it works fine. It seems to be using a different toolchain located in:

/Applications/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags

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
@per1234 per1234 added the os: macos Specific to macOS operating system label Jul 4, 2021
@cmaglie cmaglie removed the type: bug label Sep 16, 2021
@rsora rsora added the type: imperfection Perceived defect in any part of project label Sep 22, 2021
@per1234 per1234 added the topic: code Related to content of the project itself label Oct 25, 2021
@flatsiedatsie

This comment has been minimized.

@nickdesaulniers

This comment has been minimized.

@flatsiedatsie

This comment has been minimized.

@per1234 per1234 changed the title ctags: bad CPU type in executable in macOS (2.0.0-beta.7) Compilation fails on macOS machine: "ctags: bad CPU type in executable Oct 25, 2024
@per1234 per1234 changed the title Compilation fails on macOS machine: "ctags: bad CPU type in executable Compilation fails on macOS machine: "ctags: bad CPU type in executable" Oct 25, 2024
@per1234 per1234 self-assigned this Jan 8, 2025
@per1234
Copy link
Contributor

per1234 commented Jan 8, 2025

Thanks for your report @hgrecco. Although Arduino IDE 2.x is a native Apple Silicon application, it uses various helper tools and some of these tools are only available in "Intel" (x86) builds. One such tool is ctags.

Apple has created a "binary translator" named Rosetta 2 that allows x86 applications to run on Apple Silicon machines. So the problem can be solved by simply installing Rosetta 2. You can do that by following these instructions:

https://support.apple.com/102527

We are tracking the need to produce native Apple Silicon builds of ctags to avoid the need for Rosetta 2 here: arduino/ctags#20. The infrastructure is already present in Arduino IDE to automatically install the Apple Silicon build of the the helper tools if available, so no work is needed in this repository in order to resolve this deficiency. For this reason, and since the deficiency is already being tracked in the relevant repository, I'll go ahead and close this issue.

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2025
@per1234 per1234 added conclusion: off topic Off topic for this repository architecture: arm Specific to ARM host architecture labels Jan 8, 2025
@ccashman
Copy link

So the problem can be solved by simply installing Rosetta 2.

The problem of running the Arduino IDE 2.x can be worked around by installing Rosetta 2. The actual problem described here — ctags not natively compiling for Apple Silicon — cannot be worked around by installing Rosetta.

Even for running Arduino IDE 2.x, there’s no assurance that Rosetta is a long-term workaround. Apple has not committed to Rosetta as a permanent feature of macOS, and if we look to the original version, Rosetta 1 only had a lifespan of about five years (2006-2011) before it was removed from the OS.

@arduino arduino locked as off-topic and limited conversation to collaborators Apr 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
architecture: arm Specific to ARM host architecture conclusion: off topic Off topic for this repository os: macos Specific to macOS operating system topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

7 participants