-frtti inconsistent in build (undefined reference to `typeinfo for rocksdb::Comparator')

Bug #1839382 reported by Brian Carlson
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
rocksdb (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

When linking to the shared library in librocksdb-dev, the linker is unable to find symbols in the shared library (for example -- undefined reference to `typeinfo for rocksdb::Comparator')

This is because the make line needs USE_RTTI=1:

When building rocksdb (at least for this version), the make all target defaults to using RTTI (and a DEBUG>0), where as make shared does not use RTTI (-fno-rtti option is passed and DEBUG == 0).

This causes problems for executable which are using rtti (i.e. have not explicitly specified -fno-rtti)

I believe the debian/rules file should have:
The USE_RTTI=1 is optional for the "make all" part of the target.

override_dh_auto_build:
 @echo ARCH=`uname -m`
 PORTABLE=1 USE_RTTI=1 make all
 PORTABLE=1 USE_RTTI=1 make shared_lib

Here are the typeinfo values in the current .so file:

$ nm --demangle --dynamic librocksdb.so.5.8.8 | grep typeinfo
000000000076e698 V typeinfo for rocksdb::RedisListException
                 U typeinfo for char const*
000000000076b620 V typeinfo for std::logic_error
000000000076b6e8 V typeinfo for std::future_error
000000000076b650 V typeinfo for std::out_of_range
0000000000767c88 V typeinfo for std::runtime_error
000000000076b638 V typeinfo for std::invalid_argument
0000000000767c78 V typeinfo for std::exception
00000000004ece00 V typeinfo name for rocksdb::RedisListException
00000000004e7db0 V typeinfo name for std::logic_error
00000000004e9170 V typeinfo name for std::future_error
00000000004e7de0 V typeinfo name for std::out_of_range
00000000004ddb60 V typeinfo name for std::runtime_error
00000000004e7dc0 V typeinfo name for std::invalid_argument
00000000004ddb48 V typeinfo name for std::exception

After making the previous change in override_dh_auto_build, the typeinfo values are:
$ nm --demangle --dynamic ./librocksdb.so|grep typeinfo|grep -i comparator
00000000007855c8 V typeinfo for rocksdb_comparator_t
000000000078bdb0 V typeinfo for rocksdb::Comparator
0000000000787868 V typeinfo for rocksdb::MemTableRep::KeyComparator
0000000000787498 V typeinfo for rocksdb::InternalKeyComparator
00000000007878b0 V typeinfo for rocksdb::MemTable::KeyComparator
00000000004eebb0 V typeinfo name for rocksdb_comparator_t
0000000000501c70 V typeinfo name for rocksdb::Comparator
00000000004f6c20 V typeinfo name for rocksdb::MemTableRep::KeyComparator
00000000004f50c0 V typeinfo name for rocksdb::InternalKeyComparator
00000000004f6ca0 V typeinfo name for rocksdb::MemTable::KeyComparator

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in rocksdb (Ubuntu):
status: New → Confirmed
Revision history for this message
Jan Wielemaker (j-wielemaker) wrote :

This also applies MergeOperator. In addition, the static lib is not compiled with -fPIC and can thus not be used to create a plugin (.so) for another project. See also https://github.com/facebook/rocksdb/issues/3811

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.