Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to enable RTTI without modify leveldb/CMakeList.txt #731

Open
luguoxiang opened this issue Sep 15, 2019 · 8 comments
Open

How to enable RTTI without modify leveldb/CMakeList.txt #731

luguoxiang opened this issue Sep 15, 2019 · 8 comments
Labels

Comments

@luguoxiang
Copy link

luguoxiang commented Sep 15, 2019

I use cmake to build leveldb with my project,

add_subdirectory(leveldb)
target_link_libraries( ${APP_EXEC}  ...leveldb )

It seems leveldb disable RTTI (-f no-rtti) by default, there is some other third party library in my project which requires RTTI, is there any way to enable RTTI without modify leveldb/CMakeList.txt?

@luguoxiang luguoxiang changed the title How to enable RTTI without modify CMakeList.txt How to enable RTTI without modify level dub/CMakeList.txt Sep 15, 2019
@luguoxiang luguoxiang changed the title How to enable RTTI without modify level dub/CMakeList.txt How to enable RTTI without modify leveldb/CMakeList.txt Sep 15, 2019
@cmumford
Copy link
Contributor

Does your other third party library need to dynamically determine the type of the leveldb objects in include/leveldb, or for other objects? If not the you should be OK to leave RTTI disabled for leveldb, but enable it for other code. However, if you really do need RTTI enabled for leveldb then I think you will need to modify CMakeLists.txt as it is hard-coded to be disabled. I'm not a CMake expert, so there may be some environment variable that can modify CMAKE_CXX_FLAGS.

@luguoxiang
Copy link
Author

luguoxiang commented Sep 16, 2019

It seems leveldb::Comparator does not work when RTTI disabled for leveldb and mycode is rtti enabled: https://stackoverflow.com/questions/57670944/undefined-symbols-for-architecture-x86-64-typeinfo-for-leveldbcomparator, is there any way to fix this issue while leaving my code rtti enabled?

@muffinrecon
Copy link

@luguoxiang

Separating the comparator into its own cpp file and compiling with the -fno-rtti flag worked best for me.

@vermorth
Copy link

@luguoxiang
I have the same problem as you. And my code uses a lot of typeid, so I can't do as @muffinrecon said:

Separating the comparator into its own cpp file and compiling with the -fno-rtti flag worked best for me.

My only way is to enable rtti for leveldb. What did you do in the end?

@luguoxiang
Copy link
Author

I went back to use leveled 1.22 which seems enabled rtti by default.

@susnux
Copy link

susnux commented Jun 9, 2021

This breaks @ceph /ceph:

[ 1547s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../../lib/libkv.a(LevelDBStore.cc.o):(.data.rel.ro._ZTI17CephLevelDBLogger[_ZTI17CephLevelDBLogger]+0x10): undefined reference to `typeinfo for leveldb::Logger'

@kalebskeithley
Copy link

The addition of -fno-rtti between 1.22 and 1.23 is an ABI change and should include an soname bump as well.

As susnux mentions above, this breaks the Ceph build, in my case in Fedora F35/rawhide.

see #927

@wbolster
Copy link

this also prevents leveldb 1.23 to be used in python via plyvel, see e.g. wbolster/plyvel#114

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Dec 31, 2021
needed for ceph and plyvel and possibly other consumers
Arch Linux also enables it

google/leveldb#731

Reported-by: Louis Sautier <sbraz@gentoo.org>
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants