Skip to content

Conversation

ryanofsky
Copy link
Collaborator

Last remaining uses of these utilities except for ThrowFn were removed in #31.

Last remaining use of ThrowFn is removed here. After C++14 it is easily replaced with a perfect-forwarding auto&& lambda.

Immediate motivation for this change is to fix C++20 compilers complaining about reference to std::result_of in the unused code:
bitcoin/bitcoin#29248

Last remaining uses of these utilities except for ThrowFn were removed in PR
"Unify ReadFieldNew / ReadFieldUpdate"
bitcoin-core#31

Last remaining use of ThrowFn is removed here. After C++14 it is easily replaced
with a perfect-forwarding auto&& lambda.

Immediate motivation for this change is to fix C++20 compilers complaining about
reference to std::result_of in the unused code
bitcoin/bitcoin#29248
@ryanofsky ryanofsky merged commit 7d1fee0 into bitcoin-core:master Jan 18, 2024
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jan 18, 2024
Fixes bitcoin#29248

The std::result_of type was removed in c++20, but was being referenced in some
old, unused code in the library. The issue was fixed in:

bitcoin-core/libmultiprocess#91 util: Drop Bind, BindTuple, ComposeFn, GetFn, and ThrowFn helpers

This update also includes other recent libmultiprocess changes to improve C++20
support and fix build issues:

bitcoin-core/libmultiprocess#89 pkgconfig: Drop -std=c++17 compile flag
bitcoin-core/libmultiprocess#90 pkgconfig: Use @CMAKE_INSTALL_LIBDIR@ variable
@edilmedeiros
Copy link

My build succeeded, but the tests failed.

Attached are some logs; not sure if this is a problem with my setup.

CMakeError.log
CMakeOutput.log

❯ cmake ..
-- The CXX compiler identification is AppleClang 15.0.0.15000100
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.29.2")
-- Checking for module 'capnp'
--   Found capnp, version 1.0.1
-- Checking for module 'capnpc'
--   Found capnpc, version 1.0.1
-- Checking for module 'capnp-rpc'
--   Found capnp-rpc, version 1.0.1
-- Checking for module 'capnp-json'
--   Found capnp-json, version 1.0.1
-- Checking for module 'capnp-websocket'
--   Found capnp-websocket, version 1.0.1
-- Checking for module 'kj'
--   Found kj, version 1.0.1
-- Checking for module 'kj-async'
--   Found kj-async, version 1.0.1
-- Checking for module 'kj-http'
--   Found kj-http, version 1.0.1
-- Checking for module 'kj-gzip'
--   Found kj-gzip, version 1.0.1
-- Checking for module 'kj-tls'
--   Found kj-tls, version 1.0.1
-- Checking for module 'kj-test'
--   Found kj-test, version 1.0.1
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test HAVE_PTHREAD_GETNAME_NP
-- Performing Test HAVE_PTHREAD_GETNAME_NP - Success
-- Performing Test HAVE_PTHREAD_THREADID_NP
-- Performing Test HAVE_PTHREAD_THREADID_NP - Success
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP - Failed
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build


❯ make
[ 14%] Building CXX object CMakeFiles/util.dir/src/mp/util.cpp.o
[ 14%] Built target util
[ 28%] Compiling Cap'n Proto schema include/mp/proxy.capnp
[ 42%] Building CXX object CMakeFiles/multiprocess.dir/include/mp/proxy.capnp.c++.o
[ 57%] Building CXX object CMakeFiles/multiprocess.dir/src/mp/proxy.cpp.o
[ 71%] Linking CXX static library libmultiprocess.a
[ 71%] Built target multiprocess
[ 85%] Building CXX object CMakeFiles/mpgen.dir/src/mp/gen.cpp.o
[100%] Linking CXX executable mpgen
[100%] Built target mpgen


❯ make check
Consolidate compiler generated dependencies of target util
[  7%] Built target util
Consolidate compiler generated dependencies of target mpgen
[ 21%] Built target mpgen
Consolidate compiler generated dependencies of target multiprocess
[ 50%] Built target multiprocess
[ 57%] Generating mp/test/foo.capnp.h, mp/test/foo.capnp.c++, mp/test/foo.capnp.proxy.h, mp/test/foo.capnp.proxy-server.c++, mp/test/foo.capnp.proxy-client.c++, mp/test/foo.capnp.proxy-types.c++, mp/test/foo.capnp.proxy-types.h
[ 64%] Building CXX object test/CMakeFiles/mptest.dir/mp/test/foo.capnp.c++.o
[ 71%] Building CXX object test/CMakeFiles/mptest.dir/mp/test/foo.capnp.proxy-server.c++.o
In file included from /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build/test/mp/test/foo.capnp.proxy-server.c++:3:
In file included from /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build/test/mp/test/foo.capnp.proxy-types.h:7:
In file included from /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/test/mp/test/foo-types.h:8:
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1003:16: error: no matching function for call to 'BuildPrimitive'
    output.set(BuildPrimitive(invoke_context, std::forward<Value>(value), TypeList<decltype(output.get())>()));
               ^~~~~~~~~~~~~~
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:699:9: note: in instantiation of function template specialization 'mp::CustomBuildField<bool, std::__bit_const_reference<std::vector<bool>>, mp::ListOutput<capnp::List<bool, capnp::Kind::PRIMITIVE>>>' requested here
        CustomBuildField(TypeList<LocalTypes...>(), Priority<3>(), context, std::forward<Values>(values)...,
        ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:842:9: note: in instantiation of function template specialization 'mp::BuildField<bool, mp::InvokeContext, std::__bit_const_reference<std::vector<bool>>, mp::ListOutput<capnp::List<bool, capnp::Kind::PRIMITIVE>>>' requested here
        BuildField(TypeList<LocalType>(), invoke_context, ListOutput<typename decltype(list)::Builds>(list, i), *it);
        ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:699:9: note: in instantiation of function template specialization 'mp::CustomBuildField<bool, const std::vector<bool> &, mp::StructField<mp::Accessor<mp::foo_fields::Vbool, 19>, mp::test::messages::FooStruct::Builder> &>' requested here
        CustomBuildField(TypeList<LocalTypes...>(), Priority<3>(), context, std::forward<Values>(values)...,
        ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1018:5: note: in instantiation of function template specialization 'mp::BuildField<std::vector<bool>, mp::InvokeContext, const std::vector<bool> &, mp::StructField<mp::Accessor<mp::foo_fields::Vbool, 19>, mp::test::messages::FooStruct::Builder> &>' requested here
    BuildField(TypeList<Decay<decltype(field_value)>>(), invoke_context, field_output, field_value);
    ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1019:5: note: in instantiation of function template specialization 'mp::BuildOne<2UL, mp::test::FooStruct, const mp::test::FooStruct &, mp::test::messages::FooStruct::Builder &>' requested here
    BuildOne<index + 1>(param, invoke_context, output, value);
    ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1019:5: note: (skipping 2 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:699:9: note: in instantiation of function template specialization 'mp::CustomBuildField<mp::test::FooStruct, const mp::test::FooStruct &, mp::StructField<mp::Accessor<mp::foo_fields::Error, 18>, mp::test::messages::FooInterface::RaiseResults::Builder>>' requested here
        CustomBuildField(TypeList<LocalTypes...>(), Priority<3>(), context, std::forward<Values>(values)...,
        ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1360:13: note: in instantiation of function template specialization 'mp::BuildField<mp::test::FooStruct, mp::ServerInvokeContext<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>>, const mp::test::FooStruct &, mp::StructField<mp::Accessor<mp::foo_fields::Error, 18>, mp::test::messages::FooInterface::RaiseResults::Builder>>' requested here
            BuildField(TypeList<Exception>(), server_context, Make<StructField, Accessor>(results), exception);
            ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1135:8: note: in instantiation of function template specialization 'mp::ServerExcept<mp::test::FooStruct, mp::Accessor<mp::foo_fields::Error, 18>, mp::ServerCall>::invoke<mp::ServerInvokeContext<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>>, mp::test::FooStruct>' requested here
    fn.invoke(server_context, std::forward<Args>(args)..., static_cast<LocalType&&>(*param));
       ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1385:16: note: in instantiation of function template specialization 'mp::PassField<mp::Accessor<mp::foo_fields::Arg, 17>, mp::test::FooStruct, mp::ServerInvokeContext<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>>, const mp::ServerExcept<mp::test::FooStruct, mp::Accessor<mp::foo_fields::Error, 18>, mp::ServerCall> &, mp::TypeList<>>' requested here
        return PassField<Accessor>(Priority<2>(),
               ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build/test/mp/test/foo.capnp.proxy-server.c++:17:12: note: in instantiation of function template specialization 'mp::serverInvoke<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>, mp::ServerField<1, mp::Accessor<mp::foo_fields::Arg, 17>, mp::ServerExcept<mp::test::FooStruct, mp::Accessor<mp::foo_fields::Error, 18>, mp::ServerCall>>>' requested here
    return serverInvoke(*this, call_context, MakeServerField<1, Accessor<foo_fields::Arg, FIELD_IN | FIELD_BOXED>>(Make<ServerExcept, mp::test::FooStruct, Accessor<foo_fields::Error, FIELD_OUT | FIELD_BOXED>>(ServerCall())));
           ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:879:15: note: candidate function template not viable: no known conversion from 'TypeList<decltype(output.get())>' to 'TypeList<::capnp::Void>' for 3rd argument
::capnp::Void BuildPrimitive(InvokeContext& invoke_context, Value&&, TypeList<::capnp::Void>)
              ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:884:20: note: candidate function not viable: no known conversion from 'std::__bit_const_reference<std::vector<bool>>' to 'std::vector<bool>::reference' (aka '__bit_reference<vector<bool, allocator<bool>>>') for 2nd argument
inline static bool BuildPrimitive(InvokeContext& invoke_context, std::vector<bool>::reference value, TypeList<bool>)
                   ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:890:11: note: candidate template ignored: requirement 'std::is_enum<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>>::value' was not satisfied [with LocalType = bool, Value = std::__bit_const_reference<std::vector<bool>>]
LocalType BuildPrimitive(InvokeContext& invoke_context,
          ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:899:11: note: candidate template ignored: requirement 'std::is_integral<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>>::value' was not satisfied [with LocalType = bool, Value = std::__bit_const_reference<std::vector<bool>>]
LocalType BuildPrimitive(InvokeContext& invoke_context,
          ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:912:11: note: candidate template ignored: requirement 'std::is_floating_point<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>>::value' was not satisfied [with LocalType = bool, Value = std::__bit_const_reference<std::vector<bool>>]
LocalType BuildPrimitive(InvokeContext& invoke_context,
          ^
1 error generated.
make[3]: *** [test/CMakeFiles/mptest.dir/mp/test/foo.capnp.proxy-server.c++.o] Error 1
make[2]: *** [test/CMakeFiles/mptest.dir/all] Error 2
make[1]: *** [test/CMakeFiles/check.dir/rule] Error 2
make: *** [check] Error 2

@ryanofsky
Copy link
Collaborator Author

My build succeeded, but the tests failed.

Thanks @edilmedeiros, I opened a new issue for this in #92, and I'm downloading clang 15 to see if I can reproduce this error on linux.

ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jan 22, 2024
Fixes bitcoin#29248

The std::result_of type was removed in c++20, but was being referenced in some
old, unused code in the library. The issue was fixed in:

bitcoin-core/libmultiprocess#91 util: Drop Bind, BindTuple, ComposeFn, GetFn, and ThrowFn helpers

This update also includes other recent libmultiprocess changes to improve C++20
support and fix build issues:

bitcoin-core/libmultiprocess#89 pkgconfig: Drop -std=c++17 compile flag
bitcoin-core/libmultiprocess#90 pkgconfig: Use @CMAKE_INSTALL_LIBDIR@ variable
bitcoin-core/libmultiprocess#93 Fix support for vector<bool> serialization with libc++
fanquake added a commit to bitcoin/bitcoin that referenced this pull request Jan 23, 2024
…cos build error

b8105b3 depends: Update libmultiprocess library to fix C++20 macos build error (Ryan Ofsky)

Pull request description:

  Fixes #29248

  The std::result_of type was removed in c++20, but was being referenced in some old, unused code in the library. The issue was fixed in:

  - bitcoin-core/libmultiprocess#91

  This update also includes other recent libmultiprocess changes to improve C++20 support and fix build issues:

  - bitcoin-core/libmultiprocess#89
  - bitcoin-core/libmultiprocess#90
  - bitcoin-core/libmultiprocess#93

ACKs for top commit:
  fanquake:
    ACK b8105b3.

Tree-SHA512: 2ca64b5fc27be752baba38df4b4faf62152e18c70ead6e0e063f1cb0c25dd5d924dec7ebfd7f8bbd651ae50eb35e8d8b591a9847c36f22558b5f5effccf56536
0xB10C pushed a commit to 0xB10C/bitcoin that referenced this pull request Jan 24, 2024
Fixes bitcoin#29248

The std::result_of type was removed in c++20, but was being referenced in some
old, unused code in the library. The issue was fixed in:

bitcoin-core/libmultiprocess#91 util: Drop Bind, BindTuple, ComposeFn, GetFn, and ThrowFn helpers

This update also includes other recent libmultiprocess changes to improve C++20
support and fix build issues:

bitcoin-core/libmultiprocess#89 pkgconfig: Drop -std=c++17 compile flag
bitcoin-core/libmultiprocess#90 pkgconfig: Use @CMAKE_INSTALL_LIBDIR@ variable
bitcoin-core/libmultiprocess#93 Fix support for vector<bool> serialization with libc++
janus pushed a commit to BitgesellOfficial/bitgesell that referenced this pull request Apr 6, 2024
Fixes #29248

The std::result_of type was removed in c++20, but was being referenced in some
old, unused code in the library. The issue was fixed in:

bitcoin-core/libmultiprocess#91 util: Drop Bind, BindTuple, ComposeFn, GetFn, and ThrowFn helpers

This update also includes other recent libmultiprocess changes to improve C++20
support and fix build issues:

bitcoin-core/libmultiprocess#89 pkgconfig: Drop -std=c++17 compile flag
bitcoin-core/libmultiprocess#90 pkgconfig: Use @CMAKE_INSTALL_LIBDIR@ variable
bitcoin-core/libmultiprocess#93 Fix support for vector<bool> serialization with libc++
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 27, 2024
…++20 macos build error

b8105b3 depends: Update libmultiprocess library to fix C++20 macos build error (Ryan Ofsky)

Pull request description:

  Fixes bitcoin#29248

  The std::result_of type was removed in c++20, but was being referenced in some old, unused code in the library. The issue was fixed in:

  - bitcoin-core/libmultiprocess#91

  This update also includes other recent libmultiprocess changes to improve C++20 support and fix build issues:

  - bitcoin-core/libmultiprocess#89
  - bitcoin-core/libmultiprocess#90
  - bitcoin-core/libmultiprocess#93

ACKs for top commit:
  fanquake:
    ACK b8105b3.

Tree-SHA512: 2ca64b5fc27be752baba38df4b4faf62152e18c70ead6e0e063f1cb0c25dd5d924dec7ebfd7f8bbd651ae50eb35e8d8b591a9847c36f22558b5f5effccf56536
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 27, 2024
…++20 macos build error

b8105b3 depends: Update libmultiprocess library to fix C++20 macos build error (Ryan Ofsky)

Pull request description:

  Fixes bitcoin#29248

  The std::result_of type was removed in c++20, but was being referenced in some old, unused code in the library. The issue was fixed in:

  - bitcoin-core/libmultiprocess#91

  This update also includes other recent libmultiprocess changes to improve C++20 support and fix build issues:

  - bitcoin-core/libmultiprocess#89
  - bitcoin-core/libmultiprocess#90
  - bitcoin-core/libmultiprocess#93

ACKs for top commit:
  fanquake:
    ACK b8105b3.

Tree-SHA512: 2ca64b5fc27be752baba38df4b4faf62152e18c70ead6e0e063f1cb0c25dd5d924dec7ebfd7f8bbd651ae50eb35e8d8b591a9847c36f22558b5f5effccf56536
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 27, 2024
…++20 macos build error

b8105b3 depends: Update libmultiprocess library to fix C++20 macos build error (Ryan Ofsky)

Pull request description:

  Fixes bitcoin#29248

  The std::result_of type was removed in c++20, but was being referenced in some old, unused code in the library. The issue was fixed in:

  - bitcoin-core/libmultiprocess#91

  This update also includes other recent libmultiprocess changes to improve C++20 support and fix build issues:

  - bitcoin-core/libmultiprocess#89
  - bitcoin-core/libmultiprocess#90
  - bitcoin-core/libmultiprocess#93

ACKs for top commit:
  fanquake:
    ACK b8105b3.

Tree-SHA512: 2ca64b5fc27be752baba38df4b4faf62152e18c70ead6e0e063f1cb0c25dd5d924dec7ebfd7f8bbd651ae50eb35e8d8b591a9847c36f22558b5f5effccf56536
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 28, 2024
…++20 macos build error

b8105b3 depends: Update libmultiprocess library to fix C++20 macos build error (Ryan Ofsky)

Pull request description:

  Fixes bitcoin#29248

  The std::result_of type was removed in c++20, but was being referenced in some old, unused code in the library. The issue was fixed in:

  - bitcoin-core/libmultiprocess#91

  This update also includes other recent libmultiprocess changes to improve C++20 support and fix build issues:

  - bitcoin-core/libmultiprocess#89
  - bitcoin-core/libmultiprocess#90
  - bitcoin-core/libmultiprocess#93

ACKs for top commit:
  fanquake:
    ACK b8105b3.

Tree-SHA512: 2ca64b5fc27be752baba38df4b4faf62152e18c70ead6e0e063f1cb0c25dd5d924dec7ebfd7f8bbd651ae50eb35e8d8b591a9847c36f22558b5f5effccf56536
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 1, 2024
…++20 macos build error

b8105b3 depends: Update libmultiprocess library to fix C++20 macos build error (Ryan Ofsky)

Pull request description:

  Fixes bitcoin#29248

  The std::result_of type was removed in c++20, but was being referenced in some old, unused code in the library. The issue was fixed in:

  - bitcoin-core/libmultiprocess#91

  This update also includes other recent libmultiprocess changes to improve C++20 support and fix build issues:

  - bitcoin-core/libmultiprocess#89
  - bitcoin-core/libmultiprocess#90
  - bitcoin-core/libmultiprocess#93

ACKs for top commit:
  fanquake:
    ACK b8105b3.

Tree-SHA512: 2ca64b5fc27be752baba38df4b4faf62152e18c70ead6e0e063f1cb0c25dd5d924dec7ebfd7f8bbd651ae50eb35e8d8b591a9847c36f22558b5f5effccf56536
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Jun 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants