Repository: bitcoin/bitcoin (language: cpp)

Issue:
build: multiprocess compile failure on macOS
master @ 28ccc7003a4c3f198a255d6f55f5748d4fd8fd1a

```bash
Apple clang version 15.0.0 (clang-1500.1.0.2.5)

make -C depends -j12 MULTIPROCESS=1 NO_QT=1 NO_WALLET=1 NO_NATPMP=1 NO_UPNP=1 NO_ZMQ=1
./autogen.sh
CONFIG_SITE=/bitcoin/depends/aarch64-apple-darwin23.2.0/share/config.site ./configure
make
```

```bash
In file included from ipc/capnp/echo.capnp.proxy-client.c++:3:
In file included from ./ipc/capnp/echo.capnp.proxy-types.h:6:
In file included from ./ipc/capnp/echo.capnp.proxy.h:9:
In file included from /bitcoin/depends/aarch64-apple-darwin23.2.0/include/mp/proxy.h:8:
/bitcoin/depends/aarch64-apple-darwin23.2.0/include/mp/util.h:128:23: error: no type named 'result_of' in namespace 'std'
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
        ~~~~~~~~~~~~~~^~~~~~~~~
/bitcoin/depends/aarch64-apple-darwin23.2.0/include/mp/util.h:128:32: error: expected ';' at end of declaration list
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
                               ^
                               ;
2 errors generated.
```

`std::result_of` was [removed in C++20](https://en.cppreference.com/w/cpp/types/result_of), but we are still using it in multiprocess: https://github.com/chaincodelabs/libmultiprocess/blob/2cbbd09d8b9972a8f5c68b510c0dae9a9f7a22da/include/mp/util.h#L128.

By the looks of it, we can probably remove most of the code in that file, given we now require C++20.
cc @ryanofsky.


Discussion / hints:
I confirm this. I installed libmutiprocess manually; I'm not using what's on `depends`, but it generates the same error.

Moreover, I tried on the current master head (03c5b006) and build fails in more places.

```
  CXX      ipc/capnp/libbitcoin_ipc_a-echo.capnp.o
  CXX      ipc/capnp/libbitcoin_ipc_a-init.capnp.o
  CXX      ipc/capnp/libbitcoin_ipc_a-echo.capnp.proxy-client.o
  CXX      ipc/capnp/libbitcoin_ipc_a-init.capnp.proxy-client.o
  CXX      ipc/capnp/libbitcoin_ipc_a-echo.capnp.proxy-server.o
  CXX      ipc/capnp/libbitcoin_ipc_a-init.capnp.proxy-server.o
  CXX      ipc/capnp/libbitcoin_ipc_a-echo.capnp.proxy-types.o
  CXX      ipc/capnp/libbitcoin_ipc_a-init.capnp.proxy-types.o
In file included from ipc/capnp/echo.capnp.proxy-client.c++:3:
In file included from ./ipc/capnp/echo.capnp.proxy-types.h:6:
In file included from ./ipc/capnp/echo.capnp.proxy.h:9:
In file included from /usr/local/include/mp/proxy.h:8:
/usr/local/include/mp/util.h:128:23: error: no type named 'result_of' in namespace 'std'
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
        ~~~~~~~~~~~~~~^~~~~~~~~
/usr/local/include/mp/util.h:128:32: error: expected ';' at end of declaration list
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
                               ^
                               ;
In file included from ipc/capnp/echo.capnp.proxy-server.c++:3:
In file included from ./ipc/capnp/echo.capnp.proxy-types.h:6:
In file included from ./ipc/capnp/echo.capnp.proxy.h:9:
In file included from /usr/local/include/mp/proxy.h:8:
/usr/local/include/mp/util.h:128:23: error: no type named 'result_of' in namespace 'std'
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
        ~~~~~~~~~~~~~~^~~~~~~~~
/usr/local/include/mp/util.h:128:32: error: expected ';' at end of declaration list
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
                               ^
                               ;
2 errors generated.
  CCLD     libsecp256k1_precomputed.la
make[2]: *** [ipc/capnp/libbitcoin_ipc_a-echo.capnp.proxy-client.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from ipc/process.cpp:7:
/usr/local/include/mp/util.h:128:23: error: no type named 'result_of' in namespace 'std'
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
        ~~~~~~~~~~~~~~^~~~~~~~~
/usr/local/include/mp/util.h:128:32: error: expected ';' at end of declaration list
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
                               ^
                               ;
In file included from ipc/capnp/echo.capnp.proxy-types.c++:3:
In file included from ./ipc/capnp/echo.capnp.proxy-types.h:6:
In file included from ./ipc/capnp/echo.capnp.proxy.h:9:
In file included from /usr/local/include/mp/proxy.h:8:
/usr/local/include/mp/util.h:128:23: error: no type named 'result_of' in namespace 'std'
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
        ~~~~~~~~~~~~~~^~~~~~~~~
/usr/local/include/mp/util.h:128:32: error: expected ';' at end of declaration list
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
                               ^
                               ;
2 errors generated.
2 errors generated.
make[2]: *** [ipc/libbitcoin_ipc_a-process.o] Error 1
make[2]: *** [ipc/capnp/libbitcoin_ipc_a-echo.capnp.proxy-server.o] Error 1
In file included from ipc/capnp/init.capnp.proxy-client.c++:3:
In file included from ./ipc/capnp/init.capnp.proxy-types.h:6:
In file included from ./ipc/capnp/init.capnp.proxy.h:9:
In file included from /usr/local/include/mp/proxy.h:8:
/usr/local/include/mp/util.h:128:23: error: no type named 'result_of' in namespace 'std'
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
        ~~~~~~~~~~~~~~^~~~~~~~~
/usr/local/include/mp/util.h:128:32: error: expected ';' at end of declaration list
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
                               ^
                               ;
2 errors generated.
make[2]: *** [ipc/capnp/libbitcoin_ipc_a-echo.capnp.proxy-types.o] Error 1
In file included from ipc/capnp/init.capnp.proxy-server.c++:3:
In file included from ./ipc/capnp/init.capnp.proxy-types.h:6:
In file included from ./ipc/capnp/init.capnp.proxy.h:9:
In file included from /usr/local/include/mp/proxy.h:8:
/usr/local/include/mp/util.h:128:23: error: no type named 'result_of' in namespace 'std'
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
        ~~~~~~~~~~~~~~^~~~~~~~~
/usr/local/include/mp/util.h:128:32: error: expected ';' at end of declaration list
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
                               ^
                               ;
2 errors generated.
make[2]: *** [ipc/capnp/libbitcoin_ipc_a-init.capnp.proxy-client.o] Error 1
In file included from ipc/capnp/init.capnp.proxy-types.c++:3:
In file included from ./ipc/capnp/init.capnp.proxy-types.h:6:
In file included from ./ipc/capnp/init.capnp.proxy.h:9:
In file included from /usr/local/include/mp/proxy.h:8:
/usr/local/include/mp/util.h:128:23: error: no type named 'result_of' in namespace 'std'
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
        ~~~~~~~~~~~~~~^~~~~~~~~
/usr/local/include/mp/util.h:128:32: error: expected ';' at end of declaration list
        typename std::result_of<Base(BoundArgs&..., BindArg&, FreeArgs...)>::type
                               ^
                               ;
2 errors generated.
make[2]: *** [ipc/capnp/libbitcoin_ipc_a-init.capnp.proxy-server.o] Error 1
2 errors generated.
make[2]: *** [ipc/capnp/libbitcoin_ipc_a-init.capnp.proxy-types.o] Error 1
  CCLD     libsecp256k1.la
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
```

Not using homebrew, but macports to install dependencies.

```bash
CPPFLAGS="$CPPFLAGS -isystem /opt/local/include" LIBS="$LIBS -L/opt/local/lib" PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" LIBMULTIPROCESS_CFLAGS="-I/usr/local/include" LIBMULTIPROCESS_LIBS="-L/usr/local/lib" EVENT_CFLAGS="-I/opt/local/include" EVENT_LIBS="-L/opt/local/lib -levent" ./configure --enable-multiprocess --without-dbd --without-miniupnpc --without-natpmp --without-gui --disable-zmq --disable-wallet --with-boost=/opt/local/libexec/boost/1.78

make -j11
```
Thanks for the reminder. Will try to implement a fix for this today!

Fix patch:
diff --git a/depends/packages/native_libmultiprocess.mk b/depends/packages/native_libmultiprocess.mk
index 946e885354aac..bcdb1f9e7c42b 100644
--- a/depends/packages/native_libmultiprocess.mk
+++ b/depends/packages/native_libmultiprocess.mk
@@ -1,8 +1,8 @@
 package=native_libmultiprocess
-$(package)_version=414542f81e0997354b45b8ade13ca144a3e35ff1
+$(package)_version=8da797c5f1644df1bffd84d10c1ae9836dc70d60
 $(package)_download_path=https://github.com/chaincodelabs/libmultiprocess/archive
 $(package)_file_name=$($(package)_version).tar.gz
-$(package)_sha256_hash=8542dbaf8c4fce8fd7af6929f5dc9b34dffa51c43e9ee360e93ee0f34b180bc2
+$(package)_sha256_hash=030f4d393d2ac9deba98d2e1973e22fc439ffc009d5f8ae3225c90639f86beb0
 $(package)_dependencies=native_capnp
 
 define $(package)_config_cmds


Test patch: