rsmgclient icon indicating copy to clipboard operation
rsmgclient copied to clipboard

Handle Build Errors and upgrade OpenSSL to v3

Open dspatoulas opened this issue 1 year ago • 0 comments

When adding the rsmgclient to a rust project, the build fails due to the dependency on OpenSSL, but the error message that's displayed does not clearly identify the issue.

❯ cargo build
   Compiling rsmgclient v2.0.2
error: failed to run custom build command for `rsmgclient v2.0.2`

Caused by:
  process didn't exit successfully: `/Users/deej/code/graph-poc/target/debug/build/rsmgclient-369b1a59e35fb6da/build-script-build` (exit status: 101)
  --- stdout
  MacOS detected. We will check if you have either the MacPorts or Homebrew package managers.
  Checking for MacPorts...
  Macports not found.
  Checking for Homebrew...
  'brew' executable detected at "/opt/homebrew/bin/brew\n"
  Proceeding with installation assuming Homebrew is your package manager

  --- stderr
  thread 'main' panicked at /Users/deej/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rsmgclient-2.0.2/build.rs:101:14:
  called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Running brew install openssl installs a newer version of OpenSSL, v3.4.1, but the build.rs included in the project attempts to locate the v1.1 directory as part of the build process.

This PR resolves https://github.com/memgraph/rsmgclient/issues/60 and https://github.com/memgraph/rsmgclient/issues/64 by upgrading the OpenSSL dependency to v3. The addition of a BuildError type allows developers to more easily identify the issue, and handle each distinct error case more specifically in the future.

Updated Error:

❯ cargo build
   Compiling rsmgclient v2.0.2 (/Users/deej/code/rsmgclient)
error: failed to run custom build command for `rsmgclient v2.0.2 (/Users/deej/code/rsmgclient)`

Caused by:
  process didn't exit successfully: `/Users/deej/code/rsmgclient/target/debug/build/rsmgclient-894cc56226a82700/build-script-build` (exit status: 1)
  --- stdout
  MacOS detected. We will check if you have either the MacPorts or Homebrew package managers.
  Checking for MacPorts...
  Macports not found.
  Checking for Homebrew...
  'brew' executable detected at "/opt/homebrew/bin/brew\n"
  Proceeding with installation assuming Homebrew is your package manager
  Found OpenSSL at path: /opt/homebrew/Cellar/[email protected]

  --- stderr
  Error: OpenSSL("Failed to read OpenSSL directory: 'No such file or directory (os error 2)'")

dspatoulas avatar Feb 22 '25 19:02 dspatoulas