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

Ensure beginning and end of the error output is readable #2284

Merged
merged 3 commits into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions openssl-sys/build/find_normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,21 @@ fn find_openssl_dir(target: &str) -> OsString {
return OsString::from("/usr/local");
}

let msg_header =
"Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
compilation process.";

println!(
"cargo:warning={} See stderr section below for further information.",
msg_header.replace('\n', " ")
);

let mut msg = format!(
"

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
compilation process.
{}

Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
Expand All @@ -122,6 +130,7 @@ $TARGET = {}
openssl-sys = {}

",
msg_header,
host,
target,
env!("CARGO_PKG_VERSION")
Expand Down Expand Up @@ -187,7 +196,8 @@ https://github.com/sfackler/rust-openssl#windows
);
}

panic!("{}", msg);
eprintln!("{}", msg);
std::process::exit(101); // same as panic previously
}

/// Attempt to find OpenSSL through pkg-config.
Expand All @@ -212,7 +222,7 @@ fn try_pkg_config() {
{
Ok(lib) => lib,
Err(e) => {
println!("run pkg_config fail: {:?}", e);
println!("\n\nCould not find openssl via pkg-config:\n{}\n", e);
return;
}
};
Expand Down