Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gwharton
Copy link

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.

PHP_ARG_ENABLE(protobuf, whether to enable Protobuf extension, [ --enable-protobuf Enable Protobuf extension])
if test "$PHP_PROTOBUF" != "no"; then
PHP_NEW_EXTENSION(
protobuf,
arena.c array.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c third_party/utf8_range/utf8_range.c,
$ext_shared, , -std=gnu99 -I@ext_srcdir@/third_party/utf8_range)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/utf8_range)
fi

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 gwharton requested a review from a team as a code owner August 21, 2024 19:59
@gwharton gwharton requested review from bshaffer and removed request for a team August 21, 2024 19:59
Copy link

google-cla bot commented Aug 21, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gwharton
Copy link
Author

Fixes #17852

@acozzette acozzette added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 29, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 29, 2024
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