Skip to content

Commit

Permalink
Fix installing rust on Alpine 3.10- (#1045)
Browse files Browse the repository at this point in the history
* Fix detecting if rust is already installed

* Improve stability of rust uninstallation

* Fix installing rust on Alpine 3.10-

* Test installing datadog_trace

Test: ddtrace
  • Loading branch information
mlocati authored Jan 13, 2025
1 parent 3529772 commit 5a87b11
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions install-php-extensions
Original file line number Diff line number Diff line change
Expand Up @@ -2617,15 +2617,31 @@ installCargo() {
if command -v cargo >/dev/null; then
return
fi
printf '# Installing cargo\n'
case "$DISTRO" in
alpine)
# see https://github.com/hyperledger/indy-vdr/issues/69#issuecomment-998104850
export RUSTFLAGS='-C target-feature=-crt-static'
;;
esac
curl https://sh.rustup.rs -sSf | sh -s -- -y -q
installCargo_cargoversion=
if ! test -f "$HOME/.cargo/env"; then
printf '# Installing cargo\n'
case "$DISTRO" in
alpine)
# see https://github.com/hyperledger/indy-vdr/issues/69#issuecomment-998104850
export RUSTFLAGS='-C target-feature=-crt-static'
;;
esac
curl https://sh.rustup.rs -sSf | sh -s -- -y -q
case "$DISTRO" in
alpine)
if test $DISTRO_MAJMIN_VERSION -le 310; then
# With version 1.84.0 we have this error:
# Error relocating /root/.rustup/toolchains/stable-x86_64-unknown-linux-musl/bin/cargo: posix_spawn_file_actions_addchdir_np: symbol not found
# See https://github.com/rust-lang/rust/pull/131851#issue-2595663507
installCargo_cargoversion=1.83.0
fi
;;
esac
fi
. "$HOME/.cargo/env"
if test -n "$installCargo_cargoversion"; then
rustup default -- "$installCargo_cargoversion"
fi
if test -z "${IPE_UNINSTALL_CARGO:-}"; then
IPE_UNINSTALL_CARGO=y
fi
Expand Down Expand Up @@ -4961,8 +4977,12 @@ fixLetsEncrypt() {
# Cleanup everything at the end of the execution
cleanup() {
if test "${IPE_UNINSTALL_CARGO:-}" = y; then
. "$HOME/.cargo/env"
rustup self uninstall -y
if test -f "$HOME/.cargo/env"; then
. "$HOME/.cargo/env"
fi
if command -v rustup >/dev/null; then
rustup self uninstall -y
fi
fi
if test -n "$UNNEEDED_PACKAGE_LINKS"; then
printf '### REMOVING UNNEEDED PACKAGE LINKS ###\n'
Expand Down

0 comments on commit 5a87b11

Please sign in to comment.