These days quite a lot of projects use the really nice key-value database called LevelDB.
Sometimes you might need to compile LevelDB for whatever reason — of which I would not list here for the sake of my health. 😅
But we were surprised that LevelDB codebase only compiles a static lib, and not a shared one.
Then, totally by chance, we found out in this issue how to do it — saving us tons of time.
Just for documentation purposes, the steps are as follows.
First, change the
$ sed -i "s/add_library(leveldb \"\")/add_library(leveldb \"SHARED\")/g" CMakeLists.txt
And then, execute the
cmake command with some more options:
$ env BUILD_SHARED_LIBS=on cmake -DCMAKE_BUILD_TYPE=Release .. && cmake --build .
In the end, you will see the output of a