deedy5 / primp

πŸͺžPRIMP (Python Requests IMPersonate). The fastest python HTTP client that can impersonate web browsers
MIT License
90 stars 7 forks source link

Failed to install on armv7l #39

Closed Shulyaka closed 3 months ago

Shulyaka commented 3 months ago

Hi I am having the below error while installing on armv7l (alpine). It looks like the project builds its own libc which in turn uses a shorter length of time_t. Is there a way to link it against the system libc?

(homeassistant) homeassistant@homeassistant:/tmp/test$ pip install 'primp==0.6.0'
Collecting primp==0.6.0
  Using cached primp-0.6.0.tar.gz (79 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: primp
  Building wheel for primp (pyproject.toml) ... error
  error: subprocess-exited-with-error

  Γ— Building wheel for primp (pyproject.toml) did not run successfully.
  β”‚ exit code: 1
  ╰─> [184 lines of output]
      Running `maturin pep517 build-wheel -i /srv/homeassistant/bin/python --compatibility off`
      πŸ“¦ Including license file "/tmp/pip-install-_ni4tpqv/primp_ed25470dc4094e73933ca3ee0c9c7cfe/LICENSE"
      πŸ”— Found pyo3 bindings with abi3 support for Python β‰₯ 3.8
      🐍 Not using a specific python interpreter
      πŸ“‘ Using build options features from pyproject.toml
         Compiling libc v0.2.155
         Compiling proc-macro2 v1.0.86
         Compiling unicode-ident v1.0.12
         Compiling quote v1.0.36
         Compiling syn v2.0.74
         Compiling cfg-if v1.0.0
         Compiling autocfg v1.3.0
         Compiling version_check v0.9.5
         Compiling shlex v1.3.0
.......
         Compiling cookie_store v0.21.0
         Compiling async-compression v0.4.12
         Compiling rboring v4.9.1
      error[E0308]: mismatched types
         --> /home/homeassistant/.cargo/registry/src/index.crates.io-1cd66030c949c28d/rboring-4.9.1/src/asn1.rs:320:68
          |
      320 |             let handle = cvt_p(ffi::ASN1_TIME_set(ptr::null_mut(), time))?;
          |                                ------------------                  ^^^^ expected `i64`, found `i32`
          |                                |
          |                                arguments to this function are incorrect
          |
      note: function defined here
         --> /tmp/pip-install-_ni4tpqv/primp_ed25470dc4094e73933ca3ee0c9c7cfe/target/release/build/rboring-sys-58a199328b6636d1/out/bindings.rs:3:409883
          |
      3   | ...osix_time : i64) -> * mut ASN1_TIME ; } extern "C" { pub fn ASN1_TIME_set (s : * mut ASN1_TIME , time : time_t) -> * mut ASN1_TIME ; }...
          |                                                                ^^^^^^^^^^^^^
      help: you can convert an `i32` to an `i64`
          |
      320 |             let handle = cvt_p(ffi::ASN1_TIME_set(ptr::null_mut(), time.into()))?;
          |                                                                        +++++++

      For more information about this error, try `rustc --explain E0308`.
      error: could not compile `rboring` (lib) due to 1 previous error
      warning: build failed, waiting for other jobs to finish...
      πŸ’₯ maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `env -u CARGO CARGO_ENCODED_RUSTFLAGS="-C\u{1f}target-feature=-crt-static" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.12-64bit" PYO3_PYTHON="/srv/homeassistant/bin/python" PYTHON_SYS_EXECUTABLE="/srv/homeassistant/bin/python" "cargo" "rustc" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-_ni4tpqv/primp_ed25470dc4094e73933ca3ee0c9c7cfe/Cargo.toml" "--release" "--lib"`
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/srv/homeassistant/bin/python', '--compatibility', 'off'] returned non-zero exit status 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for primp
Failed to build primp
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (primp)
Shulyaka commented 3 months ago

Fixed by updating time_t to i64 in libc-0.2.155/src/unix/linux_like/linux/musl/mod.rs, more info here: https://github.com/rust-lang/libc/issues/1848