Description
The usearch crate v2.24.0 fails to compile on Windows with MSVC (cl.exe) due to an undefined MAP_FAILED identifier in include/usearch/index_plugins.hpp at line 962.
MAP_FAILED is defined in <sys/mman.h>, which is POSIX-only and does not exist on Windows.
Error
ninclude\usearch/index_plugins.hpp(962): error C3861: 'MAP_FAILED': identifier not found include\usearch/index_plugins.hpp(962): error C2065: 'MAP_FAILED': undeclared identifier n
Affected line
`cpp
if (!new_arena || new_arena == (byte_t*)MAP_FAILED)
return nullptr;
``n
Environment
- OS: Windows 11
- Compiler: MSVC 14.44.35207 (Visual Studio 2022 Build Tools)
- Rust target: x86_64-pc-windows-msvc
- usearch version: 2.24.0 (from crates.io)
Workaround
Adding the following guard near the top of index_plugins.hpp resolves the issue:
`cpp
#ifndef MAP_FAILED
#define MAP_FAILED ((void*)-1)
#endif
``n
Suggested fix
Add a platform guard for MAP_FAILED in index_plugins.hpp, or conditionally compile the memory_mapping_allocator_gt code path that references it on non-Windows platforms.
Description
The usearch crate v2.24.0 fails to compile on Windows with MSVC (cl.exe) due to an undefined MAP_FAILED identifier in include/usearch/index_plugins.hpp at line 962.
MAP_FAILED is defined in <sys/mman.h>, which is POSIX-only and does not exist on Windows.
Error
ninclude\usearch/index_plugins.hpp(962): error C3861: 'MAP_FAILED': identifier not found include\usearch/index_plugins.hpp(962): error C2065: 'MAP_FAILED': undeclared identifiernAffected line
`cpp
if (!new_arena || new_arena == (byte_t*)MAP_FAILED)
return nullptr;
``n
Environment
Workaround
Adding the following guard near the top of index_plugins.hpp resolves the issue:
`cpp
#ifndef MAP_FAILED
#define MAP_FAILED ((void*)-1)
#endif
``n
Suggested fix
Add a platform guard for MAP_FAILED in index_plugins.hpp, or conditionally compile the memory_mapping_allocator_gt code path that references it on non-Windows platforms.