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

Failed to build wheel on FreeBSD #885

Closed
hhartzer opened this issue Nov 23, 2022 · 13 comments
Closed

Failed to build wheel on FreeBSD #885

hhartzer opened this issue Nov 23, 2022 · 13 comments

Comments

@hhartzer
Copy link

This looks awesome and I am really excited to try it out. However, I'm using FreeBSD so I have to build my own wheels.

I got this error when building the wheel with pip install:

         Compiling update-informer v0.5.0
         Compiling rustpython-parser v0.1.2 (https://github.com/RustPython/RustPython.git?rev=f885db8c61514f069979861f6b3bd83292086231#f885db8c)
      error: could not compile `rustpython-parser` due to 3 previous errors
      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": `"cargo" "rustc" "--release" "--manifest-path" "/tmp/pip-install-tg6ervfc/ruff_3df4680c1987441aa387abf9fda1d11d/Cargo.toml" "--message-format" "json" "--bin" "ruff" "--" "-C" "link-arg=-s"`
      📦 Including license file "/tmp/pip-install-tg6ervfc/ruff_3df4680c1987441aa387abf9fda1d11d/LICENSE"
      🍹 Building a mixed python/rust project
      🔗 Found bin bindings
      error[E0658]: `let...else` statements are unstable
        --> /root/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/f885db8/compiler/parser/build.rs:20:5
         |
      20 | /     let Ok(target) = File::open(target) else {
      21 | |         return Some("python.rs doesn't exist. regenerate.".to_owned());
      22 | |     };
         | |______^
         |
         = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information


      error[E0658]: `let...else` statements are unstable
        --> /root/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/f885db8/compiler/parser/build.rs:72:5
         |
      72 | /     let Some(_message) = requires_lalrpop(source, target) else {
      73 | |         return Ok(());
      74 | |     };
         | |______^
         |
         = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information


      error: aborting due to 2 previous errors


      For more information about this error, try `rustc --explain E0658`.

      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/root/tmp/venv3.9/bin/python3.9', '--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 ruff
Failed to build ruff
ERROR: Could not build wheels for ruff, which is required to install pyproject.toml-based projects

Seems like it could be a bug in rustpython-parser. It mentions rust-lang/rust#87335

Is there anything I should try with this? Should I open an upstream bug? Not well versed in Rust, unfortunately.

@charliermarsh
Copy link
Member

Thanks! Sorry for the trouble. Can you check what version of Rust you have? (It should be rustup show.)

Separately, do you know what's required to build wheels for FreeBSD? I'm really not familiar but I'm happy to support it!

@hhartzer
Copy link
Author

hhartzer commented Nov 23, 2022

I appreciate your fast response!

I actually don't have rustup, but my rust version appears to be 1.64.0 from the package's version and rustc's --version output. I don't know if that's a bit out of date or not.

As for FreeBSD wheels, I haven't done that before. I don't see any mention of FreeBSD with cross compiling for Maturin, nor issues on the topic. It may be possible though to use Cirrus CI as it can launch macOS and FreeBSD VMs. I know with go, cross-compilation is really simple, but I imagine with rust that may not be the case. If I find out more on this, I'll let you know! I don't think FreeBSD wheels are terribly common, unfortunately.

Even cryptography doesn't have FreeBSD wheels: https://pypi.org/project/cryptography/#files

@hhartzer
Copy link
Author

I'm starting to think that I need 1.65. 1.65 is incoming for FreeBSD (already in ports), but will probably take a couple more days to build.

https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html#let-else-statements

This is good to know, although surprising to me that such a newly released language feature would be used already, a couple weeks later. In the Python world there's usually a fairly lengthy EOL lifetime (maybe too long!).

@charliermarsh
Copy link
Member

Ah ok! Yeah, it looks like RustPython is now using some 1.65 language features. (1.65 recently reached the "stable" channel so it's fair game.)

@charliermarsh
Copy link
Member

You could try pip install ruff==0.0.132 (I upgraded RustPython in 0.0.133, and it's possible that the older version was compilable under 1.64, I'm not 100% sure!).

@messense
Copy link
Contributor

Even cryptography doesn't have FreeBSD wheels

pypi doesn't allow uploading wheels besides Linux, macOS and Windows at the moment.

https://github.com/pypi/warehouse/blob/683e578c55af527e79d7941670eb61b69cb37865/warehouse/forklift/legacy.py#L79-L147

@messense
Copy link
Contributor

@charliermarsh Consider set rust-version in Cargo.toml to produce a better error message in this case.

https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field

@hhartzer
Copy link
Author

Thank you! I'm actually going to give rust 165.0 a try via rustup. Will report back.

@messense
Copy link
Contributor

BTW, Cirrus CI is good choice for testing FreeBSD, and it even supports arm64 macOS and Linux, we use it in maturin: https://github.com/PyO3/maturin/blob/main/.cirrus.yml

@charliermarsh
Copy link
Member

Every time @messense chimes in I learn a bunch of good stuff, thank you.

@hhartzer
Copy link
Author

ruff builds and seems to run! Thank you!

@chriswells0
Copy link

chriswells0 commented Nov 29, 2023

@hhartzer Would you mind sharing the steps you used to build it? I don't see rustup in ports, and I'm not familiar with it at all. I mostly don't want to dig into it if that wasn't the final solution.

@hhartzer
Copy link
Author

hhartzer commented Dec 1, 2023

@hhartzer Would you mind sharing the steps you used to build it? I don't see rustup in ports, and I'm not familiar with it at all. I mostly don't want to dig into it if that wasn't the final solution.

I think because the rust version was too old, I fetched rustup in this manner: https://forge.rust-lang.org/infra/other-installation-methods.html#rustup

But the rust version in ports may be current enough now to install just via pip if you also have rust installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants