Build fails on macOS M1 Apple Silicon in Eclipse, while it works on CLI
  • 10-May-2023
Lightrun Team
Author Lightrun Team
Build fails on macOS M1 Apple Silicon in Eclipse, while it works on CLI

Build fails on macOS M1 Apple Silicon in Eclipse, while it works on CLI (IEP-545)

Lightrun Team
Lightrun Team

Explanation of the problem

The hello_world project build fails on macOS M1 with the following error message: “ImportError: dlopen(/Users/georgik/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/cryptography/hazmat/bindings/, 2): no suitable image found. Did find: /Users/georgik/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/cryptography/hazmat/bindings/ mach-o, but wrong architecture.” The build works fine when built from the terminal.

To reproduce the issue, create a hello_world project and build it. The build fails in a later stage when Python is invoked, which requires cryptography. The expected behavior is for the build to pass. The environment information includes Eclipse 2021-06 x86_64 and ESP-IDF 4.4.


Troubleshooting with the Lightrun Developer Observability Platform

Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.

  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

Start for free today

Problem solution for Build fails on macOS M1 Apple Silicon in Eclipse, while it works on CLI (IEP-545)

The problem analysis shows that the problem is caused by invoking Python in x86_64 mode instead of arm64. Python wheels for M1 are available in the arm64 format, and the Python executed in x86_64 mode will try to look for .so files, which are for x86_64. To work around the issue, launch Python with only M1 version, such as one from Homebrew, instead of the one from Apple.

Code block:

remove ~/.espressif/python_env/idf*
explicitly set priority to PATH to Homebrew Python: export PATH=/opt/homebrew/bin/:$PATH
double check the Python: file `which python3` - only one arch should be displayed

The workaround steps are to remove ~/.espressif/python_env/idf*, explicitly set priority to PATH to Homebrew Python, double-check Python, run, and update the Eclipse configuration to point to the newly created virtualenv. A possible solution is to force launching Python in arm64 mode, which should have a CLI option for macOS M1.

Other popular problems with idf-eclipse-plugin

The IDF-Eclipse-Plugin is a powerful tool that provides developers with an integrated development environment for creating and managing ESP32 and ESP32-S2 projects. However, like any complex software, it can experience a range of problems. Below are three common issues that developers may encounter when working with the IDF-Eclipse-Plugin, along with their descriptions and solutions.

  1. “ESP-IDF not found” Error

One of the most common issues that developers face when using the IDF-Eclipse-Plugin is the “ESP-IDF not found” error. This error occurs when the plugin is unable to locate the ESP-IDF installation directory. The error message usually looks like this:


Error: ESP-IDF not found in '/path/to/esp-idf'


To resolve this issue, developers need to ensure that they have correctly installed the ESP-IDF and configured the IDF-Eclipse-Plugin to use the correct installation directory. To configure the IDF-Eclipse-Plugin, follow these steps:

  1. Open Eclipse and navigate to Window -> Preferences.
  2. Expand the ESP32 menu and select “ESP32 Eclipse Settings.”
  3. Under “ESP32 Toolchain Settings,” set the “ESP-IDF Path” to the correct installation directory of ESP-IDF.
  4. Click “Apply” and then “OK” to save the changes.

Once the plugin is configured correctly, the “ESP-IDF not found” error should no longer appear.

  1. Build Errors

Another common issue that developers face when working with the IDF-Eclipse-Plugin is build errors. These errors occur when the plugin encounters issues with compiling the code. The error message usually looks like this:


make: *** [build/main/app_main.o] Error 1


To resolve this issue, developers need to carefully review the error message and identify the specific source of the error. The most common causes of build errors are issues with include paths, linker errors, and missing dependencies. To fix these errors, developers should modify the code or the build settings accordingly. For example, if the error is caused by a missing dependency, developers can add the missing dependency to the project’s CMakeLists.txt file like this:


    SRCS "main.c"
    REQUIRES some_missing_dependency
  1. Debugging Issues The IDF-Eclipse-Plugin also provides developers with a debugging environment to help identify and resolve issues in their code. However, debugging issues can also arise when using the plugin. The most common debugging issue is when the debugger is unable to connect to the device. The error message usually looks like this:

Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED\

