rapiz1 / rathole

A lightweight and high-performance reverse proxy for NAT traversal, written in Rust. An alternative to frp and ngrok.
Apache License 2.0
8.8k stars 440 forks source link

Compiling fails on FreeBSD when the websocket-rustls feature is enabled #335

Closed yonas closed 4 months ago

yonas commented 4 months ago

Describe the bug Following #330 , compiling fails on FreeBSD when the websocket-rustls feature is enabled.

To Reproduce Steps to reproduce the behavior:

  1. cargo build --release --features rustls,websocket-rustls

Logs

error[E0658]: use of unstable library feature 'stdsimd'                                                                                                                                                              
  --> /code/rathole/work/rathole-4ac53a5/cargo-crates/curve25519-dalek-4.1.2/src/backend/vector/ifma/field.rs:26:5                                                                               
   |                                                                                                                                                                                                                 
26 |     _mm256_madd52lo_epu64(z.into(), x.into(), y.into()).into()
   |     ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #48556 <https://github.com/rust-lang/rust/issues/48556> for more information
   = help: add `#![feature(stdsimd)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'stdsimd'
  --> /code/rathole/work/rathole-4ac53a5/cargo-crates/curve25519-dalek-4.1.2/src/backend/vector/ifma/field.rs:25:9
   |
25 |     use core::arch::x86_64::_mm256_madd52lo_epu64;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #48556 <https://github.com/rust-lang/rust/issues/48556> for more information
   = help: add `#![feature(stdsimd)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'stdsimd'
  --> /code/rathole/work/rathole-4ac53a5/cargo-crates/curve25519-dalek-4.1.2/src/backend/vector/ifma/field.rs:34:5
   |
34 |     _mm256_madd52hi_epu64(z.into(), x.into(), y.into()).into()
   |     ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #48556 <https://github.com/rust-lang/rust/issues/48556> for more information
   = help: add `#![feature(stdsimd)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'stdsimd'
  --> /code/rathole/work/rathole-4ac53a5/cargo-crates/curve25519-dalek-4.1.2/src/backend/vector/ifma/field.rs:33:9
   |
33 |     use core::arch::x86_64::_mm256_madd52hi_epu64;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #48556 <https://github.com/rust-lang/rust/issues/48556> for more information
   = help: add `#![feature(stdsimd)]` to the crate attributes to enable

error[E0635]: unknown feature `stdarch_x86_avx512`
  --> /code/rathole/work/rathole-4ac53a5/cargo-crates/curve25519-dalek-4.1.2/src/lib.rs:19:13
   |
19 |     feature(stdarch_x86_avx512)
   |             ^^^^^^^^^^^^^^^^^^

Environment:

rapiz1 commented 4 months ago

it looks pretty like a dependency issue. could you please try the latest rust toolchain and compile after a cargo update? cc @sunmy2019

I honestly have no idea why this is happening given we have tested it on ubuntu

name: Run tests with rustls
        run: cargo test --verbose --no-default-features --features server,client,rustls,noise,websocket-rustls,hot-reload

there's a great chance it's a packaging thing.

yonas commented 4 months ago

could you please try the latest rust toolchain and compile after a cargo update?

@rapiz1 Thanks, I'm getting the same error after running cargo update.

rapiz1 commented 4 months ago

Would you mind also sharing your rustc version? @yonas

sunmy2019 commented 4 months ago

Enabling rustls requiring disabling default features. Can you try this?

cargo build --release  --no-default-features --features websocket-rustls
sunmy2019 commented 4 months ago

See similar situations in https://github.com/jdx/mise/issues/1630

yonas commented 4 months ago

Would you mind also sharing your rustc version?

rustc 1.76.0-nightly (37b2813a7 2023-11-24) (built from a source tarball)

Can you try cargo build --release --no-default-features --features websocket-rustls

I'm getting the same errors.

rapiz1 commented 4 months ago

rustc 1.76.0-nightly (37b2813a7 2023-11-24) (built from a source tarball)

I can build using rustc 1.76.0 (07dca489a 2024-02-04) without issues. You may want to update to the latest stable or nightly.

It's meant to break nightly as per https://github.com/dalek-cryptography/curve25519-dalek/pull/619#issuecomment-1931198286 I agree the their argument as well: no point of supporting out of date nightly

sunmy2019 commented 4 months ago

rustc 1.76.0-nightly (37b2813a7 2023-11-24) (built from a source tarball)

One of our dependencies only supports the latest nightly. Others have filed report here: https://github.com/dalek-cryptography/curve25519-dalek/pull/619

Use something other than nightly will be good.

yonas commented 4 months ago

Upgrading to nightly on linux fixed the issue.

FreeBSD ports doesn't yet have the latest nightly, so I've resorted to pinning curve25519-dalek to v4.1.1.

Use something other than nightly will be good.

I agree, it should be optional. For example, I wonder if rathole's build.rs / Cargo.toml could detect if nightly is being used and then switch the version of curve25519-dalek from =v4.1.1 to >=v4.1.2.

rapiz1 commented 4 months ago

Glad to hear that it worked for you. That is possible but we will not introduce the maintenance burden for an outdated nightly build. Whenever FreeBSD gets to the latest nightly or stable of rustc, it will work seamlessly. The build should never fail on stable toolchain. Once you opt in for nightly, you're mostly responsible for resolving dependencies on your own because there's no compatibility promise for nightly. I will strongly suggest you use stable toolchain to compile rathole, if you don't have special needs.