arduino-libraries / ArduinoIoTCloud

Home Page:https://app.arduino.cc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incompatible Lszz.py with Apple M1 processor

elastra21 opened this issue · comments

When you try to run the lszz.py throw that message:

./lzss.py --encode /Users/elw/Documents/PlatformIO/Projects/portenta_web_server_ota/.pio/build/portenta_h7_m7/firmware.bin /Users/elw/Documents/PlatformIO/Projects/portenta_web_server_ota/.pio/build/portenta_h7_m7/firmware.lzss
Traceback (most recent call last):
  File "/Users/elw/Documents/Arduino/libraries/ArduinoIoTCloud/extras/tools/./lzss.py", line 15, in <module>
    lzss_functions = ctypes.CDLL(LZSS_SO_FILE)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 366, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(./lzss.dylib, 0x0006): tried: './lzss.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS./lzss.dylib' (no such file), '/usr/lib/./lzss.dylib' (no such file, not in dyld cache), './lzss.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/Users/elw/Documents/Arduino/libraries/ArduinoIoTCloud/extras/tools/lzss.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/elw/Documents/Arduino/libraries/ArduinoIoTCloud/extras/tools/lzss.dylib' (no such file), '/Users/elw/Documents/Arduino/libraries/ArduinoIoTCloud/extras/tools/lzss.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

@manchoz do you think it makes sense to extend support for this script to Apple M1.

At any rate, this is for internal development purposes and is not intended for invocation by the user (you won't need it) so I'm closing this issue.

It might not be a trivial task... because of parallel support for M1/2s and x86s.

Might we need to generate a "universal" dylib? Or have different dylibs and use some other stuff to detect the Mac architecture, too?

@manchoz do you think it makes sense to extend support for this script to Apple M1.

At any rate, this is for internal development purposes and is not intended for invocation by the user (you won't need it) so I'm closing this issue.

Well in my case I’m using it for OTA upload for a Portenta machine control, which according to the instructions provided by arduino(OTA firmware) is the only way, so there would be an update?

Hi @elastra21,
with GCC or XCode Command Line Tools installed, you may want to generate the M1 version by yourself:

$ mv lzss.dylib lzss_darwin_x64.dylib # for safety/backup
$ gcc -dynamiclib -o lzss.dylib lzss.c

Another option would be launching the terminal with Rosetta 2 and then generating the ota file from there: Run everything in Rosetta 2 on Silicon Mac

Hi @elastra21, with GCC or XCode Command Line Tools installed, you may want to generate the M1 version by yourself:

$ mv lzss.dylib lzss_darwin_x64.dylib # for safety/backup
$ gcc -dynamiclib -o lzss.dylib lzss.c

Another option would be launching the terminal with Rosetta 2 and then generating the ota file from there: Run everything in Rosetta 2 on Silicon Mac

Thank you very much for your reply. I really appreciated it. Recompiling with GCC worked. By the way, are you planning to release an OTA tool for Portenta? Something similar to the esp32-ota command?