Skip to content

Bad CPU type in executable clang-tidy on Apple M3 Pro #4833

Open
@jonathanfoster

Description

@jonathanfoster

What kind of issue is this?

  • Question.
    This issue tracker is not the place for questions. If you want to ask how to do something,
    or to understand why something isn't working the way you expect it to,
    use Community Forums or Premium Support

  • PlatformIO IDE.
    All issues related to PlatformIO IDE should be reported to the
    PlatformIO IDE for VSCode repository

  • Development Platform or Board.
    All issues (building, uploading, adding new boards, etc.) related to PlatformIO development platforms
    should be reported to appropriate repository related to your hardware
    https://github.com/topics/platformio-platform

  • Feature Request.
    Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system:

  • macOS Sonoma 14.2.1
  • Darwin Kernel Version 23.2.0: Wed Nov 15 21:54:51 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6030
  • Apple M3 Pro

PlatformIO Version (platformio --version):

  • PlatformIO Core, version 6.1.13

Description of problem

When running pio check with clangtidy on an Apple M3 Pro, the following error is returned:

OSError: [Errno 86] Bad CPU type in executable: '/Users/jonathanfoster/.platformio/packages/tool-clangtidy/clang-tidy'

It appears the incorrect architecture is choosen when installing tool-clangtidy.

$ arch
arm64
$ lipo -info /Users/jonathanfoster/.platformio/packages/tool-clangtidy/clang-tidy
Non-fat file: /Users/jonathanfoster/.platformio/packages/tool-clangtidy/clang-tidy is architecture: x86_64

Uninstalling and reinstalling tool-clandtidy produces the same error.

Steps to Reproduce

  1. Configure platformio.ini to use clang-tidy.

    check_tool = clangtidy
  2. Run static code analysis.

    pio check

Actual Results

$ pio check
Checking lilygo-t-display-s3 > clangtidy (board: lilygo-t-display-s3; platform: espressif32; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
OSError: Traceback (most recent call last):
  File "/opt/homebrew/Cellar/platformio/6.1.13/libexec/lib/python3.12/site-packages/platformio/__main__.py", line 103, in main
    cli()  # pylint: disable=no-value-for-parameter
    ^^^^^
  File "/opt/homebrew/opt/python-click/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/opt/python-click/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/platformio/6.1.13/libexec/lib/python3.12/site-packages/platformio/cli.py", line 85, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/opt/python-click/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/opt/python-click/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/opt/python-click/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/platformio/6.1.13/libexec/lib/python3.12/site-packages/platformio/check/cli.py", line 144, in cli
    rc = ct.check(
         ^^^^^^^^^
  File "/opt/homebrew/Cellar/platformio/6.1.13/libexec/lib/python3.12/site-packages/platformio/check/tools/base.py", line 239, in check
    self.execute_check_cmd(cmd)
  File "/opt/homebrew/Cellar/platformio/6.1.13/libexec/lib/python3.12/site-packages/platformio/check/tools/base.py", line 192, in execute_check_cmd
    result = proc.exec_command(
             ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/platformio/6.1.13/libexec/lib/python3.12/site-packages/platformio/proc.py", line 114, in exec_command
    with subprocess.Popen(*args, **kwargs) as p:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/homebrew/Cellar/[email protected]/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 86] Bad CPU type in executable: '/Users/jonathanfoster/.platformio/packages/tool-clangtidy/clang-tidy'

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `python -m pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq/index.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

Expected Results

pio check should run without error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions