Skip to content

Commit

Permalink
Remove libexecinfo on Alpine (#1838)
Browse files Browse the repository at this point in the history
* Remove libexecinfo on Alpine

Fix GH-1824.

The quick summary is Alpine 3.17 removed this library, and on older
versions it's apparently not great quality anyway.

* Update apk before deleting package

* Attempt to remove libexecinfo from CI

* Remove libexecinfo-dev too

* Be less aggressive about libexecinfo removal

* Maybe revert once we pump to 0.83.0

* Fix installer test

* Drop libexecinfo dep on .apk

* Hack around plesk issue

* Support Alpine 3.17 in package verification

* Remove PHP 7.4 on Plesk (removed upstream)
  • Loading branch information
morrisonlevi authored and bwoebi committed Jan 18, 2023
1 parent a8d28fc commit 6351c5c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 17 deletions.
8 changes: 7 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,13 @@ jobs:
- <<: *STEP_ATTACH_WORKSPACE
- run:
name: Build extension
command: build-dd-trace-php
command: |
# Backtraces on Alpine are apparently sketchy, and removed in Alpine 3.17:
# https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/36722
# Ensure libexecinfo is _not_ installed, so support isn't detected
# by config.m4
apk update && apk del libexecinfo libexecinfo-dev
build-dd-trace-php
- persist_to_workspace:
root: '.'
paths: ['./extensions']
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ $(PACKAGES_BUILD_DIR):
.rpm: $(PACKAGES_BUILD_DIR)
fpm -p $(PACKAGES_BUILD_DIR) -t rpm $(FPM_OPTS) $(FPM_FILES)
.apk: $(PACKAGES_BUILD_DIR)
fpm -p $(PACKAGES_BUILD_DIR) -t apk $(FPM_OPTS) --depends=bash --depends=curl --depends=libexecinfo $(FPM_FILES)
fpm -p $(PACKAGES_BUILD_DIR) -t apk $(FPM_OPTS) --depends=bash --depends=curl $(FPM_FILES)
.tar.gz: $(PACKAGES_BUILD_DIR)
mkdir -p /tmp/$(PACKAGES_BUILD_DIR)
fpm -p /tmp/$(PACKAGES_BUILD_DIR)/$(PACKAGE_NAME)-$(VERSION) -t dir $(FPM_OPTS) $(FPM_FILES)
Expand Down
3 changes: 0 additions & 3 deletions datadog-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ function install($options)

// Checking required libraries
check_library_prerequisite_or_exit('libcurl');
if (is_alpine()) {
check_library_prerequisite_or_exit('libexecinfo');
}

// Picking the right binaries to install the library
$selectedBinaries = require_binaries_or_exit($options);
Expand Down
1 change: 0 additions & 1 deletion dockerfiles/compile_extension/build-dd-trace-php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ apk add --no-cache \
coreutils \
g++ \
gcc \
libexecinfo-dev \
make \

make -j all CFLAGS="-std=gnu11 -O2 -g -Wall -Wextra -Werror" ECHO_ARG="-e"
Expand Down
12 changes: 11 additions & 1 deletion dockerfiles/verify_packages/alpine/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
if [ -z "$PHP_BIN" ]; then
PHP_BIN=$(command -v php8 || true)
fi
if [ -z "$PHP_BIN" ]; then
PHP_BIN=$(command -v php81 || true)
fi
if [ -z "$PHP_BIN" ]; then
PHP_BIN=$(command -v php7 || true)
fi
Expand All @@ -32,7 +35,6 @@ if [ "$INSTALL_TYPE" = "native_package" ]; then
apk add --no-cache $(pwd)/build/packages/*.apk --allow-untrusted
else
echo "Installing dd-trace-php using the new PHP installer"
apk add --no-cache libexecinfo
installable_bundle=$(find "$(pwd)/build/packages" -maxdepth 1 -name 'dd-library-php-*-x86_64-linux-musl.tar.gz')
$PHP_BIN datadog-setup.php --file "$installable_bundle" --php-bin all
fi
Expand All @@ -46,6 +48,9 @@ cp $(pwd)/dockerfiles/verify_packages/nginx.conf /etc/nginx/nginx.conf
if [ -z "$PHP_FPM_BIN" ]; then
PHP_FPM_BIN=$(command -v php-fpm || true)
fi
if [ -z "$PHP_FPM_BIN" ]; then
PHP_FPM_BIN=$(command -v php-fpm81 || true)
fi
if [ -z "$PHP_FPM_BIN" ]; then
PHP_FPM_BIN=$(command -v php-fpm8 || true)
fi
Expand All @@ -55,10 +60,15 @@ fi
if [ -z "$PHP_FPM_BIN" ]; then
PHP_FPM_BIN=$(command -v php-fpm5 || true)
fi

WWW_CONF=/etc/php/php-fpm.d/www.conf
if [ ! -f "${WWW_CONF}" ]; then
WWW_CONF=/usr/local/etc/php-fpm.d/www.conf
fi
if [ ! -f "${WWW_CONF}" ]; then
# Alpine 3.17
WWW_CONF=/etc/php81/php-fpm.d/www.conf
fi
if [ ! -f "${WWW_CONF}" ]; then
WWW_CONF=/etc/php8/php-fpm.d/www.conf
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

. "$(dirname ${0})/utils.sh"

apk add php7 curl libexecinfo
apk add php7 curl

# Initially no ddtrace
assert_no_ddtrace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,19 @@ set -e
assert_no_ddtrace

# Install using the php installer
new_version="0.68.0"
new_version="1.0.0-nightly"
generate_installers "${new_version}"

set +e
output=$(php ./build/packages/datadog-setup.php --php-bin php)
exit_status=$?
set -e

# libexecinfo used to be required, but no longer, so this should pass now.
if [ "${exit_status}" = "1" ]; then
echo "---\nOk: expected exit status 1\n---\n${exit_status}\n---\n"
echo "---\nOk: expected exit status 0\n---\n${exit_status}\n---\n"
else
echo "---\nError: Unexpected exit status. Should be 1\n---\n${exit_status}\n---\n"
echo "---\nError: Unexpected exit status. Should be 0\n---\n${exit_status}\n---\n"
exit 1
fi

if [ -z "${output##*libexecinfo*}" ]; then
echo "Ok: Output contains text 'libexecinfo'"
else
echo "---\nError: Output does not contain text 'libexecinfo'\n---\n${output}\n---\n"
exit 1
fi

0 comments on commit 6351c5c

Please sign in to comment.