Skip to content

Build PHP binaries --with-suggested-libs - #4502

Draft
fredrikekelund wants to merge 1 commit into
trunkfrom
f26d/php-builds-with-suggested-libs
Draft

fredrikekelund wants to merge 1 commit into
trunkfrom
f26d/php-builds-with-suggested-libs

Conversation

@fredrikekelund

Copy link
Copy Markdown
Contributor

Related issues

  • N/A

How AI was used in this PR

N/A

Proposed Changes

static-php-cli omits certain external libraries by default, like libjpeg. These are listed as "suggestions" rather than "dependencies". We previously ran into trouble with the PHP gd module missing some external libraries and fixed it in #3927.

However, it turns out that there's a better approach to including these external libraries than the one we took in the previous PR. Instead of explicitly listing which libraries to include, we can use --with-suggested-libs to have static-php-cli automatically include the suggested libraries. This PR makes that change.

Testing Instructions

I will manually trigger a PHP build and verify that gd still has all the libraries we need.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@fredrikekelund
fredrikekelund requested review from a team and bcotrim August 11, 2026 08:40
@fredrikekelund fredrikekelund self-assigned this Aug 11, 2026
@fredrikekelund
fredrikekelund requested a review from a team as a code owner August 11, 2026 08:40

@bcotrim bcotrim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

It would be interesting to compare the binaries size once we run the builds, assuming suggested libs can add libs we didn't have initially

"$static_extensions"
# Give gd JPEG/WebP image support and FreeType (TrueType text).
--with-libs=freetype,libjpeg,libwebp
--with-suggested-libs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the trail correctly, it looks like this change fails in the Linux GHA environments.

Image

Given the PR is approved, I'm going to request changes just to avoid it's accidentally merged.

@mokagio

mokagio commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

@bcotrim

It would be interesting to compare the binaries size once we run the builds, assuming suggested libs can add libs we didn't have initially

I haven't verified it myself, but when I asked Claude to check on the GHA status for the changes here, it read your comment and reported:

Size cost, measured against the same-version baseline (run 30920247147): macos-aarch64 26.0 → 29.5 MB (+13.4%), macos-x86_64 26.5 → 30.5 MB (+15.0%).

@fredrikekelund

Copy link
Copy Markdown
Contributor Author

The blocker here, as diagnosed by GitHub Copilot on a verbose SPC build, is a compilation error in OpenLDAP's TLS code (tls_o.c).

The problem is a C89 incompatibility. OpenLDAP's code has a label (case statement) followed immediately by variable declarations. In C89, declarations must come before any statements or labels. This is valid in C99, but the build is using C89-style compilation.

This specific issue was raised in crazywhalecc/static-php-cli#1221, and the author recommended trying the v3 branch. Until there's a stable release, I'd like to avoid that level of churn. Still, seeing as this failure indicates that the PHP ldap extension might not be functioning properly in our existing PHP builds (at least not on Linux), I'll leave this PR open. I'll convert it to a draft to clarify that I am not waiting for this to be merged.

@mokagio, if you feel inspired to work on this, feel free to do so! No pressure, but I thought I'd call it out 😄

@fredrikekelund
fredrikekelund marked this pull request as draft August 18, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants