Repository navigation
Conversation
…ssues with php-ext-rs scripts)
There was a problem hiding this comment.
🟡 Changes recommended
The Rust check accepts compilers below pqcrypto’s required rustc 1.85, allowing false success while Cargo builds remain impossible, and the macOS linker-default documentation is outdated.
2 open issues
What changed in this PR
Adds pqcrypto shared-extension support using host Rust tools and disables macOS dead stripping to retain symbols needed by shared extensions, addressing #1329.
Changes:
- Adds pqcrypto packaging and a reusable Cargo build executor.
- Replaces managed Rust downloads with optional doctor checks and installation.
- Updates bilingual documentation and macOS linker defaults.
| File | Description |
|---|---|
src/StaticPHP/Runtime/Executor/UnixCargoExecutor.php |
Adds Cargo release builds. |
src/StaticPHP/Doctor/Item/RustCheck.php |
Checks and installs Rust prerequisites. |
src/StaticPHP/Command/DoctorCommand.php |
Adds --with-rust. |
src/Package/Extension/pqcrypto.php |
Validates and builds pqcrypto. |
src/Package/Artifact/rust.php |
Removes managed Rust downloads. |
docs/zh/guide/cli-reference.md |
Documents the Rust option in Chinese. |
docs/zh/develop/system-build-tools.md |
Documents Cargo builds in Chinese. |
docs/zh/develop/package-model.md |
Replaces the Rust-specific example. |
docs/zh/develop/doctor-module.md |
Documents optional Rust checks. |
docs/en/guide/cli-reference.md |
Documents the Rust option in English. |
docs/en/develop/system-build-tools.md |
Documents Cargo builds in English. |
docs/en/develop/package-model.md |
Replaces the Rust-specific example. |
docs/en/develop/doctor-module.md |
Documents optional Rust checks. |
config/pkg/target/rust.yml |
Removes the managed Rust target. |
config/pkg/ext/ext-pqcrypto.yml |
Registers the shared-only extension. |
config/env.ini |
Disables default macOS dead stripping. |
Review effort: Balanced (adaptive)
| return $missing === [] | ||
| ? CheckResult::ok() | ||
| : CheckResult::fail('Missing Rust tools: ' . implode(', ', $missing), 'install-rust'); |
There was a problem hiding this comment.
Added a rustc >= 1.85.0 check with manual upgrade guidance for outdated or unrecognized versions; installRust() now returns false when the toolchain remains unsupported. Commit: 4f6edd44.
| SPC_DEFAULT_CFLAGS="--target=${MAC_ARCH}-apple-darwin -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffunction-sections -fdata-sections" | ||
| SPC_DEFAULT_CXXFLAGS="${SPC_DEFAULT_CFLAGS}" | ||
| SPC_DEFAULT_LDFLAGS="-Wl,-dead_strip" | ||
| SPC_DEFAULT_LDFLAGS="" |
There was a problem hiding this comment.
Updated both performance pages to describe the macOS default and why symbols referenced by dynamically loaded shared extensions must be retained. Commit: 4f6edd44.
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
Thanks for this! FYI, ext-php-rs can link statically into php-src to mainly avoid shared-only extensions (doc). Didn't test but running something like: EXT_PHP_RS_STATIC_EXT=1 cargo rustc --lib --locked --release --crate-type staticlib
cargo php static-glue --lib-name pqcryptoand then copy It should work on static musl builds, and it could solve the symbols resolve problem at link time. The only downside is it needs a first PHP build (cli+ |
|
pqcrypto requires ZTS? It built fine on NTS for me in testing, but I've not really used it. Thank you for the hint about static linkage, I'll work on that. |
nop, my bad, it supports nts+zts+debug 8.1 to 8.6 |
|
StaticPHP Test Bot Detected: Extensions: |


What does this PR do?
closes #1329
prepares static-php/packages#32
Checklist before merging
*.phpor*.yml, run them locally to ensure your changes are valid:composer cs-fixcomposer analysecomposer testbin/spc dev:lint-config