sccn / liblsl

C++ lsl library for multi-modal time-synched data transmission over the local network
Other
107 stars 63 forks source link

error: '__and_' was not declared in this scope; did you mean 'std::__and_'? #189

Closed barracuda156 closed 1 year ago

barracuda156 commented 1 year ago
In file included from /opt/local/libexec/boost/1.76/include/boost/math/tools/mp.hpp:341,
                 from /opt/local/libexec/boost/1.76/include/boost/math/policies/policy.hpp:11,
                 from /opt/local/libexec/boost/1.76/include/boost/math/special_functions/math_fwd.hpp:31,
                 from /opt/local/libexec/boost/1.76/include/boost/math/special_functions/fpclassify.hpp:18,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/src/portable_archive/portable_archive_includes.hpp:97,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/src/portable_archive/portable_iarchive.hpp:4,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/src/sample.cpp:3:
/opt/local/include/gcc12/c++/utility:94:14: error: '__and_' was not declared in this scope; did you mean 'std::__and_'?
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |              ^~~~~~
      |              std::__and_
In file included from /opt/local/include/gcc12/c++/bits/move.h:57,
                 from /opt/local/include/gcc12/c++/bits/exception_ptr.h:43,
                 from /opt/local/include/gcc12/c++/exception:168,
                 from /opt/local/include/gcc12/c++/stdexcept:38,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/src/common.h:10,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/src/sample.h:3,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/src/sample.cpp:2:
/opt/local/include/gcc12/c++/type_traits:154:12: note: 'std::__and_' declared here
  154 |     struct __and_;
      |            ^~~~~~
/opt/local/include/gcc12/c++/utility:94:21: error: 'is_nothrow_move_constructible' was not declared in this scope; did you mean 'std::is_nothrow_move_constructible'?
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                     std::is_nothrow_move_constructible
/opt/local/include/gcc12/c++/type_traits:1102:12: note: 'std::is_nothrow_move_constructible' declared here
 1102 |     struct is_nothrow_move_constructible
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/gcc12/c++/utility:94:54: error: expected primary-expression before '>' token
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |                                                      ^
/opt/local/include/gcc12/c++/utility:94:55: error: expected primary-expression before ',' token
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |                                                       ^
/opt/local/include/gcc12/c++/utility:94:55: error: expected ')' before ',' token
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |             ~                                         ^
      |                                                       )
/opt/local/include/gcc12/c++/utility:94:55: error: expected ';' before ',' token
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |                                                       ^
      |                                                       ;
/opt/local/include/gcc12/c++/utility:103:15: error: 'add_const_t' does not name a type
  103 |     constexpr add_const_t<_Tp>&
      |               ^~~~~~~~~~~
/opt/local/libexec/boost/1.76/include/boost/math/tools/mp.hpp:342:10: error: 'boost::math::tools::meta_programming::std::size_t' has not been declared
  342 | template<std::size_t... I>
      |          ^~~
/opt/local/libexec/boost/1.76/include/boost/math/tools/mp.hpp:343:29: error: 'index_sequence' in namespace 'boost::math::tools::meta_programming::std' does not name a template type
  343 | using index_sequence = std::index_sequence<I...>;
      |                             ^~~~~~~~~~~~~~
/opt/local/libexec/boost/1.76/include/boost/math/tools/mp.hpp:345:10: error: 'boost::math::tools::meta_programming::std::size_t' has not been declared
  345 | template<std::size_t N>
      |          ^~~
/opt/local/libexec/boost/1.76/include/boost/math/tools/mp.hpp:346:34: error: 'make_index_sequence' in namespace 'boost::math::tools::meta_programming::std' does not name a template type
  346 | using make_index_sequence = std::make_index_sequence<N>;
      |                                  ^~~~~~~~~~~~~~~~~~~
/opt/local/libexec/boost/1.76/include/boost/math/tools/mp.hpp:349:33: error: 'index_sequence_for' in namespace 'boost::math::tools::meta_programming::std' does not name a template type
  349 | using index_sequence_for = std::index_sequence_for<T...>;
      |                                 ^~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/lslobj.dir/src/sample.cpp.o] Error 1
barracuda156 commented 1 year ago

Related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105707 Notice, this is not a bug in GCC.

cboulay commented 1 year ago

This is a boost bug. It is not present in the included boost (i.e., do not set LSL_BUNDLED_BOOST=OFF and leave it the default ON), it is not present in boost 1.74, it IS present in 1.76, and it was fixed in this commit for 1.77.

Nothing to be done in liblsl.

barracuda156 commented 1 year ago

@cboulay Thank you for the detailed info! We won’t use bundled Boost, but we can set another Boost version to be used by the port. I will discuss this with the port maintainer.

barracuda156 commented 1 year ago

@cboulay With Boost 171 it fails here:

In file included from /opt/local/libexec/boost/1.71/include/boost/endian/detail/endian_reverse.hpp:13,
                 from /opt/local/libexec/boost/1.71/include/boost/endian/conversion.hpp:11,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/src/util/endian.hpp:3,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/src/sample.h:6,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/src/sample.cpp:2:
/opt/local/libexec/boost/1.71/include/boost/endian/detail/endian_reverse.hpp: In instantiation of 'T boost::endian::endian_reverse(T) [with T = double]':
/opt/local/libexec/boost/1.71/include/boost/endian/detail/endian_reverse.hpp:97:23:   required from 'void boost::endian::endian_reverse_inplace(EndianReversible&) [with EndianReversible = double]'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/src/sample.cpp:185:65:   required from 'void save_value(std::streambuf&, T, bool) [with T = double; std::streambuf = std::basic_streambuf<char>]'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/src/sample.cpp:196:13:   required from here
/opt/local/libexec/boost/1.71/include/boost/endian/detail/endian_reverse.hpp:87:5: error: static assertion failed: is_integral<T>::value && !is_same<T, bool>::value
   87 |     BOOST_STATIC_ASSERT( is_integral<T>::value && !is_same<T, bool>::value );
      |     ^~~~~~~~~~~~~~~~~~~
/opt/local/libexec/boost/1.71/include/boost/endian/detail/endian_reverse.hpp:87:5: note: 'boost::integral_constant<bool, false>::value' evaluates to false
make[2]: *** [CMakeFiles/lslobj.dir/src/sample.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/build'
make[1]: *** [CMakeFiles/lslobj.dir/all] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/build'
make: *** [all] Error 2

Boost 181 works fine.

However, there are two more errors. One pthread-related, we have a patch for it:

--- thirdparty/loguru/loguru.cpp
+++ thirdparty/loguru/loguru.cpp
@@ -1084,7 +1084,17 @@ namespace loguru

            #ifdef __APPLE__
                uint64_t thread_id;
-               pthread_threadid_np(pthread_self(), &thread_id);
+               #if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 || defined __POWERPC__
+                   thread_id = pthread_mach_thread_np(pthread_self());
+               #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+                   if (&pthread_threadid_np) {
+                       pthread_threadid_np(pthread_self(), &thread_id);
+                   } else {
+                       thread_id = pthread_mach_thread_np(pthread_self());
+                   }
+               #else
+                   pthread_threadid_np(pthread_self(), &thread_id);
+               #endif
            #elif defined(__FreeBSD__)
                long thread_id;
                (void)thr_self(&thread_id);

Another this one:

[ 96%] Building C object CMakeFiles/lslver.dir/testing/lslver.c.o
/opt/local/bin/gcc-mp-12 -DLIBLSL_EXPORTS -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/include -pipe -Os -DNDEBUG -I/opt/local/libexec/boost/1.81/include -I/opt/local/include -flto=auto -fno-fat-lto-objects -arch ppc -mmacosx-version-min=10.6 -fPIE -MD -MT CMakeFiles/lslver.dir/testing/lslver.c.o -MF CMakeFiles/lslver.dir/testing/lslver.c.o.d -o CMakeFiles/lslver.dir/testing/lslver.c.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_liblsl/liblsl/work/liblsl-1.16.1/testing/lslver.c
cc1: error: '-fno-fat-lto-objects' are supported only with linker plugin
make[2]: *** [CMakeFiles/lslver.dir/testing/lslver.c.o] Error 1

Not too sure where this -fno-fat-lto-objects gets pulled from.

tstenner commented 1 year ago

FWIW the bundled boost version is set here: https://github.com/sccn/liblsl/blob/master/update_lslboost.sh#L4