Workarounds for Building with Clang on Ubuntu 22 #3008
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces workarounds for building Concord-BFT with Clang after the Ubuntu 22 upgrade.
These workarounds include:
totalVal
from the functionlibutt::Factory::randomWallets
, as this variable is unused and (with-Werror
) Clang generates an error for that.std::optional<::rocksdb::PinnableSlice>
tostd::unique_ptr<::rocksdb::PinnableSlice>
, as Clang generates an error with this particular template instantiation. Some additional context on this one: (1)std::optional<::rocksdb::PinnableSlice>
is used in Concord-BFT only as a return type forconcord::storage::rocksdb::NativeClient::getSlice
; (2) the particular error I saw is/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/optional:158:7: error: the parameter for this explicitly-defaulted copy assignment operator is const, but a member or base requires it to be non-const
operator=(const _Optional_payload_base&) = default;
. Of possible interest for this error is that I think::rocksdb::PinnableSlice
is not copy constructable, though this documentation suggestsstd::optional
's copy constructor should be defined as deleted if the base type is not copy constructable, so I am still not entirely sure about the nature of this error; (3) I am aware this type change may be a pessimization with respect to memory management (moving objects from the stack to the heap); (4) I chose this over other possible workarounds I thought of as it required fewer code changes.Building Concord-BFT with Clang (specifically Clang 14) seems to be broken as of the transition to Ubuntu 22; this is a problem for consumers of Concord-BFT that currently rely on Clang-specific instrumentation.
I have confirmed a Concord-BFT-dependent project I have been involved in builds with the fixes I have here, using Clang on Ubuntu 22. I am hoping Concord-BFT's GitHub CI will show whether these changes are breaking to Concord-BFT's default build settings.