Skip to content

fix(windows): complete the MSVC C11 source composition - #1

Open
yangweijie wants to merge 2 commits into
swoole:masterfrom
yangweijie:fix/windows-nano-composition
Open

yangweijie wants to merge 2 commits into
swoole:masterfrom
yangweijie:fix/windows-nano-composition

Conversation

@yangweijie

Copy link
Copy Markdown

An MSVC /std:c11 build of the Composer manifest fails in three places:

  • ext/standard/crc32_x86.c is absent from the Windows sources, while Zend/zend_portability.h forces ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER under ZEND_WIN32, so hash_crc32.c calls crc32_x86_simd_update and the link fails with LNK2019.
  • php_reflection.c never registers ReflectionFiber under PHP_NANO, yet the method family that dereferences zend_ce_fiber sits outside the existing guard, so the link fails with LNK2019 as well.
  • ext/hash/xxhash/xxhash.h includes <stdalign.h> as soon as STDC_VERSION >= 201112L, and the MSVC toolset ships no such header (14.44 still does not), so hash_xxhash.c fails with fatal error C1083.

Add the missing translation unit, extend the PHP_NANO guard over the ReflectionFiber block, and supply win32/c11/stdalign.h on the Windows include path. The shim defines the standard C11 7.15 macros for C only; GCC/Clang and C++ builds keep their system header or keyword.

An MSVC /std:c11 build of the Composer manifest fails in three places:

- ext/standard/crc32_x86.c is absent from the Windows sources, while
  Zend/zend_portability.h forces ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER under
  ZEND_WIN32, so hash_crc32.c calls crc32_x86_simd_update and the link
  fails with LNK2019.
- php_reflection.c never registers ReflectionFiber under PHP_NANO, yet the
  method family that dereferences zend_ce_fiber sits outside the existing
  guard, so the link fails with LNK2019 as well.
- ext/hash/xxhash/xxhash.h includes <stdalign.h> as soon as
  __STDC_VERSION__ >= 201112L, and the MSVC toolset ships no such header
  (14.44 still does not), so hash_xxhash.c fails with fatal error C1083.

Add the missing translation unit, extend the PHP_NANO guard over the
ReflectionFiber block, and supply win32/c11/stdalign.h on the Windows
include path. The shim defines the standard C11 7.15 macros for C only;
GCC/Clang and C++ builds keep their system header or keyword.
The native-smoke matrix only ran on Ubuntu and macOS, so Windows
composition holes never failed CI. Teach the CMake harness to consume
platforms.<host> sources/include-dirs/defines plus remaining component
defines, add a windows-latest job, and fill the Windows ABI macros the
TypePHP MSVC driver already injects (ZEND_WIN32/PHP_WIN32, LEXBOR_STATIC,
HAVE_SLOW_HASH3).
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.

1 participant