OctoPrint / OctoPrint-FirmwareUpdater

OctoPrint plugin for flashing pre-compiled firmware images to a 3D printer.
https://plugins.octoprint.org/plugins/firmwareupdater/
GNU Affero General Public License v3.0
351 stars 76 forks source link

Plugin requires marlin-binary-protocol, but it won't install: longintrepr.h: no such file or directory #355

Closed salfter closed 7 months ago

salfter commented 8 months ago

Hardware Setup BTT SKR 1.4 Turbo

Describe the problem https://github.com/trippwill/marlin-binary-protocol was archived over two years ago. It doesn't build under current versions of Python. I had used it previously to upgrade firmware in my AM8 as the LPC176x support isn't suitable for my installation (UART connection to the printer, not USB). The firmware updater plugin still requires marlin-binary-protocol to support binary file transfers...or it says it does, anyway.

(More precisely, it looks like it's heatshrink that isn't building properly, but it's a dependency of marlin-binary-protocol, which in turn is a dependency of this plugin.)

Log Files

am8-alpine:~$ octoprint/bin/pip install marlin-binary-protocol
Collecting marlin-binary-protocol
  Downloading marlin_binary_protocol-0.0.7-py3-none-any.whl (7.2 kB)
Collecting heatshrink>=0.3.2 (from marlin-binary-protocol)
  Downloading Heatshrink-0.3.2.tar.gz (280 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 280.5/280.5 kB 624.9 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting heatshrink2>=0.9 (from marlin-binary-protocol)
  Downloading heatshrink2-0.12.0.tar.gz (111 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 111.3/111.3 kB 1.3 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pyserial>=3.4 in ./octoprint/lib/python3.11/site-packages (from marlin-binary-protocol) (3.5)
Building wheels for collected packages: heatshrink, heatshrink2
  Building wheel for heatshrink (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-311
      creating build/lib.linux-aarch64-cpython-311/heatshrink
      copying heatshrink/streams.py -> build/lib.linux-aarch64-cpython-311/heatshrink
      copying heatshrink/__init__.py -> build/lib.linux-aarch64-cpython-311/heatshrink
      running build_ext
      building 'heatshrink.core' extension
      creating build/temp.linux-aarch64-cpython-311
      creating build/temp.linux-aarch64-cpython-311/heatshrink
      creating build/temp.linux-aarch64-cpython-311/heatshrink/_heatshrink
      gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I. -I./heatshrink/_heatshrink -I/home/salfter/octoprint/include -I/usr/include/python3.11 -c heatshrink/_heatshrink/heatshrink_decoder.c -o build/temp.linux-aarch64-cpython-311/heatshrink/_heatshrink/heatshrink_decoder.o -std=c99
      gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I. -I./heatshrink/_heatshrink -I/home/salfter/octoprint/include -I/usr/include/python3.11 -c heatshrink/_heatshrink/heatshrink_encoder.c -o build/temp.linux-aarch64-cpython-311/heatshrink/_heatshrink/heatshrink_encoder.o -std=c99
      gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I. -I./heatshrink/_heatshrink -I/home/salfter/octoprint/include -I/usr/include/python3.11 -c heatshrink/core.c -o build/temp.linux-aarch64-cpython-311/heatshrink/core.o -std=c99
      heatshrink/core.c:69:12: fatal error: longintrepr.h: No such file or directory
         69 |   #include "longintrepr.h"
            |            ^~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for heatshrink
  Running setup.py clean for heatshrink
  Building wheel for heatshrink2 (setup.py) ... done
  Created wheel for heatshrink2: filename=heatshrink2-0.12.0-cp311-cp311-linux_aarch64.whl size=298137 sha256=5ee0fe3dd1d79f41813a1abe962ec651928f93a0fecd399ff223b6246def829b
  Stored in directory: /home/salfter/.cache/pip/wheels/0f/65/28/f6fdb9477c6f0d7b788443c46c13b9d5e0c12f5bce5845df93
Successfully built heatshrink2
Failed to build heatshrink
ERROR: Could not build wheels for heatshrink, which is required to install pyproject.toml-based projects
salfter commented 8 months ago

Building from https://github.com/p3p/pyheatshrink/releases/download/0.3.3/pyheatshrink-pip.zip (as described in the docs) doesn't work either...same error. I tried making a tarball that included the missing header file (/usr/include/python3.11/cpython/longintrepr.h, which some pages, but wound up with a bunch more errors.

I'm beginning to think that Python 3.11 is to blame, based on similar issues with other projects. I'm going to try again with Python 3.10, which I've figured out how to get on the latest Alpine instead of 3.11.

salfter commented 8 months ago

It looks like marlin-binary-protocol was never updated following the obsolescence of Python 2. I've fixed it to remove the heatshrink dependency...it'll only use heatshrink2 now. It builds just fine that way. I've forked it and pushed out a new release:

https://gitlab.alfter.us/salfter/marlin-binary-protocol/-/archive/v0.0.8/marlin-binary-protocol-v0.0.8.tar.gz

The plugin should work with this version, but I've not had a chance to test it just yet. If it does work, you might want to update the installation instructions accordingly.

github-actions[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had any recent activity. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed in 5 days.

github-actions[bot] commented 7 months ago

This issue has been automatically locked because there was no further activity after it was closed. Please open a new issue for any related problems.