question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Build of hello_world fails of macOS M1 with following error:

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
    /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
ninja: build stopped: subcommand failed.

The build works without problem when build from terminal.

To Reproduce Steps to reproduce the behavior:

  1. Create hello_world project and build it.
  2. The build fail in later stage when it’s invoking Python which requires cryptography

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:

/opt/homebrew/bin//python3: Mach-O 64-bit executable arm64

This Python won’t work:

% file /usr/bin/python3
/usr/bin/python3: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/python3 (for architecture x86_64):	Mach-O 64-bit executable x86_64
/usr/bin/python3 (for architecture arm64e):	Mach-O 64-bit executable arm64e

Workaround steps:

  • remove ~/.espressif/python_env/idf*
  • explicitly set priotity 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
  • update Eclipse configuration to point to newly created virtualenv

Possible solution: Force launching Python in arm64 for mode. There should be CLI option for macOS M1 to do it

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
kolipakakondalcommented, Nov 9, 2021

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

  • Passing arch -arm64 argument to python
  • Setting correct python version to the java process runner >>> this is anyway required

Builds 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

0reactions
expresspotatocommented, May 19, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ZSH Won't Run an M1 Command Line Tool Built in Xcode
I have a command line tool that zsh refuses to run when built for Apple Silicon or as a univerisal binary (the specific...
Read more >
Newcomers » Unable to open Eclipse.app
Hi all, I am writing to ask you for some solution to a problem with Eclipse version for MacOS Apple Silicon. Every time...
Read more >
SLC CLI not working on Mac OS 12.3 with M1 Pro CPU
I tried to run SLC CLI tools on Mac OS 12.3 (M1 Pro CPU) but I've got a message that slc-cli.app is damaged....
Read more >
Eclipse crashes on MacBook M1 - Stack Overflow
There are two ways to run eclipse on apple M1. Running eclipse for intel architecture using rosetta translator(requires jdk as well as ...
Read more >
Cmake fails to build on M1 mac apple silicon - Image.sc Forum
when running mvn clean install in GitHub - flimlib/flimlib: FLIMLib: a package for exponential curve fitting of fluorescence lifetime image ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found