Conversation
|
I'm a fan of obliterating boost. @ryanofsky does this also let you drop native_boost from bitcoin/bitcoin#16367? Since libmultiprocess is an optional dependency anyway, it's probably acceptable to depend on C++17. |
|
Yep, it'd allow dropping native_boost |
|
I was not sure about the switch from C++14 to 17, but thought "Why not, given its already different than bitcoin core's C++11?". Worst case - this PR waits until bitcoin core switches to C++17. |
|
This makes sense. Maybe C++14 would be compatible with more systems than 17, but I enabled 14 here before the bitcoin discussion turned to skipping 14 and going right to 17. If 17 won't work for some reason, Jeremy Rubin recently linked to two small |
|
I ran into some issues trying to use this with bitcoin. The biggest problem is that I also needed two tweaks to fix some simpler errors: diff --git a/include/mp/proxy-io.h b/include/mp/proxy-io.h
index 8cfb87a..ec5d00a 100644
--- a/include/mp/proxy-io.h
+++ b/include/mp/proxy-io.h
@@ -12,6 +12,7 @@
#include <capnp/rpc-twoparty.h>
+#include <assert.h>
#include <functional>
#include <map>
#include <memory>
diff --git a/pkgconfig/libmultiprocess.pc.in b/pkgconfig/libmultiprocess.pc.in
index 506e356..d8bda42 100644
--- a/pkgconfig/libmultiprocess.pc.in
+++ b/pkgconfig/libmultiprocess.pc.in
@@ -9,4 +9,4 @@ Description: Multiprocess IPC library
Version: 0.0
Libs: -L${libdir} -lmultiprocess -L${capnp_prefix}/lib -lcapnp-rpc -lcapnp -lkj-async -lkj -pthread -lpthread
-Cflags: -std=c++14 -I${includedir} -I${capnp_prefix}/include -pthread
+Cflags: -std=c++17 -I${includedir} -I${capnp_prefix}/include -pthread |
This would help replace boost::optional with std::optional and completely remove Boost as a dependency of this project.
* While it may be possible to refactor the code in a way that it does not use any `optional` types, like in a616312, fb73b81, 138ad67, 5724a2c, that would be error prone and would require bigger changes. Instead replace `boost::optional` with `std::optional`, now that we are using C++17. * Removing `boost::current_exception_diagnostic_information()` - if the caught exception is an instance of `std::exception`, use its `what()` method. Otherwise don't provide extra diagnostic information. After all `boost::current_exception_diagnostic_information()` would return "No diagnostic information available." if it is not `std::exception` or `boost::exception`. * Clean up any mentions of Boost from README.md and CMakeLists.txt.
|
@ryanofsky alternatively you could add c++17 support to Bitcoin Core's |
|
I tried some things that did not work, need to study this more but I feel like it should be possible to resolve the issue solely on the libmultiprocess side and still not have any traces of boost in it. In the meantime I added the fix for |
|
Thanks! I should be able to merge this soon. I just need to add ReadField/BuildField overloads for boost::optional in bitcoin/bitcoin#10102 before merging this |
|
I was able to get ReadField/BuildField overloads working, so "Obliterate Boost" commit 10b5c69 no longer causes compile errors. But it turns out this problem was masking another problem: some really confusing link errors caused by the earlier "Switch from C++14 to C++17" commit f4112b7. This problem is also fixable, but will require doing more work on the bitcoin/bitcoin#16367 build system, adding a new library for c++17 files instead of using the existing The problem happens when linking executables such as with c++17, and with c++11. This makes it impossible to include c++11 and unused c++17 object files in the same library unless all the dependencies of the c++17 objects are fully satisfied, because even when the c++17 objects are unused and unneeded, the linker will think they are needed because of the weak definitions they contain. So the result is a flood of link errors with f4112b7 when the linker fails to fully link all the unneeded c++17 object files. I should be able to fix this in bitcoin/bitcoin#16367 by splitting up the |
Yes, another approach could extend the |
|
It's also not ideal for deterministic building if |
Forgot to write an update, but this was the approach I took to resolve the problem. All the c++17 objects are now isolated into a |
Looks like this hasn't been needed since bitcoin-core/libmultiprocess#25 and was just missed in bitcoin#19160.
…cess 07dcf1a build: remove boost dep from libmultiprocess (fanquake) Pull request description: Looks like this hasn't been needed since bitcoin-core/libmultiprocess#25 and was just missed in #19160. ACKs for top commit: ryanofsky: Code review ACK 07dcf1a. Should probably wait for GUIX build results, but I think this should be fine hebasto: ACK 07dcf1a Tree-SHA512: 7988efd4aaf6ad512d60cfd33f350df56090daf88aac3aed2a1d400e80bc723dc27d27f5fa5d75359f9fae60d04b87d4b120d4e79e3079df8631956ab6c3b83c
Looks like this hasn't been needed since bitcoin-core/libmultiprocess#25 and was just missed in bitcoin#19160.
Looks like this hasn't been needed since bitcoin-core/libmultiprocess#25 and was just missed in #19160.
The "C++17" value of the `CXX_STANDARD` target property, which was introduced in bitcoin-core#25, is available in CMake 3.8 and newer.
6902bfd Fix CMake minimum required version (Hennadii Stepanov) Pull request description: The "C++17" value of the [`CXX_STANDARD`](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html) target property, which was introduced in #25, is available in CMake 3.8 and newer. Tested with old CMake versions available [here](https://cmake.org/files/). ACKs for top commit: ryanofsky: Code review ACK 6902bfd. Thanks for the PR! Tree-SHA512: 5ebb0f50c4e8799903f4ce54e6fcf66616d4d4b7b85b8789fc72728f009791bb844453c1ff285a4b06e6fb6951f168f5656f7018c80bda5807faa6aa3703342d
Looks like this hasn't been needed since bitcoin-core/libmultiprocess#25 and was just missed in #19160.
07dcf1a build: remove boost dep from libmultiprocess (fanquake) Pull request description: Looks like this hasn't been needed since bitcoin-core/libmultiprocess#25 and was just missed in bitcoin#19160. ACKs for top commit: ryanofsky: Code review ACK 07dcf1a. Should probably wait for GUIX build results, but I think this should be fine hebasto: ACK 07dcf1a Tree-SHA512: 7988efd4aaf6ad512d60cfd33f350df56090daf88aac3aed2a1d400e80bc723dc27d27f5fa5d75359f9fae60d04b87d4b120d4e79e3079df8631956ab6c3b83c
07dcf1a build: remove boost dep from libmultiprocess (fanquake) Pull request description: Looks like this hasn't been needed since bitcoin-core/libmultiprocess#25 and was just missed in bitcoin#19160. ACKs for top commit: ryanofsky: Code review ACK 07dcf1a. Should probably wait for GUIX build results, but I think this should be fine hebasto: ACK 07dcf1a Tree-SHA512: 7988efd4aaf6ad512d60cfd33f350df56090daf88aac3aed2a1d400e80bc723dc27d27f5fa5d75359f9fae60d04b87d4b120d4e79e3079df8631956ab6c3b83c
While it may be possible to refactor the code in a way that it does
not use any
optionaltypes, like in a616312, fb73b81, 138ad67,5724a2c, that would be error prone and would require bigger changes.
Switch from C++14 to C++17 instead and replace
boost::optionalwithstd::optional.Removing
boost::current_exception_diagnostic_information()- if thecaught exception is an instance of
std::exception, use itswhat()method. Otherwise don't provide extra diagnostic information. After
all
boost::current_exception_diagnostic_information()would return"No diagnostic information available." if it is not
std::exceptionor
boost::exception.Clean up any mentions of Boost from README.md and CMakeLists.txt.