luceneplusplus / LucenePlusPlus

Lucene++ is an up to date C++ port of the popular Java Lucene library, a high-performance, full-featured text search engine.
luceneplusplus@googlegroups.com
Other
743 stars 235 forks source link

Build failure with Clang 5: `error: use of undeclared identifier 'max_align_t'` #206

Open barracuda156 opened 3 months ago

barracuda156 commented 3 months ago

Build fails with Apple Clang 5.x:

In file included from /opt/local/var/macports/build/_opt_MountainLionPorts_devel_LucenePlusPlus/LucenePlusPlus/work/LucenePlusPlus-3.0.9/include/lucene++/ThreadPool.h:10:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio.hpp:21:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/associated_executor.hpp:24:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/system_executor.hpp:20:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/execution.hpp:19:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/execution/any_executor.hpp:23:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/detail/executor_function.hpp:19:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/detail/handler_alloc_helpers.hpp:21:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/detail/recycling_allocator.hpp:21:
/opt/local/libexec/boost/1.78/include/boost/asio/detail/thread_info_base.hpp:121:45: error: use of undeclared identifier 'max_align_t'
      std::size_t size, std::size_t align = BOOST_ASIO_DEFAULT_ALIGN)
                                            ^
/opt/local/libexec/boost/1.78/include/boost/asio/detail/config.hpp:592:45: note: expanded from macro 'BOOST_ASIO_DEFAULT_ALIGN'
#   define BOOST_ASIO_DEFAULT_ALIGN alignof(max_align_t)
                                            ^
In file included from /opt/local/var/macports/build/_opt_MountainLionPorts_devel_LucenePlusPlus/LucenePlusPlus/work/LucenePlusPlus-3.0.9/src/core/search/ParallelMultiSearcher.cpp:16:
In file included from /opt/local/var/macports/build/_opt_MountainLionPorts_devel_LucenePlusPlus/LucenePlusPlus/work/LucenePlusPlus-3.0.9/include/lucene++/ThreadPool.h:10:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio.hpp:21:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/associated_executor.hpp:24:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/system_executor.hpp:20:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/execution.hpp:19:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/execution/any_executor.hpp:23:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/detail/executor_function.hpp:19:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/detail/handler_alloc_helpers.hpp:21:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/detail/recycling_allocator.hpp:21:
/opt/local/libexec/boost/1.78/include/boost/asio/detail/thread_info_base.hpp:134:45: error: use of undeclared identifier 'max_align_t'
      std::size_t size, std::size_t align = BOOST_ASIO_DEFAULT_ALIGN)
                                            ^
/opt/local/libexec/boost/1.78/include/boost/asio/detail/config.hpp:592:45: note: expanded from macro 'BOOST_ASIO_DEFAULT_ALIGN'
#   define BOOST_ASIO_DEFAULT_ALIGN alignof(max_align_t)
                                            ^
In file included from /opt/local/var/macports/build/_opt_MountainLionPorts_devel_LucenePlusPlus/LucenePlusPlus/work/LucenePlusPlus-3.0.9/src/core/search/ParallelMultiSearcher.cpp:16:
In file included from /opt/local/var/macports/build/_opt_MountainLionPorts_devel_LucenePlusPlus/LucenePlusPlus/work/LucenePlusPlus-3.0.9/include/lucene++/ThreadPool.h:10:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio.hpp:21:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/associated_executor.hpp:24:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/system_executor.hpp:20:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/execution.hpp:19:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/execution/any_executor.hpp:23:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/detail/executor_function.hpp:19:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/detail/handler_alloc_helpers.hpp:24:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/handler_alloc_hook.hpp:103:
/opt/local/libexec/boost/1.78/include/boost/asio/impl/handler_alloc_hook.ipp:36:10: error: no matching function for call to 'allocate'
  return detail::thread_info_base::allocate(
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/libexec/boost/1.78/include/boost/asio/detail/thread_info_base.hpp:133:16: note: candidate function template not viable: requires 4 arguments, but 2 were provided
  static void* allocate(Purpose, thread_info_base* this_thread,
               ^
/opt/local/libexec/boost/1.78/include/boost/asio/detail/thread_info_base.hpp:120:16: note: candidate function not viable: requires 3 arguments, but 2 were provided
  static void* allocate(thread_info_base* this_thread,
               ^
In file included from /opt/local/var/macports/build/_opt_MountainLionPorts_devel_LucenePlusPlus/LucenePlusPlus/work/LucenePlusPlus-3.0.9/src/core/search/ParallelMultiSearcher.cpp:16:
In file included from /opt/local/var/macports/build/_opt_MountainLionPorts_devel_LucenePlusPlus/LucenePlusPlus/work/LucenePlusPlus-3.0.9/include/lucene++/ThreadPool.h:10:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio.hpp:21:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/associated_executor.hpp:24:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/system_executor.hpp:20:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/execution.hpp:19:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/execution/any_executor.hpp:23:
In file included from /opt/local/libexec/boost/1.78/include/boost/asio/detail/executor_function.hpp:19:
/opt/local/libexec/boost/1.78/include/boost/asio/detail/handler_alloc_helpers.hpp:55:25: error: unknown type name 'max_align_t'; did you mean 'std::max_align_t'?
    std::size_t align = BOOST_ASIO_DEFAULT_ALIGN)
                        ^
/opt/local/libexec/boost/1.78/include/boost/asio/detail/config.hpp:592:45: note: expanded from macro 'BOOST_ASIO_DEFAULT_ALIGN'
#   define BOOST_ASIO_DEFAULT_ALIGN alignof(max_align_t)
                                            ^
/usr/bin/../lib/c++/v1/cstddef:55:21: note: 'std::max_align_t' declared here
typedef long double max_align_t;
                    ^

Not sure if this should be fixed or just older Clangs be avoided, but from the source it follows that even Clang 4.x is supposed to be supported, FWIW.

Clang 16 builds this with no issues on the same OS with the same Boost 1.78.