From 525e16a8757802cb0dfcef064d88144a38d2b595 Mon Sep 17 00:00:00 2001 From: Graham Wharton <30697781+gwharton@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:14:32 -0800 Subject: [PATCH] Updated Build Configuration for PHP Extension to fix issue building on Windows (#17903) 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 . 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 Closes #17903 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/17903 from gwharton:main ebfc0e3b527570cd5d97aba23301f253a5e98feb PiperOrigin-RevId: 700529908 --- php/ext/google/protobuf/config.w32 | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/php/ext/google/protobuf/config.w32 b/php/ext/google/protobuf/config.w32 index 825197c409bd..0223f9fd1e7c 100644 --- a/php/ext/google/protobuf/config.w32 +++ b/php/ext/google/protobuf/config.w32 @@ -1,14 +1,7 @@ ARG_ENABLE("protobuf", "whether to enable Protobuf extension", "no"); if (PHP_PROTOBUF != "no") { - - var PHP_PROTOBUF_SRC_ARRAY = glob(configure_module_dirname + "/third_party/utf8_range/*.c"); - var PHP_PROTOBUF_SOURCES=" "; - for (var i=0; i