Skip to content

rocksdb 9.9.3 enable RTTI (needed in order to subclass MergeOperator, etc.)

doitwithnotepad requested to merge doitwithnotepad/aports:rocksdb into master

rocksdb 9.9.3 does not have enabled RTTI, which means the rocksdb library no exports typeinfo for rocksdb::MergeOperator, rocksdb::AssociativeMergeOperator, ..., so users of the library can't subclass these classes.

Here's a trivial reproducer:

#include <rocksdb/merge_operator.h>

class ConcatOperator : public rocksdb::AssociativeMergeOperator {
public:
    bool Merge(const rocksdb::Slice&, const rocksdb::Slice*, const rocksdb::Slice&, std::string*, rocksdb::Logger*) const override { return true; }
    const char* Name() const override { return "ConcatOperator"; }
};

int main()
{
    ConcatOperator op;
    return 0;
}

Try g++ -o rocksdb-test ./rocksdb-test.cc -lrocksdb with the above and the linker will fail with "undefined reference to 'typeinfo for rocksdb::AssociativeMergeOperator'" if RTTI was disabled in the rocksdb build.

@Kladky @ptrcnull

Edited by doitwithnotepad

Merge request reports

Loading