Skip to content

Commit ea718d4

Browse files
committed
CI: fix Bref PHP detection (no which) and generic-linux libclang-15 path
Reproduced both remaining release failures locally against the actual Bref image and an offline build: - Bref (all 4): ext-php-rs finds PHP by shelling out to `which`, which the minimal Amazon Linux 2023 image does not ship — so detection failed even though /opt/bin/php is on PATH. Export PHP=/opt/bin/php and PHP_CONFIG=/opt/bin/php-config to bypass the `which` lookup (verified: the build then proceeds past PHP detection). - Linux x86_64: the hardcoded LIBCLANG_PATH=/usr/lib/llvm-15/lib did not resolve to libclang-15, so bindgen silently fell back to the runner's libclang-14 and re-hit the emmintrin SSE2 bug. Locate the real libclang-15 shared object by version and point LIBCLANG_PATH at its directory, failing loudly if it is missing. Mirror the Bref PHP env in docs/install.md's from-source snippet. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R3vgA3Q6PR9VQn8X5pLcMR
1 parent 98041ba commit ea718d4

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ jobs:
4646
# whose emmintrin.h trips a bindgen SSE2 intrinsics bug when parsing the
4747
# PHP headers on x86_64. clang 15+ fixes it; aarch64 never hits it.
4848
- run: sudo apt-get update && sudo apt-get install -y clang-15 libclang-15-dev
49-
- run: cargo build --release
50-
env:
51-
LIBCLANG_PATH: /usr/lib/llvm-15/lib
49+
- name: Build
50+
run: |
51+
# Point bindgen at libclang-15 specifically (the runner also ships
52+
# libclang-14; a wrong/empty LIBCLANG_PATH silently falls back to it
53+
# and re-triggers the emmintrin bug). Locate the real .so by version.
54+
dir="$(dirname "$(find /usr/lib /usr/lib64 -name 'libclang-15.so*' -print -quit 2>/dev/null)")"
55+
[ -n "$dir" ] && [ "$dir" != "." ] || { echo "::error::libclang-15 not found"; exit 1; }
56+
echo "Using LIBCLANG_PATH=$dir"
57+
LIBCLANG_PATH="$dir" cargo build --release
5258
- name: Stage artifact
5359
run: |
5460
mkdir -p dist
@@ -99,6 +105,10 @@ jobs:
99105
export PATH="$HOME/.cargo/bin:/opt/bin:$PATH"
100106
export CARGO_TARGET_DIR=/tmp/target
101107
export LIBCLANG_PATH=/usr/lib64
108+
# ext-php-rs locates PHP by shelling out to `which`, which the
109+
# minimal AL2023 image does not ship; point it at Bref'\''s PHP
110+
# directly so detection does not depend on `which`.
111+
export PHP=/opt/bin/php PHP_CONFIG=/opt/bin/php-config
102112
cd /src
103113
cargo build --release # rust-toolchain.toml pins the version
104114
mkdir -p dist

docs/install.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ docker run --rm --security-opt seccomp=unconfined \
104104
curl --proto "=https" -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
105105
export PATH="$HOME/.cargo/bin:/opt/bin:$PATH" CARGO_TARGET_DIR=/tmp/target
106106
export LIBCLANG_PATH=/usr/lib64
107+
# The minimal image has no `which`; point ext-php-rs at PHP directly.
108+
export PHP=/opt/bin/php PHP_CONFIG=/opt/bin/php-config
107109
cd /src && cargo build --release
108110
cp /tmp/target/release/libphp_quickjs.so /src/quickjs.so
109111
'

0 commit comments

Comments
 (0)