Open ldeng-ustc opened 9 months ago
I'm having the same issue. I build both snappy and leveldb using FetchContent, and to solve this currently, I am setting HAVE_SNAPPY
to true (something like this: set(HAVE_SNAPPY ON CACHE BOOL "" FORCE)
), before building leveldb.
It seems to work however I assume that this is dependent on snappy building before leveldb to work.
Here is my CMakeLists.txt
: CMakeLists.txt
I can see that check_library_exists
is used to find snappy, however the LOCATION
variable is simply set to ""
which, I assume, means that it will only look in the default system locations for snappy, i.e. it has to be installed previously, and you must have install permissions.
Would love to know if there is a proper way to build both snappy & leveldb in my project and have them link correctly.
I manually compiled and installed snappy 1.10 from source, then I tried to use cmake to compile levelDB, but it still prompted that it could not find snappy_compress, and compression would not be performed at runtime. The cmake prompt is as follows:
If I manually modify CMakeLists.txt and set
HAVE_SNAPPY
on line 42 toON
, the compilation can succeed, and the compression function can run normally.The following is the output in CMakeError.log (I don’t know if this is related to the problem):