Open georgik opened 3 years ago
Hi @georgik
Do we need this PR to work with the Apple M1 or was it working fine with arm64 based eclipse and java 17?
There are two things we did in the PR
arch -arm64
argument to pythonBuilds Java 17 for macOS arm64 https://download.oracle.com/java/17/latest/jdk-17_macos-aarch64_bin.dmg
Eclipse CPP arm64 build for macOS - this is a prerelease version eclipse-cpp-2021-12-M1-macosx.cocoa.aarch64
Any luck with this? Still experiencing the same issue here on 2.4.2... idf.py builds the project fine, but fails in eclipse due to the architecture mismatch with python required libs.
Hi @expresspotato
Could you confirm whether you are working with AArch64 builds from eclipse?
You could download it directly from here https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2022-03/R/eclipse-cpp-2022-03-R-macosx-cocoa-aarch64.dmg
Yup...
kevin@Kevins-MacBook-Pro MacOS % pwd
/Applications/Eclipse.app/Contents/MacOS
kevin@Kevins-MacBook-Pro MacOS % file eclipse
eclipse: Mach-O 64-bit executable arm64
Version: 2022-03 (4.23.0)
Steps to reproduce:
FAILED: esp-idf/mbedtls/x509_crt_bundle
cd /Users/kevin/workspace/roaming/build/esp-idf/mbedtls && python /Users/kevin/esp/esp-idf/components/mbedtls/esp_crt_bundle/gen_crt_bundle.py --input /Users/kevin/esp/esp-idf/components/mbedtls/esp_crt_bundle/cacrt_all.pem -q
Traceback (most recent call last):
File "/Users/kevin/esp/esp-idf/components/mbedtls/esp_crt_bundle/gen_crt_bundle.py", line 224, in <module>
main()
File "/Users/kevin/esp/esp-idf/components/mbedtls/esp_crt_bundle/gen_crt_bundle.py", line 208, in main
bundle.add_from_file(path)
File "/Users/kevin/esp/esp-idf/components/mbedtls/esp_crt_bundle/gen_crt_bundle.py", line 86, in add_from_file
self.add_from_pem(crt_str)
File "/Users/kevin/esp/esp-idf/components/mbedtls/esp_crt_bundle/gen_crt_bundle.py", line 116, in add_from_pem
self.certificates.append(x509.load_pem_x509_certificate(crt.encode(), default_backend()))
File "/Users/kevin/.espressif/python_env/idf4.3_py3.8_env/lib/python3.8/site-packages/cryptography/hazmat/backends/__init__.py", line 14, in default_backend
from cryptography.hazmat.backends.openssl.backend import backend
File "/Users/kevin/.espressif/python_env/idf4.3_py3.8_env/lib/python3.8/site-packages/cryptography/hazmat/backends/openssl/__init__.py", line 6, in <module>
from cryptography.hazmat.backends.openssl.backend import backend
File "/Users/kevin/.espressif/python_env/idf4.3_py3.8_env/lib/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 113, in <module>
from cryptography.hazmat.bindings.openssl import binding
File "/Users/kevin/.espressif/python_env/idf4.3_py3.8_env/lib/python3.8/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: dlopen(/Users/kevin/.espressif/python_env/idf4.3_py3.8_env/lib/python3.8/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so, 0x0002): tried: '/Users/kevin/.espressif/python_env/idf4.3_py3.8_env/lib/python3.8/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
ninja: build stopped: subcommand failed.
Could you also make sure Java is arm64 based build? This will make sure all the child processes(eclipse, python, etc) also considered as arm64 https://download.oracle.com/java/17/latest/jdk-17_macos-aarch64_bin.dmg
In meantime, I will check and get back to you. Maybe we need to pass arch -arm64
for python as suggested by @georgik .
Could you also make sure Java is arm64 based build? This will make sure all the child processes(eclipse, python, etc) also considered as arm64 https://download.oracle.com/java/17/latest/jdk-17_macos-aarch64_bin.dmg
In meantime, I will check and get back to you. Maybe we need to pass
arch -arm64
for python as suggested by @georgik .
Thanks for the suggestion, but it doesn't work here on M1.
Build of hello_world fails of macOS M1 with following error:
The build works without problem when build from terminal.
To Reproduce Steps to reproduce the behavior:
Expected behavior The build pass
Environment Information: Eclipse 2021-06 x86_64
ESP-IDF Tools Information: ESP-IDF 4.4
Problem analysis The problem is caused by invoking Python in x86_64 mode instead of arm64. Python wheels for M1 is available in arm64 format, the Python executed in x86_64 mode will try to seek for .so which is for x86_64.
Workaround The workaround is to launch Python which has only M1 version, e.g. one from Homebrew, not one from Apple. This Python works:
This Python won't work:
Workaround steps:
~/.espressif/python_env/idf*
export PATH=/opt/homebrew/bin/:$PATH
file `which python3`
- only one arch should be displayedPossible solution: Force launching Python in arm64 for mode. There should be CLI option for macOS M1 to do it