Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible Lszz.py with Apple M1 processor #364

Closed
elastra21 opened this issue Jun 15, 2023 · 6 comments · Fixed by #399
Closed

Incompatible Lszz.py with Apple M1 processor #364

elastra21 opened this issue Jun 15, 2023 · 6 comments · Fixed by #399
Labels
topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project

Comments

@elastra21
Copy link

elastra21 commented Jun 15, 2023

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'))
@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Jun 15, 2023
@aentinger
Copy link
Collaborator

@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.

@manchoz
Copy link
Contributor

manchoz commented Jun 16, 2023

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?

@elastra21
Copy link
Author

elastra21 commented Jun 17, 2023

@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?

@manchoz
Copy link
Contributor

manchoz commented Jun 19, 2023

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

@elastra21
Copy link
Author

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?

@manchoz
Copy link
Contributor

manchoz commented Jun 20, 2023

@elastra21 You are welcome!

I was wondering if extracting a small Go tool from https://github.com/arduino/arduino-cloud-cli/blob/3f024b074f07c9dbee2bbd3459462954823e0061/internal/ota/encoder.go#L27 might make sense @aentinger WDYT?

@per1234 per1234 added conclusion: declined Will not be worked on topic: infrastructure Related to project infrastructure labels Nov 3, 2023
@per1234 per1234 removed the conclusion: declined Will not be worked on label Dec 22, 2023
@per1234 per1234 linked a pull request Dec 22, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants