-frtti inconsistent in build (undefined reference to `typeinfo for rocksdb::Comparator')
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:
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_
@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:
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_
0000000000767c78 V typeinfo for std::exception
00000000004ece00 V typeinfo name for rocksdb:
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_
00000000004ddb48 V typeinfo name for std::exception
After making the previous change in override_
$ nm --demangle --dynamic ./librocksdb.
00000000007855c8 V typeinfo for rocksdb_
000000000078bdb0 V typeinfo for rocksdb::Comparator
0000000000787868 V typeinfo for rocksdb:
0000000000787498 V typeinfo for rocksdb:
00000000007878b0 V typeinfo for rocksdb:
00000000004eebb0 V typeinfo name for rocksdb_
0000000000501c70 V typeinfo name for rocksdb::Comparator
00000000004f6c20 V typeinfo name for rocksdb:
00000000004f50c0 V typeinfo name for rocksdb:
00000000004f6ca0 V typeinfo name for rocksdb:
Status changed to 'Confirmed' because the bug affects multiple users.