[BUG] Rust server doesn't compile due to openssl crate version
Created by: TeFiLeDo
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Bounty to sponsor the fix (example)
Description
I generated rust code from the pet store example. Once I try to compile it, I get an error, stating that my OpenSSL version can't be found.
openapi-generator version
4.1.0
OpenAPI declaration file content or url
Command line used for generation
$ wget https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml
$ openapi-generator generate -g rust-server -i petstore.yaml -o .
$ cargo build
Steps to reproduce
- install openapi generator
- run the commands listed above
- output (only the error message):
error: failed to run custom build command for `openssl v0.9.24` process didn't exit successfully: `/tmp/petstore/target/release/build/openssl-b5ed42bc514b85ed/build-script-build` (exit code: 101) --- stderr thread 'main' panicked at 'Unable to detect OpenSSL version', /home/adrian/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/build.rs:16:14 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. warning: build failed, waiting for other jobs to finish... error: build failed
- rust backtrace:
stack backtrace: 0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39 1: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:71 2: std::panicking::default_hook::{{closure}} at src/libstd/sys_common/backtrace.rs:59 at src/libstd/panicking.rs:197 3: std::panicking::default_hook at src/libstd/panicking.rs:211 4: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:474 5: std::panicking::begin_panic at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/panicking.rs:408 6: build_script_build::main at ./build.rs:16 7: std::rt::lang_start::{{closure}} at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/rt.rs:64 8: std::panicking::try::do_call at src/libstd/rt.rs:49 at src/libstd/panicking.rs:293 9: __rust_maybe_catch_panic at src/libpanic_unwind/lib.rs:87 10: std::rt::lang_start_internal at src/libstd/panicking.rs:272 at src/libstd/panic.rs:388 at src/libstd/rt.rs:48 11: std::rt::lang_start at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/rt.rs:64 12: main 13: __libc_start_main 14: _start
Related issues/PRs
I didn't find a similar issue.
Suggest a fix
It seems that error is due to openapi generator using an old version of rusts OpenSSL bindings. I found this issue in the repository of these bindings.