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

OpenBSD 7.4 with LibreSSL 3.8.2 doesn't compile #346

Open McQueen2063 opened 3 months ago

McQueen2063 commented 3 months ago

Describe the bug

Checked out master and ran cargo build --release results in the following error:

  cargo:rustc-cfg=libressl370
  cargo:rustc-cfg=libressl381
  cargo:libressl_version_number=3080200f

  --- stderr
  thread 'main' panicked at '

  This crate is only compatible with OpenSSL (version 1.0.1 through 1.1.1, or 3), or LibreSSL 2.5
  through 3.8.1, but a different version of OpenSSL was found. The build is now aborting
  due to this version mismatch.

Indeed, OpenBSD is at LibreSSL 3.8.2:

openssl version
LibreSSL 3.8.2

To Reproduce Steps to reproduce the behavior:

  1. Install OpenBSD 7.4
  2. pkg_add rust
  3. clone repository
  4. run cargo build --release

I tried applying https://github.com/rapiz1/rathole/pull/311/files and the build doesn't fail at the version check. So that's good.

But it fails later with:

   Compiling fdlimit v0.2.1
error[E0599]: no method named `with_interval` found for struct `TcpKeepalive` in the current scope
  --> src/helper.rs:27:10
   |
25 |       let keepalive = TcpKeepalive::new()
   |  _____________________-
26 | |         .with_time(keepalive_duration)
27 | |         .with_interval(keepalive_interval);
   | |         -^^^^^^^^^^^^^ method not found in `TcpKeepalive`
   | |_________|
   |

For more information about this error, try `rustc --explain E0599`.
error: could not compile `rathole` (lib) due to previous error

Should this rather be a 2nd bug report? :)

Configuration Configuration used to reproduce the behavior:

Nothing configured in this project, apart from applying https://github.com/rapiz1/rathole/pull/311/files before build.

Logs

Environment:

sunnypatell commented 2 months ago

Hello @McQueen2063,

Thank you for reporting this compilation issue and for providing such a detailed account of the behavior, including the steps you've taken to mitigate some of the problems. I appreciate the effort you’ve put into troubleshooting this before reaching out.

Issue Analysis

The error you encountered stems from a version compatibility issue with LibreSSL. Our crate is configured to support up to LibreSSL 3.8.1, and since you are using LibreSSL 3.8.2, it triggers the build abort.

The subsequent error related to TcpKeepalive::with_interval not being found is due to changes or limitations in the fdlimit dependency or its interaction with newer or unsupported versions of Rust or system libraries on OpenBSD.

Suggested Next Steps

  1. Regarding LibreSSL Version Issue:

    • Temporarily, you could modify the crate's configuration to accept LibreSSL 3.8.2 as a valid version by mirroring the adjustments you applied from pull request #311. However, for a permanent fix, we should consider updating the dependency specifications to include support for LibreSSL 3.8.2. I will raise this with the maintainers to incorporate in future releases.
  2. TcpKeepalive Issue:

    • It seems like the method with_interval() might not be available or implemented differently in your environment. This could be due to the version of Rust or the operating system specifics. To better assist you, could you confirm if this method is indeed available in your version of Rust's documentation or if there have been any recent changes to the TcpKeepalive API?
  3. Filing a Separate Bug Report:

    • Given that the issues are somewhat distinct — one relating to version compatibility and another to specific method availability — it might be clearer to track and manage them as separate reports. This would allow us to address the root causes more effectively and organize the resolution process.

Request for Further Information

Could you provide any additional logs that appear after applying the pull request and the detailed error messages from the fdlimit compilation failure? This will help us further diagnose the issue and provide a more targeted solution.