Build fails on macOS M1 Apple Silicon in Eclipse, while it works on CLI (IEP-545)
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/_openssl.abi3.so, 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/_openssl.abi3.so: 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
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.
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 run install.sh
The workaround steps are to remove ~/.espressif/python_env/idf*, explicitly set priority to PATH to Homebrew Python, double-check Python, run install.sh, 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.
- “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:
- Open Eclipse and navigate to Window -> Preferences.
- Expand the ESP32 menu and select “ESP32 Eclipse Settings.”
- Under “ESP32 Toolchain Settings,” set the “ESP-IDF Path” to the correct installation directory of ESP-IDF.
- 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.
- 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:
idf_component_register( SRCS "main.c" INCLUDE_DIRS "." REQUIRES some_missing_dependency )
- 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
It’s Really not that Complicated.
You can actually understand what’s going on inside your live applications. It’s a registration form away.