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

fix(ci): fix static link for openssl (#18569) #18671

Merged
merged 2 commits into from
Sep 24, 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
6 changes: 3 additions & 3 deletions ci/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if [[ "$profile" == "ci-dev" ]]; then
RISINGWAVE_FEATURE_FLAGS=(--features rw-dynamic-link --no-default-features)
else
RISINGWAVE_FEATURE_FLAGS=(--features rw-static-link)
export OPENSSL_STATIC=1
configure_static_openssl
fi

cargo build \
Expand All @@ -62,8 +62,8 @@ cargo build \

artifacts=(risingwave sqlsmith compaction-test risingwave_regress_test risingwave_e2e_extended_mode_test risedev-dev delete-range-test)

echo "--- Show link info"
ldd target/"$profile"/risingwave
echo "--- Check link info"
check_link_info "$profile"

echo "--- Upload artifacts"
echo -n "${artifacts[*]}" | parallel -d ' ' "mv target/$profile/{} ./{}-$profile && compress-and-upload-artifact ./{}-$profile"
Expand Down
9 changes: 6 additions & 3 deletions ci/scripts/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ done

source ci/scripts/common.sh

echo "--- Set openssl static link env vars"
configure_static_openssl

echo "--- Run trailing spaces check"
scripts/check/check-trailing-spaces.sh

Expand All @@ -28,11 +31,11 @@ sccache --show-stats
sccache --zero-stats

echo "--- Run clippy check (release)"
OPENSSL_STATIC=1 cargo clippy --release --all-targets --features "rw-static-link" --locked -- -D warnings
cargo clippy --release --all-targets --features "rw-static-link" --locked -- -D warnings

echo "--- Run cargo check on building the release binary (release)"
OPENSSL_STATIC=1 cargo check -p risingwave_cmd_all --features "rw-static-link" --profile release
OPENSSL_STATIC=1 cargo check -p risingwave_cmd --bin risectl --features "rw-static-link" --profile release
cargo check -p risingwave_cmd_all --features "rw-static-link" --profile release
cargo check -p risingwave_cmd --bin risectl --features "rw-static-link" --profile release

echo "--- Show sccache stats"
sccache --show-stats
Expand Down
19 changes: 19 additions & 0 deletions ci/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,22 @@ get_latest_cassandra_download_url() {
local download_url="https://downloads.apache.org/cassandra/${latest_version}/apache-cassandra-${latest_version}-bin.tar.gz"
echo "$download_url"
}

configure_static_openssl() {
export OPENSSL_STATIC=1
export OPENSSL_LIB_DIR="$(dpkg -L libssl-dev | grep libssl.a | xargs dirname)"
export OPENSSL_INCLUDE_DIR="$(dpkg -L libssl-dev | grep openssl/ssl.h | xargs dirname)"
echo "OPENSSL_STATIC: $OPENSSL_STATIC"
echo "OPENSSL_LIB_DIR: $OPENSSL_LIB_DIR"
echo "OPENSSL_INCLUDE_DIR: $OPENSSL_INCLUDE_DIR"
}

check_link_info() {
ldd_output=$(ldd target/"$1"/risingwave)
echo "$ldd_output"
# enforce that libssl is not present if we are building with static openssl
if [[ "$profile" == "ci-release" ]] && [[ "$ldd_output" == *"libssl"* ]]; then
echo "libssl should not be dynamically linked"
exit 1
fi
}
8 changes: 6 additions & 2 deletions ci/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ if [ "${ARCH}" == "aarch64" ]; then
# see https://github.com/tikv/jemallocator/blob/802969384ae0c581255f3375ee2ba774c8d2a754/jemalloc-sys/build.rs#L218
export JEMALLOC_SYS_WITH_LG_PAGE=16
fi
OPENSSL_STATIC=1 cargo build -p risingwave_cmd_all --features "rw-static-link" --features external-udf --features wasm-udf --features js-udf --profile release
OPENSSL_STATIC=1 cargo build -p risingwave_cmd --bin risectl --features "rw-static-link" --profile release

configure_static_openssl
cargo build -p risingwave_cmd_all --features "rw-static-link" --features external-udf --features wasm-udf --features js-udf --profile release
cargo build -p risingwave_cmd --bin risectl --features "rw-static-link" --profile release
check_link_info release

cd target/release && chmod +x risingwave risectl

echo "--- Upload nightly binary to s3"
Expand Down
Loading