ext/uri: Fix static build on Windows by defining LEXBOR_STATIC#22165
ext/uri: Fix static build on Windows by defining LEXBOR_STATIC#22165luthermonson wants to merge 1 commit into
Conversation
|
I know nothing about Windows. Should / Must this be fixed in ext/lexbor instead? |
dad77e8 to
da128c4
Compare
|
I think your instinct is correct, i"m running a test right now with a change to lexbor and will report back |
|
@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. |
PHP bundles lexbor as a static-only extension (ext/lexbor/config.w32
declares EXTENSION("lexbor", ..., false /* never shared */)). On
Windows, ext/lexbor/lexbor/core/def.h defaults LXB_API to
__declspec(dllimport) when LEXBOR_STATIC is not defined, which causes
LNK2019 unresolved external symbol errors for every lxb_* function
referenced from consumers (ext/uri today, potentially others later)
when PHP itself is linked statically without a runtime DLL.
Add AC_DEFINE("LEXBOR_STATIC", 1, ...) in ext/lexbor/config.w32 so
the symbol is placed in main/config.w.h and seen by every PHP source
file that includes php.h before lexbor headers. This covers ext/uri
and any future consumer with one definition, in the right place for
configuration intent.
This change lives entirely in PHP-owned configuration (no modification
to the vendored ext/lexbor/lexbor/ tree), so it survives lexbor library
upgrades without re-application.
da128c4 to
5521f86
Compare
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? |
|
@TimWolla Yes, that is correct, my concern is in case |
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: