Rocksdb is used in recent projects (so Library). The previous rocksdb is 4.3.0, which is normal for compilation. Because I want to upgrade, I upgrade rocksdb to 5.13.0
However, after modifying the project and compiling the link, LDD – R XX. So will always appear under define symbol:_ Znvtrocksdb6logger, etc
But the LDD shows that rocksdb.5.13 does link successfully, so I can’t think about it
When using the library to write test cases, the link time will be reported
xxx.so: undefined reference to `typeinfo for rocksdb::FileLock’
xxx.so: undefined reference to `typeinfo for rocksdb::Logger’
xxx.so: undefined reference to `typeinfo for rocksdb::WritableFile’
xxx.so: undefined reference to `typeinfo for rocksdb::RandomAccessFile’
xxx.so: undefined reference to `typeinfo for rocksdb::EnvWrapper’
xxx.so: undefined reference to `typeinfo for rocksdb::SequentialFile’
So look up “undefined reference to ` TypeInfo” and see http://blog.csdn.net/ai2000ai/article/details/47152133 Article
Originally, the new version of rocksdb introduced use_ RTTI option, you can switch the TypeInfo of the required function, then add “use”_ RTTI = 1 “recompile rocksdb
Add – frtti when you compile your own project. Finally, there is no undefine symbol error in LDD
However, when linking test cases, errors such as XXX. So: undefined reference to ` TypeInfo for rocksdb:: filelock ‘still appear
So nm – C XXX. So | grep logger can still be seen
U typeinfo for rocksdb::Logger
U vtable for rocksdb::Logger
Depressed again, thinking hard
After some entanglement, I found that when linking test cases, it is better to link rocksdb. So. 5.13.0
That’s what it came out of
U typeinfo for rocksdb::Logger
U vtable for rocksdb::Logger
Does that mean it’s normal