aswinnnn / pyscan

python dependency vulnerability scanner, written in Rust.
MIT License
184 stars 6 forks source link

Cannot install pyscan `v0.1.4` on Mac with an older rust compiler (`< v1.70`) #8

Closed anotherbridge closed 1 year ago

anotherbridge commented 1 year ago

Describe the bug When I am trying to install pyscan on a macOS ARM machine it fails to compile pyscan. This issue occurs when trying to install via pip, but also when trying to install it via cargo.

To Reproduce Steps to reproduce the behavior:

  1. Run either pip install pyscan-rs or cargo install pyscan

Expected behavior The package gets installed and can be run without a problem.

Actual behavior

When running pip install pyscan-rs I receive the following output:

Collecting pyscan-rs
  Using cached pyscan_rs-0.1.4.tar.gz (38 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyscan-rs
  Building wheel for pyscan-rs (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyscan-rs (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [190 lines of output]
      Running `maturin pep517 build-wheel -i <venv path>/.venv/bin/python --compatibility off`
      📦 Including license file "/private/var/folders/g6/1dvcy97x3csc2l37gkddt5v80000gn/T/pip-install-n_84foc6/pyscan-rs_c4f7cbfdf3f345208a46148b7460f024/LICENSE"
      🔗 Found bin bindings
      📡 Using build options bindings from pyproject.toml
      💻 Using `MACOSX_DEPLOYMENT_TARGET=11.0` for aarch64-apple-darwin by default
         Compiling libc v0.2.144
         Compiling autocfg v1.1.0
         Compiling proc-macro2 v1.0.57
         Compiling unicode-ident v1.0.8
         Compiling quote v1.0.27
         Compiling cfg-if v1.0.0
         Compiling io-lifetimes v1.0.10
         Compiling once_cell v1.18.0
         Compiling rustix v0.37.19
         Compiling log v0.4.17
         Compiling bitflags v1.3.2
         Compiling pin-project-lite v0.2.9
         Compiling core-foundation-sys v0.8.4
         Compiling futures-core v0.3.28
         Compiling serde v1.0.163
         Compiling memchr v2.5.0
         Compiling bytes v1.4.0
         Compiling indexmap v1.9.3
         Compiling tokio v1.28.1
         Compiling itoa v1.0.6
         Compiling cc v1.0.79
         Compiling slab v0.4.8
         Compiling futures-task v0.3.28
         Compiling syn v2.0.16
         Compiling hashbrown v0.12.3
         Compiling tracing-core v0.1.31
         Compiling semver v1.0.17
         Compiling fnv v1.0.7
         Compiling futures-util v0.3.28
         Compiling errno v0.3.1
         Compiling num_cpus v1.15.0
         Compiling socket2 v0.4.9
         Compiling mio v0.8.6
         Compiling version_check v0.9.4
         Compiling ahash v0.8.3
         Compiling security-framework-sys v2.9.0
         Compiling core-foundation v0.9.3
         Compiling tracing v0.1.37
         Compiling http v0.2.9
         Compiling psm v0.1.21
         Compiling pin-utils v0.1.0
         Compiling fastrand v1.9.0
         Compiling tinyvec_macros v0.1.1
         Compiling httparse v1.8.0
         Compiling lazy_static v1.4.0
         Compiling futures-channel v0.3.28
         Compiling futures-sink v0.3.28
         Compiling futures-io v0.3.28
         Compiling native-tls v0.2.11
         Compiling tempfile v3.5.0
         Compiling tinyvec v1.6.0
         Compiling security-framework v2.9.0
         Compiling stacker v0.1.15
         Compiling num-traits v0.2.15
         Compiling try-lock v0.2.4
         Compiling utf8parse v0.2.1
         Compiling percent-encoding v2.2.0
         Compiling want v0.3.0
         Compiling form_urlencoded v1.1.0
         Compiling anstyle-parse v0.2.0
         Compiling unicode-normalization v0.1.22
         Compiling serde_derive v1.0.163
         Compiling tokio-macros v2.1.0
         Compiling lenient_semver_version_builder v0.4.2
         Compiling http-body v0.4.5
         Compiling is-terminal v0.4.7
         Compiling num-integer v0.1.45
         Compiling httpdate v1.0.2
         Compiling anstyle-query v1.0.0
         Compiling tower-service v0.3.2
         Compiling unicode-bidi v0.3.13
         Compiling anstyle v1.0.0
         Compiling colorchoice v1.0.0
         Compiling ryu v1.0.13
         Compiling idna v0.3.0
         Compiling anstream v0.3.2
         Compiling lenient_semver_parser v0.4.2
         Compiling hashbrown v0.13.2
         Compiling heck v0.4.1
         Compiling winnow v0.4.6
         Compiling serde_json v1.0.96
         Compiling strsim v0.10.0
         Compiling clap_lex v0.4.1
         Compiling chumsky v1.0.0-alpha.4
         Compiling clap_derive v4.2.0
         Compiling clap_builder v4.2.7
         Compiling url v2.3.1
         Compiling lenient_version v0.4.2
         Compiling time v0.1.45
         Compiling aho-corasick v1.0.1
         Compiling iana-time-zone v0.1.56
         Compiling tokio-util v0.7.8
         Compiling tokio-native-tls v0.3.1
         Compiling encoding_rs v0.8.32
         Compiling h2 v0.3.19
         Compiling base64 v0.21.0
         Compiling regex-syntax v0.7.1
         Compiling mime v0.3.17
         Compiling ipnet v2.7.2
         Compiling toml_datetime v0.6.1
         Compiling serde_spanned v0.6.1
         Compiling toml_edit v0.19.8
         Compiling serde_urlencoded v0.7.1
         Compiling hyper v0.14.26
         Compiling unicode-width v0.1.10
         Compiling console v0.15.5
         Compiling regex v1.8.1
         Compiling toml v0.7.3
         Compiling hyper-tls v0.5.0
         Compiling reqwest v0.11.17
         Compiling pep-508 v0.3.0
         Compiling clap v4.2.7
         Compiling chrono v0.4.24
         Compiling lenient_semver v0.4.2
         Compiling pyscan v0.1.4 (/private/var/folders/g6/1dvcy97x3csc2l37gkddt5v80000gn/T/pip-install-n_84foc6/pyscan-rs_c4f7cbfdf3f345208a46148b7460f024)
      error[E0658]: use of unstable library feature 'once_cell'
       --> src/main.rs:5:5
        |
      5 | use std::sync::OnceLock;
        |     ^^^^^^^^^^^^^^^^^^^
        |
        = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

      error[E0658]: use of unstable library feature 'once_cell'
        --> src/main.rs:89:19
         |
      89 | static ARGS: Lazy<OnceLock<Cli>> =  Lazy::new(|| {OnceLock::from(Cli::parse())});
         |                   ^^^^^^^^^^^^^
         |
         = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

      error[E0658]: use of unstable library feature 'once_cell'
        --> src/main.rs:89:51
         |
      89 | static ARGS: Lazy<OnceLock<Cli>> =  Lazy::new(|| {OnceLock::from(Cli::parse())});
         |                                                   ^^^^^^^^
         |
         = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

      error[E0658]: use of unstable library feature 'once_cell'
         --> src/parser/structs.rs:148:17
          |
      148 |         if ARGS.get().unwrap().pip {
          |                 ^^^
          |
          = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

      error[E0658]: use of unstable library feature 'once_cell'
         --> src/parser/structs.rs:150:24
          |
      150 |         } else if ARGS.get().unwrap().pypi {
          |                        ^^^
          |
          = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

      error[E0658]: use of unstable library feature 'once_cell'
         --> src/main.rs:106:15
          |
      106 |     if !&ARGS.get().unwrap().cache_off {
          |               ^^^
          |
          = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

      error[E0658]: use of unstable library feature 'once_cell'
         --> src/main.rs:111:17
          |
      111 |     match &ARGS.get().unwrap().subcommand {
          |                 ^^^
          |
          = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

      error[E0658]: use of unstable library feature 'once_cell'
         --> src/main.rs:147:30
          |
      147 |     if let Some(dir) = &ARGS.get().unwrap().dir { parser::scan_dir(dir.as_path()).await }
          |                              ^^^
          |
          = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

      For more information about this error, try `rustc --explain E0658`.
      error: could not compile `pyscan` due to 8 previous errors
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `MACOSX_DEPLOYMENT_TARGET="11.0" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/private/var/folders/g6/1dvcy97x3csc2l37gkddt5v80000gn/T/pip-install-n_84foc6/pyscan-rs_c4f7cbfdf3f345208a46148b7460f024/Cargo.toml" "--release" "--bin" "pyscan"`
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '<venv path>/.venv/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 pyscan-rs
Failed to build pyscan-rs
ERROR: Could not build wheels for pyscan-rs, which is required to install pyproject.toml-based projects

Desktop (please complete the following information):

aswinnnn commented 1 year ago

That feature is unstable on rustc < 1.70 AFAIK. I didn't put a lot of thought into it att, but now it seems like it's a breaking change, thanks for pointing it out. Updating your rust with rustup or similar should fix it for ya, But I'm not sure why this happened to pip, I had already provided wheels, but pip chose to build the wheels anyway? Pretty weird. Now that I think I might have not provided the wheels for mac, I apologize. Again, thanks for pointing this out, let me know if updating rust solves it

anotherbridge commented 1 year ago

Hi, thanks updating rustc I could at least install it via cargo.

aswinnnn commented 1 year ago

No problem, wheels for mac will be uploaded to pypi will from now on (after the CIs fixed).