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

Avoid duplicate build rules #17545

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

Avoid duplicate build rules #17545

wants to merge 1 commit into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Jan 22, 2025

On Windows, the cli and phpdbg SAPIs have variants (cli-win32 and phpdbgs, respectively) which are build by default. However, the variants share some files, what leads to duplicate build rules in the generated Makefile. NMake throws warning U4004[1], but proceeds happily, ignoring the second build rule. That means that different flags for duplicate rules are ignored, hinting at a potential problem.

We solve this by introducing an additional (optional) argument to SAPI() and ADD_SOURCES() which can be used to avoid such duplicate build rules. It's left to the SAPI maintainers to make sure that appropriate rules are created. We fix this for phpdbgs right away, which currently couldn't be build without phpdbg due to the missing define; we remove the unused PHP_PHPDBG_EXPORTS flag altogether.

[1] https://learn.microsoft.com/en-us/cpp/error-messages/tool-errors/nmake-warning-u4004


Note that I tried to solve this without even touching confutils.js, but failed. While this solution isn't particularly great, it solves the duplicate rules problem without any BC implications for users.

Also note that PHPDBG_API is not properly handled on Windows; due to missing __declspec(dllimport) there is a minimal performance impact, and variables couldn't be accessed at all (but there are none anyway). I'll try to follow up with a "fix".

On Windows, the cli and phpdbg SAPIs have variants (cli-win32 and
phpdbgs, respectively) which are build by default.  However, the
variants share some files, what leads to duplicate build rules in the
generated Makefile.  NMake throws warning U4004[1], but proceeds
happily, ignoring the second build rule.  That means that different
flags for duplicate rules are ignored, hinting at a potential problem.

We solve this by introducing an additional (optional) argument to
`SAPI()` and `ADD_SOURCES()` which can be used to avoid such duplicate
build rules.  It's left to the SAPI maintainers to make sure that
appropriate rules are created.  We fix this for phpdbgs right away,
which currently couldn't be build without phpdbg due to the missing
define; we remove the unused `PHP_PHPDBG_EXPORTS` flag altogether.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/tool-errors/nmake-warning-u4004>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant