enhance: use specific rust version to compile opendal (#29106)

/kind improvement

---------

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
pull/28949/head
Jiquan Long 2023-12-13 16:34:38 +08:00 committed by GitHub
parent 3acb672497
commit ed79505d31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 4 deletions

View File

@ -67,14 +67,23 @@ git clone --depth=1 --branch v0.43.0-rc.2 https://github.com/apache/incubator-op
cd opendal
if command -v cargo >/dev/null 2>&1; then
echo "cargo exists"
rustup toolchain uninstall stable
rustup toolchain install stable
unameOut="$(uname -s)"
case "${unameOut}" in
Darwin*)
echo "running on mac os, reinstall rust 1.73"
# github will install rust 1.74 by default.
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
rustup install 1.73
rustup default 1.73;;
*)
echo "not running on mac os, no need to reinstall rust";;
esac
else
bash -c "curl https://sh.rustup.rs -sSf | sh -s -- -y" || { echo 'rustup install failed'; exit 1;}
bash -c "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=1.73 -y" || { echo 'rustup install failed'; exit 1;}
source $HOME/.cargo/env
fi
pushd bindings/c
cargo build --release --verbose || { echo 'opendal_c build failed'; exit 1; }
cargo +1.73 build --release --verbose || { echo 'opendal_c build failed'; exit 1; }
popd
mkdir -p ${ROOT_DIR}/internal/core/output/lib
mkdir -p ${ROOT_DIR}/internal/core/output/include