Skip to content

Fix build error on Windows ARM64 with Clang due to missing "arm64_neon.h" #1346

@komainu8

Description

@komainu8

Describe the problem

The changes introduced in #1317 cause the following build error:

C:/a/_temp/msys64/clangarm64/include/xsimd/memory/../config/../types/./xsimd_neon_register.hpp:22:10: fatal error: 'arm64_neon.h' file not found
   22 | #include <arm64_neon.h>
      |          ^~~~~~~~~~~~~~
1 error generated.

Error log URL: https://github.com/groonga/groonga/actions/runs/25546327568/job/74983334286#step:8:2549

Causes

The issue occurs because Clang does not currently provide arm64_neon.h.
When using Clang on Windows ARM64 (e.g., via MSYS2 with clang or clang-cl), the build fails because the compiler cannot find this header.

Currently, arm64_neon.h is included if #if defined(_WIN32) && XSIMD_WITH_NEON64 is true.
While this works for MSVC, it breaks the build for Clang-based environments on Windows ARM64, which still expect the standard arm_neon.h.

Environment

OS: Windows (ARM64)

Compiler: Clang (via MSYS2 with clang or clang-cl)

xsimd version: 14.0.2 or later

Suggestion

On Windows ARM64, Clang can be used via MSYS2 with clang or clang-cl in addition to MSVC. Since arm64_neon.h is a Microsoft-specific header, I believe it should be guarded by _MSC_VER instead of _WIN32.

How about changing the inclusion condition as follows?

--- a/include/xsimd/types/xsimd_neon_register.hpp
+++ b/include/xsimd/types/xsimd_neon_register.hpp
@@ -18,7 +18,7 @@
 #include "./xsimd_register.hpp"
 
 #if XSIMD_WITH_NEON
-#if defined(_WIN32) && XSIMD_WITH_NEON64
+#if defined(_MSC_VER) && XSIMD_WITH_NEON64
 #include <arm64_neon.h>
 #else
 #include <arm_neon.h>

If this looks good to you, I would be happy to submit a Pull Request with this patch.

Additional information

For reference, there is an ongoing effort to provide a wrapper for arm64_neon.h in LLVM (llvm/llvm-project#196014), but it has not been merged yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions