天天看點

Install LevelDBDownloadBuilding

通路本站觀看效果更佳

Download

LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.

The project page is leveldb

After cloning the project,then let’s build the project.

Building

mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release .. && cmake --build .
           

I just uing Ubuntu16.04. I have encountered an error as shown below.

CMake Error at CMakeLists.txt:5 (cmake_minimum_required):
  CMake 3.9 or higher is required.  You are running version 3.5.1


-- Configuring incomplete, errors occurred!
           

Let us solve this problem.

  1. To install the latest version,we have first to remove the installed version.
sudo apt purge cmake
           
  1. Then go to cmake and download the latest version you need.
  • In my case cmake-3.12.1-Linux-x86_64.sh is sufficient.
  1. chmod +x /path/to/cmake-3.12.1-Linux-x86_64.sh

    (use your own file location here, but chmod makes the script executable)
  2. sudo ./path/to/cmake-3.12.1-Linux-x86_64.sh

    (you’ll need to press y twice)
  3. sudo ln -s /path/to/cmake-3.6.2-Linux-x86_64/bin/* /usr/local/bin

    (Use absolute path.)
  4. Test your results with

    cmake --version

    type
cmake -DCMAKE_BUILD_TYPE=Release .. && cmake --build .
           

Successful.