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

link openssl statically for Windows #3118

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions .github/scripts/install-all-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -e

here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

os_name="$1"

# shellcheck source=.github/scripts/install-openssl.sh
source "$here/install-openssl.sh" "$os_name"
# shellcheck source=.github/scripts/install-proto.sh
source "$here/install-proto.sh" "$os_name"
18 changes: 18 additions & 0 deletions .github/scripts/install-openssl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -e

os_name="$1"

case "$os_name" in
"Windows")
choco install openssl --version 3.3.2 --install-arguments="'/DIR=C:\OpenSSL'" -y
export OPENSSL_LIB_DIR="C:\OpenSSL\lib\VC\x64\MT"
export OPENSSL_INCLUDE_DIR="C:\OpenSSL\include"
;;
"macOS") ;;
"Linux") ;;
*)
echo "Unknown Operating System"
;;
esac
2 changes: 0 additions & 2 deletions ...hub/scripts/cargo-clippy-before-script.sh → .github/scripts/install-proto.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ os_name="$1"

case "$os_name" in
"Windows")
vcpkg install openssl:x64-windows-static-md
vcpkg integrate install
choco install protoc
export PROTOC='C:\ProgramData\chocolatey\lib\protoc\tools\bin\protoc.exe'
;;
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ jobs:
with:
version: "v0.8.1"

- shell: bash
run: .github/scripts/cargo-clippy-before-script.sh ${{ runner.os }}
# took the workaround from https://github.com/sfackler/rust-openssl/issues/2149
- name: Set Perl environment variables
if: runner.os == 'Windows'
run: |
echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
Comment on lines +47 to +49

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment linking to this issue sfackler/rust-openssl#2149? I was very confused about this line, and I'm assuming this helped you too 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure! 84af4f9 🫶


- shell: bash
run: |
source .github/scripts/install-all-deps.sh ${{ runner.os }}
source ci/rust-version.sh nightly
rustup component add clippy --toolchain "$rust_nightly"
scripts/cargo-clippy-nightly.sh
13 changes: 9 additions & 4 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ jobs:
run: |
git checkout ${{ inputs.commit }}

# took the workaround from https://github.com/sfackler/rust-openssl/issues/2149
- name: Set Perl environment variables
run: |
echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
Comment on lines +43 to +46

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, can you add a comment linking to this issue? sfackler/rust-openssl#2149

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put it in the same commit! 84af4f9


- name: Build
id: build
shell: bash
run: |
vcpkg install openssl:x64-windows-static-md
vcpkg integrate install
choco install protoc
export PROTOC="C:\ProgramData\chocolatey\lib\protoc\tools\bin\protoc.exe"
# install all deps
source .github/scripts/install-all-deps.sh ${{ runner.os }}

source /tmp/env.sh
echo "tag=$CI_TAG" >> $GITHUB_OUTPUT
eval "$(ci/channel-info.sh)"
Expand Down
13 changes: 3 additions & 10 deletions storage-bigtable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ http = { workspace = true }
hyper = { workspace = true }
hyper-proxy = { workspace = true }
log = { workspace = true }
# openssl is a dependency of the goauth and smpl_jwt crates, but explicitly
# declare it here as well to activate the "vendored" feature that builds OpenSSL
openssl = { workspace = true, features = ["vendored"] }
prost = { workspace = true }
prost-types = { workspace = true }
serde = { workspace = true }
Expand All @@ -36,16 +39,6 @@ tokio = { workspace = true }
tonic = { workspace = true, features = ["tls", "transport"] }
zstd = { workspace = true }

# openssl is a dependency of the goauth and smpl_jwt crates, but explicitly
# declare it here as well to activate the "vendored" feature that builds OpenSSL
# statically...
[target."cfg(not(windows))".dependencies]
openssl = { workspace = true, features = ["vendored"] }
# ...except on Windows to avoid having to deal with getting CI past a build-time
# Perl dependency
[target."cfg(windows)".dependencies]
openssl = { workspace = true, features = [] }

[lib]
crate-type = ["lib"]
name = "solana_storage_bigtable"
Expand Down
Loading