Skip to content

Fix build with MSVC 14.51. - #353

Merged
BrunoLevy merged 3 commits into
BrunoLevy:mainfrom
BillyONeal:remove-hash-map
May 25, 2026
Merged

Fix build with MSVC 14.51.#353
BrunoLevy merged 3 commits into
BrunoLevy:mainfrom
BillyONeal:remove-hash-map

Conversation

@BillyONeal

@BillyONeal BillyONeal commented May 14, 2026

Copy link
Copy Markdown
Contributor

[PoisonRecon] Remove hash_map.

This is required to build geogram on Visual Studio 2026 18.6.0 / MSVC 14.51 , which removes <stdext/hash_map>

Note that upstream PoissonRecon seems to have burninated this a long time ago, see mkazhdan/PoissonRecon@9c3c1f8#diff-13ddca840025f5447c61f8ffab0ec0d8199a8f52e22c1bd00e75d5afec320a26

There were more uses in src\lib\geogram\third_party\PoissonRecon\unused\SurfaceTrimmer.cpp.unused but given that it's named ".unused" I assume that fixing it was unnecessary.

===========================================

aligned_allocator also had an implicit conversion operator that is ambiguous with the rebinding constructor which is removed here.

===========================================

AI was not used in preparing this submission.

This is required to build geogram on Visual Studio 2026 18.6.0 / MSVC 14.51 , which removes <stdext/hash_map>

Note that upstream PoissonRecon seems to have burninated this a long time ago, see mkazhdan/PoissonRecon@9c3c1f8#diff-13ddca840025f5447c61f8ffab0ec0d8199a8f52e22c1bd00e75d5afec320a26

There were more uses in src\lib\geogram\third_party\PoissonRecon\unused\SurfaceTrimmer.cpp.unused but given that it's named ".unused" I assume that fixing it was unnecessary.
@BillyONeal

