Skip to content

[v3] - fix(windows): define LEXBOR_STATIC for PHP 8.5+ static builds#1173

Closed
luthermonson wants to merge 1 commit into
crazywhalecc:v3from
luthermonson:pr/win-php85-lexbor-static
Closed

[v3] - fix(windows): define LEXBOR_STATIC for PHP 8.5+ static builds#1173
luthermonson wants to merge 1 commit into
crazywhalecc:v3from
luthermonson:pr/win-php85-lexbor-static

Conversation

@luthermonson
Copy link
Copy Markdown
Contributor

The ext/uri extension introduced in PHP 8.5 vendors lexbor headers. On Windows, lexbor's LXB_API macro defaults to _declspec(dllimport), which breaks static linking with unresolved external symbols for all lxb* functions.

Adding a BeforeStage patch that injects /D LEXBOR_STATIC into CFLAGS_URI makes LXB_API expand to nothing, allowing the uri extension to link into the static PHP build.

Only applies to PHP >= 8.5.0 where ext/uri exists.

The ext/uri extension introduced in PHP 8.5 vendors lexbor headers. On
Windows, lexbor's LXB_API macro defaults to __declspec(dllimport), which
breaks static linking with unresolved external symbols for all lxb_*
functions.

Adding a BeforeStage patch that injects /D LEXBOR_STATIC into CFLAGS_URI
makes LXB_API expand to nothing, allowing the uri extension to link
into the static PHP build.

Only applies to PHP >= 8.5.0 where ext/uri exists.
@henderkes
Copy link
Copy Markdown
Collaborator

Isn't this better passed as a -D flag directly on configure? And certainly, this should be fixed in php-src, not here.

@luthermonson
Copy link
Copy Markdown
Contributor Author

i was trying to stay in windows and not step on too many toes, i can refactor

@henderkes
Copy link
Copy Markdown
Collaborator

php-src has different configure methods for windows (configure.js) and unix (makefile based).

@luthermonson
Copy link
Copy Markdown
Contributor Author

im really not familiar with upstream php-src yet just from what i'm exposed through spc. if i make these changes upstream can we get them in here pretty quick as it's a build change or will it take a while to sort through in a real release of 8.x?

@luthermonson
Copy link
Copy Markdown
Contributor Author

luthermonson commented May 28, 2026

welp claude just walked me through it. thanks for the advice. i swear i'll be good at this one day. i think we can close #1173 and #1176 and i'll get php-src PRs up and ill link them back here before i close

@luthermonson
Copy link
Copy Markdown
Contributor Author

php/php-src#22165

@henderkes
Copy link
Copy Markdown
Collaborator

im really not familiar with upstream php-src yet just from what i'm exposed through spc. if i make these changes upstream can we get them in here pretty quick as it's a build change or will it take a while to sort through in a real release of 8.x?

It just happens automatically through the next release of 8.5.x (or whatever version you created the PR against, you should always target the oldest supported version the change is relevant to, usually 8.4 now, 8.2 for security fixes).

welp claude just walked me through it. thanks for the advice. i swear i'll be good at this one day. i think we can close #1173 and #1176 and i'll get php-src PRs up and ill link them back here before i close

If you're genuinely looking to become good at this, I would recommend leaving llms out of the process for now, because while they'll get things done, it's often times not in the fashion it should be done and the learning effect is minimal.

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.

2 participants