Summary
Building on Windows with the MSVC toolchain fails to compile the glint library. glint/src/simd.hpp calls the MSVC intrinsic __cpuidex but does not include <intrin.h>, which declares it.
Environment
- OS: Windows 11
- Compiler: MSVC 19.39.33521.0 (cl.exe 14.39.33519, VS 2022 Build Tools)
- CMake 4.4, Ninja generator (via
build-windows.bat)
- Commit: 705e355 (v0.8.24)
Steps to reproduce
Error
C:\...\CrispASR\glint\src\simd.hpp(28): error C3861: '__cpuidex': identifier not found
Fails identically for subband.cpp, mdct.cpp, encoder.cpp, etc. — any TU that includes simd.hpp.
Root cause
In detect_simd(), the _MSC_VER branch uses __cpuidex:
#elif defined(_MSC_VER)
// MSVC: use __cpuid
int cpuinfo[4];
__cpuidex(cpuinfo, 7, 0);
__cpuidex is an MSVC intrinsic declared in <intrin.h>, which the header never includes. GCC/Clang builds take the __builtin_cpu_supports branch instead (no header needed), so this path was never exercised on Linux.
Fix
Add a guarded include near the top of glint/src/simd.hpp:
#include "glint/glint.h"
#if defined(_MSC_VER)
#include <intrin.h> // __cpuidex
#endif
With this change the build completes and build\bin\crispasr.exe (v0.8.24) runs correctly. Happy to send a PR if preferred.
Summary
Building on Windows with the MSVC toolchain fails to compile the
glintlibrary.glint/src/simd.hppcalls the MSVC intrinsic__cpuidexbut does not include<intrin.h>, which declares it.Environment
build-windows.bat)Steps to reproduce
Error
Fails identically for
subband.cpp,mdct.cpp,encoder.cpp, etc. — any TU that includessimd.hpp.Root cause
In
detect_simd(), the_MSC_VERbranch uses__cpuidex:__cpuidexis an MSVC intrinsic declared in<intrin.h>, which the header never includes. GCC/Clang builds take the__builtin_cpu_supportsbranch instead (no header needed), so this path was never exercised on Linux.Fix
Add a guarded include near the top of
glint/src/simd.hpp:With this change the build completes and
build\bin\crispasr.exe(v0.8.24) runs correctly. Happy to send a PR if preferred.