Uh oh!
There was an error while loading. Please reload this page.
ext/uri: Fix static build on Windows by defining LEXBOR_STATIC - #22165
Conversation
TimWolla
commented
May 28, 2026
I know nothing about Windows. Should / Must this be fixed in ext/lexbor instead? |
dad77e8 to
da128c4Compareluthermonson
commented
May 28, 2026
I think your instinct is correct, i"m running a test right now with a change to lexbor and will report back |
luthermonson
commented
May 28, 2026
@TimWolla thanks for the insight , the change now in lexbor had the same results as doing the define in config.w32 and i was able to get clean static builds on all platforms. |
Uh oh!
There was an error while loading. Please reload this page.
da128c4 to
5521f86CompareTimWolla
commented
May 28, 2026
ext/lexbor is always statically built into PHP and is intended to be reusable across different extensions (e.g. ext/uri, ext/dom). Should the define actually be limited to CFLAGS_URI then? |
shivammathur
commented
May 28, 2026
@TimWolla Yes, that is correct, my concern is in case |
so go back to the ext/dom/config.w32 fix with adding /D LEXBOR_STATIC? arent we still worred about that being overwritten? |
Adding ADD_FLAG("CFLAGS_URI","/D LEXBOR_STATIC"); |
ext/uri is always built statically (false /* never shared */ in EXTENSION()) and includes the bundled lexbor headers via /I ext/lexbor. On Windows, lexbor's LXB_API macro defaults to __declspec(dllimport), which produces LNK2019 unresolved external symbol errors for every lxb_* function referenced from ext/uri when PHP itself is linked statically without a runtime DLL. Adding /D LEXBOR_STATIC to CFLAGS_URI in ext/uri/config.w32 makes LXB_API expand to nothing for ext/uri's compilation units. The scope matches URI_STATIC_BUILD on the same line: per-consumer, because other lexbor consumers (e.g. ext/dom, which can build as shared) must decide for themselves whether to disable the dllimport decoration.
5521f86 to
2fce9daCompareluthermonson
commented
May 29, 2026
Done, I'm running my builds to confirm this fixed it but I trust your judgment. Thank you for the help to get through this |
TimWolla
commented
May 29, 2026
Okay, I'm seeing it's already done for dom: Line 29 in 9596ab1 |
Uh oh!
There was an error while loading. Please reload this page.
* PHP-8.5: Define LEXBOR_STATIC in CFLAGS_URI for static ext/uri on Windows (#22165)
luthermonson
commented
May 29, 2026
Confirmed by the way, my static builds all worked with the change in uri |
Summary
ext/uriis always built statically and pulls in the bundled lexbor headers via/I ext/lexbor. On Windows, lexbor'sLXB_APImacro defaults to__declspec(dllimport)whenLEXBOR_STATICisn't defined. As a result, when PHP itself is linked statically (no DLL) on Windows, everylxb_*symbol referenced fromext/urifails to resolve: