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

Update MSVC compiler version detection #14810

Merged
merged 1 commit into from
Jul 5, 2024
Merged

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Jul 4, 2024

As of Visual Studio 2015, the major version of the compiler (cl.exe) is 19, and the minor version increases by steps of 10. However, the latest Visual Studio 2022 release has the version 19.40, so that Visual Studio version is not properly detected. This is not a big deal regarding the reported compiler version (php -v etc.), but the filenames of the builds would no longer match the expectations (instead of vs17 there is now 19.40.33811 or another build number). This implies that the files would have to be renamed manually to be properly handled by windows.php.net (or that code would have to be adapted).

Therefore we update the version detection to detect all versions < 1950 as Visual Studio 2022, assuming that "For major releases, the minor version increases by 10."[1] still holds in the future.

[1] https://learn.microsoft.com/en-us/cpp/overview/compiler-versions?view=msvc-170#visual-studio-2017-and-later


Note that I have targeted PHP-8.3 since there may be custom builds which use Visual Studio 2022, so they get a "proper" compiler detection, although that might break some build scripts. Thus, it might be best to only apply this patch to master, because in my opinion PHP 8.4 should be built with Visual Studio 2022, although Visual Studio 2019 still has extended support until 2029-04-10.

@cmb69
Copy link
Member Author

cmb69 commented Jul 4, 2024

The failed LINUX_X64_DEBUG_ZTS_ASAN is unlikely to be related to this PR.

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, not sure about 8.3 but probably is unlikely to do harm.

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for 8.3 it might make sense to ask RMs @bukka any opinions?

@bukka
Copy link
Member

bukka commented Jul 4, 2024

That would be more a feature IMO as we don't officially support such builds for 8.3 and we no longer allow any features to stable version. So should be only for master.

As of Visual Studio 2015, the major version of the compiler (`cl.exe`)
is 19, and the minor version increases by steps of 10.  However, the
latest Visual Studio 2022 release has the version `19.40`, so that
Visual Studio version is not properly detected.  This is not a big deal
regarding the reported compiler version (`php -v` etc.), but the
filenames of the builds would no longer match the expectations (instead
of `vs17` there is now `19.40.33811` or another build number).  This
implies that the files would have to be renamed manually to be properly
handled by windows.php.net (or that code would have to be adapted).

Therefore we update the version detection to detect all versions < 1950
as Visual Studio 2022, assuming that "For major releases, the minor
version increases by 10."[1] still holds in the future.

[1] <https://learn.microsoft.com/en-us/cpp/overview/compiler-versions?view=msvc-170#visual-studio-2017-and-later>
@cmb69
Copy link
Member Author

cmb69 commented Jul 4, 2024

Thanks @bukka. I've rebased onto master, which apparently triggered a code review request from a couple of people – sorry for that.

@TimWolla TimWolla removed the request for review from kocsismate July 4, 2024 14:24
@petk
Copy link
Member

petk commented Jul 4, 2024

Welcome back @cmb69 at pull requests 👍 and thanks for all your work on Windows builds. :D

@medabkari
Copy link

Welcome back @cmb69 !

@cmb69 cmb69 merged commit ffab987 into php:master Jul 5, 2024
12 checks passed
@cmb69 cmb69 deleted the cmb/update-msc-ver branch July 5, 2024 09:26
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.

6 participants