To resolve this issue, developers need to ensure that their device is properly connected to their computer and that the correct drivers are installed. Additionally, the debugger configuration in the IDF-Eclipse-Plugin may need to be modified to use the correct interface and port settings. For example, if the device is connected over JTAG, developers can modify the debugger configuration like this:


openocd -f interface/jlink.cfg -c "transport select jtag" -f target/esp32.cfg

Overall, these three issues are the most common problems developers may encounter when using the IDF-Eclipse-Plugin. By following the solutions outlined above, developers can resolve these issues and continue to work effectively with the plugin.

A brief introduction to idf-eclipse-plugin

The IDF-Eclipse-Plugin is a development environment tool that integrates the Eclipse IDE with the Espressif IoT Development Framework (IDF). It provides developers with an efficient and user-friendly interface for building and debugging IoT applications on Espressif hardware. The plugin includes features such as syntax highlighting, code completion, project management, and a graphical interface for configuring and flashing firmware. This tool simplifies the process of developing applications for Espressif chips by providing a comprehensive set of tools and resources for developers.

The IDF-Eclipse-Plugin provides an intuitive user interface and seamless integration with the IDF framework. It is built using the Eclipse platform and is designed to work with a variety of platforms, including Windows, macOS, and Linux. The plugin enables developers to create, edit, and manage their projects using a standard IDE environment, reducing the learning curve associated with developing for the IDF. Additionally, the plugin offers a comprehensive set of debugging tools, including a graphical debugger, memory viewer, and log viewer, to help developers troubleshoot their applications.

Most popular use cases for idf-eclipse-plugin

  1. IDE Integration: The IDF-Eclipse-Plugin can be used to integrate the ESP-IDF with the Eclipse IDE. This plugin provides the necessary tools to develop and debug ESP32 applications in the Eclipse environment. It provides a user-friendly interface for creating and managing IDF projects, as well as a powerful set of tools for code editing and debugging. Developers can leverage the plugin’s features to build complex ESP32 applications with ease, including support for advanced debugging features like breakpoints, call stacks, and variable watching.
  2. Project Management: The IDF-Eclipse-Plugin can be used to manage ESP-IDF projects effectively. It provides a convenient way to create, manage, and configure IDF projects from within the Eclipse IDE. Developers can use the plugin’s wizards to create new IDF projects with just a few clicks, and configure project settings such as build targets, debuggers, and other options. The plugin also provides a project explorer that allows developers to navigate the project hierarchy, view files and folders, and access project properties and settings.
  3. Build System Integration: The IDF-Eclipse-Plugin can be used to integrate the ESP-IDF build system with the Eclipse IDE. This integration allows developers to use the powerful Eclipse build system to compile and build their ESP32 applications. Developers can take advantage of the plugin’s build tools to configure the build system, specify build targets, and compile and build the application. The plugin also provides a console output view that shows build progress and errors, as well as a task view that shows build tasks and their status.

Code Block Example: Creating a new IDF Project using the IDF-Eclipse-Plugin

To create a new IDF project using the IDF-Eclipse-Plugin, follow these steps:

  1. Open Eclipse IDE and select File > New > IDF Project.
  2. In the New IDF Project dialog box, enter the project name and select the location where you want to save the project.
  3. Select the IDF version you want to use and choose the target device for your application.
  4. Configure other project settings such as build system, debugging options, and other options as needed.
  5. Click Finish to create the project.

The IDF-Eclipse-Plugin will create a new IDF project with the specified settings and configurations. Developers can then start coding, building, and debugging their ESP32 applications within the Eclipse IDE.


It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications. It’s a registration form away.

Get Lightrun

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.