shark failing to compile: static assert failed _DISABLE_EXTENDED_ALIGNED_STORAGE

471 views Asked by At

I followed the installation guide with Visual Studio 2022 as described here. I am able to clone from git and then use cmake to produce a VS2022 sln file. However, when I attempt to build that solution in VS2022, I get the following error:

Severity Code Description Project File Line Suppression State
Error C2338 static_assert failed: 'You've instantiated std::aligned_storage<Len, Align> with an extended alignment (in other words, Align > alignof(max_align_t)). Before VS 2017 15.8, the member "type" would non-conformingly have an alignment of only alignof(max_align_t). VS 2017 15.8 was fixed to handle this correctly, but the fix inherently changes layout and breaks binary compatibility (only for uses of aligned_storage with extended alignments). Please define either (1) _ENABLE_EXTENDED_ALIGNED_STORAGE to acknowledge that you understand this message and that you actually want a type with an extended alignment, or (2) _DISABLE_EXTENDED_ALIGNED_STORAGE to silence this message and get the old non-conforming behavior.' shark C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\type_traits 987

I am seeing this error 209 times which is also the number of projects in the cmake generated sln. When I double click on one of those errors, I am taken to a file called type_traits where I see the following code:

#ifndef _DISABLE_EXTENDED_ALIGNED_STORAGE
    static_assert(_Always_false<_Aligned>,
        "You've instantiated std::aligned_storage<Len, Align> with an extended alignment (in other "
        "words, Align > alignof(max_align_t)). Before VS 2017 15.8, the member \"type\" would "
        "non-conformingly have an alignment of only alignof(max_align_t). VS 2017 15.8 was fixed to "
        "handle this correctly, but the fix inherently changes layout and breaks binary compatibility "
        "(*only* for uses of aligned_storage with extended alignments). "
        "Please define either "
        "(1) _ENABLE_EXTENDED_ALIGNED_STORAGE to acknowledge that you understand this message and "
        "that you actually want a type with an extended alignment, or "
        "(2) _DISABLE_EXTENDED_ALIGNED_STORAGE to silence this message and get the old non-conforming "
        "behavior.");
#endif // !_DISABLE_EXTENDED_ALIGNED_STORAGE

Seems like I may need to define _DISABLE_EXTENDED_ALIGNED_STORAGE. Please say what is the right way to do that?

1

There are 1 answers

0
DKS On BEST ANSWER

Seems like Shark has left it to the person compiling the it to choose weather to define _ENABLE_EXTENDED_ALIGNED_STORAGE or _DISABLE_EXTENDED_ALIGNED_STORAGE. I chose the latter.