Copy link
Copy Markdown
Contributor Author
     4>C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\include\xmemory(1525,23): error C2440: 'static_cast': cannot convert from 'const _Alloc' to 'GEO::Memory::aligned_allocator<U,64>' [D:\vcpkg\buildtrees\geogram\x64-windows-dbg\src\lib\geogram\third_party\geogram_third_party.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\include\xmemory(1525,23): error C2440:         with [D:\vcpkg\buildtrees\geogram\x64-windows-dbg\src\lib\geogram\third_party\geogram_third_party.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\include\xmemory(1525,23): error C2440:         [ [D:\vcpkg\buildtrees\geogram\x64-windows-dbg\src\lib\geogram\third_party\geogram_third_party.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\include\xmemory(1525,23): error C2440:             _Alloc=GEO::Memory::aligned_allocator<GEO::Numeric::uint8,64> [D:\vcpkg\buildtrees\geogram\x64-windows-dbg\src\lib\geogram\third_party\geogram_third_party.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\include\xmemory(1525,23): error C2440:         ] [D:\vcpkg\buildtrees\geogram\x64-windows-dbg\src\lib\geogram\third_party\geogram_third_party.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\include\xmemory(1525,23): error C2440:         and [D:\vcpkg\buildtrees\geogram\x64-windows-dbg\src\lib\geogram\third_party\geogram_third_party.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\include\xmemory(1525,23): error C2440:         [ [D:\vcpkg\buildtrees\geogram\x64-windows-dbg\src\lib\geogram\third_party\geogram_third_party.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\include\xmemory(1525,23): error C2440:             U=std::_Container_proxy [D:\vcpkg\buildtrees\geogram\x64-windows-dbg\src\lib\geogram\third_party\geogram_third_party.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\include\xmemory(1525,23): error C2440:         ] [D:\vcpkg\buildtrees\geogram\x64-windows-dbg\src\lib\geogram\third_party\geogram_third_party.vcxproj]
         (compiling source file '../../../../../src/v1.9.3-f80a2fec58.clean/src/lib/geogram/third_party/PoissonRecon/poisson_geogram.cpp')

Not enough :(

…the rebinding constructor in aligned_allocator.
@BillyONeal
BillyONeal marked this pull request as ready for review May 14, 2026 00:35
@BillyONeal BillyONeal changed the title [PoissonRecon] Remove hash_map. Fix build with MSVC 14.51. May 14, 2026
BillyONeal added a commit to BillyONeal/vcpkg that referenced this pull request May 14, 2026
@BillyONeal
BillyONeal marked this pull request as draft May 14, 2026 01:09
@BillyONeal
BillyONeal marked this pull request as ready for review May 14, 2026 01:38
@tksuoran

Copy link
Copy Markdown
Contributor

Just an observation: This what Claude told me:

Root cause. <hash_map> has been a non-standard MSVC extension (in stdext::) since the SGI STL days. Microsoft has been threatening removal for years (gated by _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS), and a recent VS 2026 STL update has finally removed it. The geogram CMake even predicts this — for non-MSVC compilers it adds -Wno-deprecated with the comment # PoissonRecon uses hash map (src/lib/geogram/third_party/CMakeLists.txt:8), but on MSVC the header is just gone.

@BillyONeal

Copy link
Copy Markdown
Contributor Author

That's correct. The stdext containers have been effectively obsolete for 15 years at this point.

@BrunoLevy

BrunoLevy commented May 15, 2026

Copy link
Copy Markdown
Owner

Thank you very much for this PR ! (I'll merge it soon)

Note: I thought that it was working with MSVC 2026, I tested on github using their windows-2025-vs2026 image, and it worked, but it is probably a version that is not as recent (here is what is says while building):

-- Building for: Visual Studio 18 2026
-- The C compiler identification is MSVC 19.50.35730.0
-- The CXX compiler identification is MSVC 19.50.35730.0

I am sometimes lost in MSVC versioning, maybe 19.50 here corresponds to 14.50, and you are using 14.51 ?

Another question is the rebind allocator, I think it was needed by some compilers / versions of the STL (but I do not exaclty remember, will dig in the archives).

I'll also probably make a fork of the original PoissonRecon code and include it here as a submodule, it will make it easier to track modifications (and also make PRs there).

@BillyONeal

Copy link
Copy Markdown
Contributor Author

Note: I thought that it was working with MSVC 2026, I tested on github using their windows-2025-vs2026 image, and it worked, but it is probably a version that is not as recent (here is what is says while building):

Yes, 19.6.0 / MSVC 19.51 just came out last week: https://devblogs.microsoft.com/cppblog/msvc-version-1451-available/

I am sometimes lost in MSVC versioning, maybe 19.50 here corresponds to 14.50, and you are using 14.51 ?

I believe that that is the case. Despite technically being in the MSVC team I have intentionally not tried to internalize the new ... "version number scheme" because I don't think real users do that and I want to be able to represent real users.

Another question is the rebind allocator, I think it was needed by some compilers / versions of the STL (but I do not exaclty remember, will dig in the archives).

The rebinding requirement is an STL requirement. That is, given an allocator for type A, the STL needs to be able to construct an allocator for type B. For instance, given list<T>, the list does not allocate Ts, it allocates linked list nodes that have space for those Ts.

Put another way, for some allocator a of type A, the STL has to do something like:

struct _List_node { /* ... */ };

using AllocatorForListNode =
    typename std::allocator_traits<A>::template rebind_alloc<_List_node>;
AllocatorForListNode al(a); // <-- the so-called "rebind constructor"
al.allocate(/*...*/);

Once upon a time, it looks like geogram implemented this requirement with the conversion operator removed in this PR. However, at some point

template <class U, int A2> constexpr aligned_allocator(
const aligned_allocator<U, A2>&
) noexcept {
}

got added, and that competes with the conversion operator resulting in ambiguities. ( 4e50010 ? ) The intent of removing the conversion operator is that everything that used that once upon a time now use the rebinding constructor instead.

I'll also probably make a fork of the original PoissonRecon code and include it here as a submodule, it will make it easier to track modifications (and also make PRs there).

Is there any chance of using the real one? Vendoring dependencies like that fails as soon as 2 projects do it.

@BrunoLevy
BrunoLevy merged commit 06bd7c8 into BrunoLevy:main May 25, 2026
@BrunoLevy

Copy link
Copy Markdown
Owner

Thank you very much for this pull request ! Will be included in 1.9.10 (to be released soon)
Regarding PoissonRecon, yes, I'll do my best to use the official version.

@BillyONeal
BillyONeal deleted the remove-hash-map branch May 26, 2026 00:04
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.

3 participants