protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Updated Build Configuration for PHP Extension to fix issue building on Windows

Open gwharton opened this issue 6 months ago • 3 comments

Protobuf PHP Extension

When building the module under Linux, the config.m4 file compiles the module files "arena.c array.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c" and in addition it compiles the third party file "third_party/utf8_range/utf8_range.c"

When building under Windows, a separate config.w32 file is used which compiles the same "arena.c array.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c" module files, but in addition, it compiles *.c from the third_party/utf8_range subfolder. Some of these files are not compatible with windows due to including <sys/time.h>. Only the utf8_range.c file is required, as shown under the config.m4 linux build configuration.

This PR modifies the build script config.w32 so that builds under windows only compile the same files that is compiled under linux. It removes the wildcard compile of the entire third party include, and thus resolves the build error under Windows.

Here is the linux build config.m4 file for reference. https://github.com/protocolbuffers/protobuf/blob/72707c38f3580d5ce76eda1d736ddad468219b57/php/ext/google/protobuf/config.m4#L1-L11

Verified working under :

Microsoft Windows 11 Pro 24H2 x64 Micrsoft Visual Studio Community 2022 (17.0 - 14.41.34120) x64 Build Environment Builds against PHP 8.3.10 from source in full PHP recompile

gwharton avatar Aug 21 '24 19:08 gwharton